Update PHP-CS-Fixer rules
This commit is contained in:
parent
38b360f912
commit
fcd9f10663
117
.php_cs.dist
117
.php_cs.dist
|
@ -1,11 +1,8 @@
|
|||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude(['vendor', 'tests/data/Calculation'])
|
||||
->in('samples')
|
||||
->in('src')
|
||||
->in('tests/PhpSpreadsheetTests')
|
||||
;
|
||||
->exclude('vendor')
|
||||
->in(__DIR__);
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
|
@ -13,21 +10,27 @@ return PhpCsFixer\Config::create()
|
|||
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__))
|
||||
->setRules([
|
||||
'align_multiline_comment' => true,
|
||||
'array_indentation' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'backtick_to_shell_exec' => true,
|
||||
'binary_operator_spaces' => true,
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_after_opening_tag' => true,
|
||||
'blank_line_before_return' => false, // Deprecated
|
||||
'blank_line_before_statement' => true,
|
||||
'braces' => true,
|
||||
'cast_spaces' => true,
|
||||
'class_attributes_separation' => ['elements' => ['method', 'property']], // const are often grouped with other related const
|
||||
'class_definition' => true,
|
||||
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
|
||||
'class_keyword_remove' => false, // ::class keyword gives us better support in IDE
|
||||
'combine_consecutive_issets' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'combine_nested_dirname' => true,
|
||||
'comment_to_phpdoc' => true,
|
||||
'compact_nullable_typehint' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'constant_case' => true,
|
||||
'date_time_immutable' => false, // Break our unit tests
|
||||
'declare_equal_normalize' => true,
|
||||
'declare_strict_types' => false, // Too early to adopt strict types
|
||||
'dir_constant' => true,
|
||||
|
@ -38,39 +41,57 @@ return PhpCsFixer\Config::create()
|
|||
'elseif' => true,
|
||||
'encoding' => true,
|
||||
'ereg_to_preg' => true,
|
||||
'error_suppression' => true,
|
||||
'escape_implicit_backslashes' => true,
|
||||
'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read
|
||||
'explicit_string_variable' => false, // I feel it makes the code actually harder to read
|
||||
'final_class' => false, // We need non-final classes
|
||||
'final_internal_class' => true,
|
||||
'final_public_method_for_abstract_class' => false, // We need non-final methods
|
||||
'final_static_access' => true,
|
||||
'fopen_flag_order' => true,
|
||||
'fopen_flags' => true,
|
||||
'full_opening_tag' => true,
|
||||
'fully_qualified_strict_types' => true,
|
||||
'function_declaration' => true,
|
||||
'function_to_constant' => true,
|
||||
'function_typehint_space' => true,
|
||||
'general_phpdoc_annotation_remove' => false, // No use for that
|
||||
'hash_to_slash_comment' => true,
|
||||
'global_namespace_import' => true,
|
||||
'hash_to_slash_comment' => false, // Deprecated
|
||||
'header_comment' => false, // We don't use common header in all our files
|
||||
'heredoc_indentation' => false, // Requires PHP >= 7.3
|
||||
'heredoc_to_nowdoc' => false, // Not sure about this one
|
||||
'implode_call' => true,
|
||||
'include' => true,
|
||||
'increment_style' => true,
|
||||
'indentation_type' => true,
|
||||
'is_null' => ['use_yoda_style' => false],
|
||||
'linebreak_after_opening_tag' => true,
|
||||
'is_null' => true,
|
||||
'line_ending' => true,
|
||||
'linebreak_after_opening_tag' => true,
|
||||
'list_syntax' => ['syntax' => 'short'],
|
||||
'logical_operators' => true,
|
||||
'lowercase_cast' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_constants' => false, // Deprecated
|
||||
'lowercase_keywords' => true,
|
||||
'lowercase_static_reference' => true,
|
||||
'magic_constant_casing' => true,
|
||||
'magic_method_casing' => true,
|
||||
'mb_str_functions' => false, // No, too dangerous to change that
|
||||
'method_argument_space' => true,
|
||||
'method_chaining_indentation' => true,
|
||||
'method_separation' => true,
|
||||
'method_separation' => false, // Deprecated
|
||||
'modernize_types_casting' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'multiline_whitespace_before_semicolons' => true,
|
||||
'native_constant_invocation' => false, // Micro optimization that look messy
|
||||
'native_function_casing' => true,
|
||||
'native_function_invocation' => false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now
|
||||
'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it
|
||||
'native_function_type_declaration_casing' => true,
|
||||
'new_with_braces' => true,
|
||||
'no_alias_functions' => true,
|
||||
'no_alternative_syntax' => true,
|
||||
'no_binary_string' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
|
||||
|
@ -80,16 +101,15 @@ return PhpCsFixer\Config::create()
|
|||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_blank_lines' => true,
|
||||
'no_extra_consecutive_blank_lines' => false, // Deprecated
|
||||
'no_homoglyph_names' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_mixed_echo_print' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => true,
|
||||
'non_printable_character' => true,
|
||||
'no_multiline_whitespace_before_semicolons' => false, // Deprecated
|
||||
'no_null_property_initialization' => true,
|
||||
'no_php4_constructor' => true,
|
||||
'normalize_index_brace' => true,
|
||||
'no_short_bool_cast' => true,
|
||||
'no_short_echo_tag' => true,
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
|
@ -97,29 +117,55 @@ return PhpCsFixer\Config::create()
|
|||
'no_spaces_around_offset' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_superfluous_elseif' => false, // Might be risky on a huge code base
|
||||
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
|
||||
'not_operator_with_successor_space' => false, // idem
|
||||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unneeded_curly_braces' => true,
|
||||
'no_unneeded_final_method' => true,
|
||||
'no_unreachable_default_argument_value' => true,
|
||||
'no_unset_cast' => true,
|
||||
'no_unset_on_property' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'non_printable_character' => true,
|
||||
'normalize_index_brace' => true,
|
||||
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
|
||||
'not_operator_with_successor_space' => false, // idem
|
||||
'nullable_type_declaration_for_default_null_value' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'ordered_class_elements' => false, // We prefer to keep some freedom
|
||||
'ordered_imports' => true,
|
||||
'ordered_interfaces' => true,
|
||||
'php_unit_construct' => true,
|
||||
'php_unit_dedicate_assert' => true,
|
||||
'php_unit_dedicate_assert_internal_type' => true,
|
||||
'php_unit_expectation' => true,
|
||||
'php_unit_fqcn_annotation' => true,
|
||||
'php_unit_internal_class' => false, // Because tests are excluded from package
|
||||
'php_unit_method_casing' => true,
|
||||
'php_unit_mock' => true,
|
||||
'php_unit_mock_short_will_return' => true,
|
||||
'php_unit_namespaced' => true,
|
||||
'php_unit_no_expectation_annotation' => true,
|
||||
'php_unit_ordered_covers' => true,
|
||||
'php_unit_set_up_tear_down_visibility' => true,
|
||||
'php_unit_size_class' => false, // That seems extra work to maintain for little benefits
|
||||
'php_unit_strict' => false, // We sometime actually need assertEquals
|
||||
'php_unit_test_annotation' => true,
|
||||
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
|
||||
'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage
|
||||
'phpdoc_add_missing_param_annotation' => true,
|
||||
'phpdoc_align' => false, // Waste of time
|
||||
'phpdoc_annotation_without_dot' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_inline_tag' => true,
|
||||
'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_alias_tag' => true,
|
||||
'phpdoc_no_empty_return' => true,
|
||||
|
@ -132,43 +178,46 @@ return PhpCsFixer\Config::create()
|
|||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_summary' => true,
|
||||
'phpdoc_to_comment' => true,
|
||||
'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use
|
||||
'phpdoc_to_return_type' => false, // idem
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_types_order' => true,
|
||||
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_types_order' => true,
|
||||
'phpdoc_var_annotation_correct_order' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'php_unit_construct' => true,
|
||||
'php_unit_dedicate_assert' => true,
|
||||
'php_unit_expectation' => true,
|
||||
'php_unit_fqcn_annotation' => true,
|
||||
'php_unit_mock' => true,
|
||||
'php_unit_namespaced' => true,
|
||||
'php_unit_no_expectation_annotation' => true,
|
||||
'php_unit_strict' => false, // We sometime actually need assertEquals
|
||||
'php_unit_test_annotation' => true,
|
||||
'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage
|
||||
'pow_to_exponentiation' => false,
|
||||
'pow_to_exponentiation' => true,
|
||||
'pre_increment' => false, // Deprecated
|
||||
'protected_to_private' => true,
|
||||
'psr0' => true,
|
||||
'psr4' => true,
|
||||
'random_api_migration' => false, // This breaks our unit tests
|
||||
'random_api_migration' => true,
|
||||
'return_assignment' => false, // Sometimes useful for clarity or debug
|
||||
'return_type_declaration' => true,
|
||||
'self_accessor' => true,
|
||||
'self_static_accessor' => true,
|
||||
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
|
||||
'set_type_to_cast' => true,
|
||||
'short_scalar_cast' => true,
|
||||
'silenced_deprecation_error' => true,
|
||||
'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null
|
||||
'silenced_deprecation_error' => false, // Deprecated
|
||||
'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages
|
||||
'simplified_null_return' => false, // Even if technically correct we prefer to be explicit
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'single_line_comment_style' => true,
|
||||
'single_line_throw' => false, // I don't see any reason for having a special case for Exception
|
||||
'single_quote' => true,
|
||||
'single_trait_insert_per_statement' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_increment' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
|
||||
'strict_comparison' => false, // No, too dangerous to change that
|
||||
'strict_param' => false, // No, too dangerous to change that
|
||||
'string_line_ending' => true,
|
||||
'switch_case_semicolon_to_colon' => true,
|
||||
'switch_case_space' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
|
@ -177,7 +226,7 @@ return PhpCsFixer\Config::create()
|
|||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'visibility_required' => true,
|
||||
'void_return' => false, // Cannot use that with PHP 5.6
|
||||
'void_return' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
'yoda_style' => false,
|
||||
]);
|
||||
|
|
|
@ -59,18 +59,18 @@ foreach ($years as $year) {
|
|||
$period,
|
||||
$i
|
||||
);
|
||||
$value = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$value = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$salesValue = $invoiceValue = null;
|
||||
$incomeOrExpenditure = rand(-1, 1);
|
||||
$incomeOrExpenditure = mt_rand(-1, 1);
|
||||
if ($incomeOrExpenditure == -1) {
|
||||
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||
$expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$income = null;
|
||||
} elseif ($incomeOrExpenditure == 1) {
|
||||
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
} else {
|
||||
$expenditure = null;
|
||||
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
}
|
||||
$dataArray = [$year,
|
||||
$period,
|
||||
|
|
|
@ -59,18 +59,18 @@ foreach ($years as $year) {
|
|||
$period,
|
||||
$i
|
||||
);
|
||||
$value = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$value = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$salesValue = $invoiceValue = null;
|
||||
$incomeOrExpenditure = rand(-1, 1);
|
||||
$incomeOrExpenditure = mt_rand(-1, 1);
|
||||
if ($incomeOrExpenditure == -1) {
|
||||
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||
$expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$income = null;
|
||||
} elseif ($incomeOrExpenditure == 1) {
|
||||
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
} else {
|
||||
$expenditure = null;
|
||||
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
}
|
||||
$dataArray = [$year,
|
||||
$period,
|
||||
|
|
|
@ -59,18 +59,18 @@ foreach ($years as $year) {
|
|||
$period,
|
||||
$i
|
||||
);
|
||||
$value = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$value = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$salesValue = $invoiceValue = null;
|
||||
$incomeOrExpenditure = rand(-1, 1);
|
||||
$incomeOrExpenditure = mt_rand(-1, 1);
|
||||
if ($incomeOrExpenditure == -1) {
|
||||
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||
$expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$income = null;
|
||||
} elseif ($incomeOrExpenditure == 1) {
|
||||
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$expenditure = mt_rand(-1000, -500) * (1 + (mt_rand(-1, 1) / 4));
|
||||
$income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
} else {
|
||||
$expenditure = null;
|
||||
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||
$income = mt_rand(500, 1000) * (1 + (mt_rand(-1, 1) / 4));
|
||||
}
|
||||
$dataArray = [$year,
|
||||
$period,
|
||||
|
|
|
@ -26,22 +26,22 @@ $spreadsheet->setActiveSheetIndex(0);
|
|||
|
||||
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
|
||||
['fill' => [
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFCCFFCC'],
|
||||
],
|
||||
'borders' => [
|
||||
'bottom' => ['borderStyle' => Border::BORDER_THIN],
|
||||
'right' => ['borderStyle' => Border::BORDER_MEDIUM],
|
||||
],
|
||||
]
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFCCFFCC'],
|
||||
],
|
||||
'borders' => [
|
||||
'bottom' => ['borderStyle' => Border::BORDER_THIN],
|
||||
'right' => ['borderStyle' => Border::BORDER_MEDIUM],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
|
||||
['fill' => [
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFFFFF00'],
|
||||
],
|
||||
]
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFFFFF00'],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Save
|
||||
|
|
|
@ -30,26 +30,26 @@ $sharedStyle2 = new Style();
|
|||
|
||||
$sharedStyle1->applyFromArray(
|
||||
['fill' => [
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFCCFFCC'],
|
||||
],
|
||||
'borders' => [
|
||||
'bottom' => ['borderStyle' => Border::BORDER_THIN],
|
||||
'right' => ['borderStyle' => Border::BORDER_MEDIUM],
|
||||
],
|
||||
]
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFCCFFCC'],
|
||||
],
|
||||
'borders' => [
|
||||
'bottom' => ['borderStyle' => Border::BORDER_THIN],
|
||||
'right' => ['borderStyle' => Border::BORDER_MEDIUM],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$sharedStyle2->applyFromArray(
|
||||
['fill' => [
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFFFFF00'],
|
||||
],
|
||||
'borders' => [
|
||||
'bottom' => ['borderStyle' => Border::BORDER_THIN],
|
||||
'right' => ['borderStyle' => Border::BORDER_MEDIUM],
|
||||
],
|
||||
]
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'color' => ['argb' => 'FFFFFF00'],
|
||||
],
|
||||
'borders' => [
|
||||
'bottom' => ['borderStyle' => Border::BORDER_THIN],
|
||||
'right' => ['borderStyle' => Border::BORDER_MEDIUM],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$spreadsheet->getActiveSheet()->duplicateStyle($sharedStyle1, 'A1:T100');
|
||||
|
|
|
@ -21,7 +21,11 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
|||
|
||||
// Generate an image
|
||||
$helper->log('Generate an image');
|
||||
$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream');
|
||||
$gdImage = @imagecreatetruecolor(120, 20);
|
||||
if (!$gdImage) {
|
||||
die('Cannot Initialize new GD image stream');
|
||||
}
|
||||
|
||||
$textColor = imagecolorallocate($gdImage, 255, 255, 255);
|
||||
imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor);
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ $spreadsheet = $reader->load(__DIR__ . '/../templates/30template.xls');
|
|||
|
||||
$helper->log('Add new data to the template');
|
||||
$data = [['title' => 'Excel for dummies',
|
||||
'price' => 17.99,
|
||||
'quantity' => 2,
|
||||
],
|
||||
'price' => 17.99,
|
||||
'quantity' => 2,
|
||||
],
|
||||
['title' => 'PHP for dummies',
|
||||
'price' => 15.99,
|
||||
'quantity' => 1,
|
||||
|
|
|
@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -15,20 +15,20 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', '', 'Budget', 'Forecast', 'Actual'],
|
||||
['2010', 'Q1', 47, 44, 43],
|
||||
['', 'Q2', 56, 53, 50],
|
||||
['', 'Q3', 52, 46, 45],
|
||||
['', 'Q4', 45, 40, 40],
|
||||
['2011', 'Q1', 51, 42, 46],
|
||||
['', 'Q2', 53, 58, 56],
|
||||
['', 'Q3', 64, 66, 69],
|
||||
['', 'Q4', 54, 55, 56],
|
||||
['2012', 'Q1', 49, 52, 58],
|
||||
['', 'Q2', 68, 73, 86],
|
||||
['', 'Q3', 72, 78, 0],
|
||||
['', 'Q4', 50, 60, 0],
|
||||
]
|
||||
['', '', 'Budget', 'Forecast', 'Actual'],
|
||||
['2010', 'Q1', 47, 44, 43],
|
||||
['', 'Q2', 56, 53, 50],
|
||||
['', 'Q3', 52, 46, 45],
|
||||
['', 'Q4', 45, 40, 40],
|
||||
['2011', 'Q1', 51, 42, 46],
|
||||
['', 'Q2', 53, 58, 56],
|
||||
['', 'Q3', 64, 66, 69],
|
||||
['', 'Q4', 54, 55, 56],
|
||||
['2012', 'Q1', 49, 52, 58],
|
||||
['', 'Q2', 68, 73, 86],
|
||||
['', 'Q3', 72, 78, 0],
|
||||
['', 'Q4', 50, 60, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -15,20 +15,20 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'],
|
||||
['Jan', 78, 52, 61],
|
||||
['Feb', 64, 54, 62],
|
||||
['Mar', 62, 57, 63],
|
||||
['Apr', 21, 62, 59],
|
||||
['May', 11, 75, 60],
|
||||
['Jun', 1, 75, 57],
|
||||
['Jul', 1, 79, 56],
|
||||
['Aug', 1, 79, 59],
|
||||
['Sep', 10, 75, 60],
|
||||
['Oct', 40, 68, 63],
|
||||
['Nov', 69, 62, 64],
|
||||
['Dec', 89, 57, 66],
|
||||
]
|
||||
['', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'],
|
||||
['Jan', 78, 52, 61],
|
||||
['Feb', 64, 54, 62],
|
||||
['Mar', 62, 57, 63],
|
||||
['Apr', 21, 62, 59],
|
||||
['May', 11, 75, 60],
|
||||
['Jun', 1, 75, 57],
|
||||
['Jul', 1, 79, 56],
|
||||
['Aug', 1, 79, 59],
|
||||
['Sep', 10, 75, 60],
|
||||
['Oct', 40, 68, 63],
|
||||
['Nov', 69, 62, 64],
|
||||
['Dec', 89, 57, 66],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -16,12 +16,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -16,12 +16,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Custom colors for dataSeries (gray, blue, red, orange)
|
||||
|
|
|
@ -16,20 +16,20 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Jan', 47, 45, 71],
|
||||
['Feb', 56, 73, 86],
|
||||
['Mar', 52, 61, 69],
|
||||
['Apr', 40, 52, 60],
|
||||
['May', 42, 55, 71],
|
||||
['Jun', 58, 63, 76],
|
||||
['Jul', 53, 61, 89],
|
||||
['Aug', 46, 69, 85],
|
||||
['Sep', 62, 75, 81],
|
||||
['Oct', 51, 70, 96],
|
||||
['Nov', 55, 66, 89],
|
||||
['Dec', 68, 62, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Jan', 47, 45, 71],
|
||||
['Feb', 56, 73, 86],
|
||||
['Mar', 52, 61, 69],
|
||||
['Apr', 40, 52, 60],
|
||||
['May', 42, 55, 71],
|
||||
['Jun', 58, 63, 76],
|
||||
['Jul', 53, 61, 89],
|
||||
['Aug', 46, 69, 85],
|
||||
['Sep', 62, 75, 81],
|
||||
['Oct', 51, 70, 96],
|
||||
['Nov', 55, 66, 89],
|
||||
['Dec', 68, 62, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -15,12 +15,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -16,13 +16,13 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold'],
|
||||
[10, 10, 5, 0, 50],
|
||||
[30, 20, 10, 0, 50],
|
||||
[20, 30, 15, 0, 50],
|
||||
[40, 10, 0, 0, 50],
|
||||
[100, 40, 5, 0, 50],
|
||||
],
|
||||
['Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold'],
|
||||
[10, 10, 5, 0, 50],
|
||||
[30, 20, 10, 0, 50],
|
||||
[20, 30, 15, 0, 50],
|
||||
[40, 10, 0, 0, 50],
|
||||
[100, 40, 5, 0, 50],
|
||||
],
|
||||
null,
|
||||
'A1',
|
||||
true
|
||||
|
|
|
@ -20,11 +20,11 @@ $helper->log('Update cell data values that are displayed in the chart');
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
[50 - 12, 50 - 15, 50 - 21],
|
||||
[50 - 56, 50 - 73, 50 - 86],
|
||||
[50 - 52, 50 - 61, 50 - 69],
|
||||
[50 - 30, 50 - 32, 50],
|
||||
],
|
||||
[50 - 12, 50 - 15, 50 - 21],
|
||||
[50 - 56, 50 - 73, 50 - 86],
|
||||
[50 - 52, 50 - 61, 50 - 69],
|
||||
[50 - 30, 50 - 32, 50],
|
||||
],
|
||||
null,
|
||||
'B2'
|
||||
);
|
||||
|
|
|
@ -23,7 +23,7 @@ class ChunkReadFilter implements IReadFilter
|
|||
* @param mixed $startRow
|
||||
* @param mixed $chunkSize
|
||||
*/
|
||||
public function setRows($startRow, $chunkSize)
|
||||
public function setRows($startRow, $chunkSize): void
|
||||
{
|
||||
$this->startRow = $startRow;
|
||||
$this->endRow = $startRow + $chunkSize;
|
||||
|
|
|
@ -24,7 +24,7 @@ class ChunkReadFilter implements IReadFilter
|
|||
* @param mixed $startRow
|
||||
* @param mixed $chunkSize
|
||||
*/
|
||||
public function setRows($startRow, $chunkSize)
|
||||
public function setRows($startRow, $chunkSize): void
|
||||
{
|
||||
$this->startRow = $startRow;
|
||||
$this->endRow = $startRow + $chunkSize;
|
||||
|
|
|
@ -12,12 +12,12 @@ $spreadsheet = new Spreadsheet();
|
|||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->fromArray(
|
||||
[
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
['', 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
]
|
||||
);
|
||||
|
||||
// Set the Labels for each data series we want to plot
|
||||
|
|
|
@ -184,59 +184,59 @@ $spreadsheet->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->s
|
|||
$helper->log('Set style for header row using alternative method');
|
||||
$spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
|
||||
[
|
||||
'font' => [
|
||||
'bold' => true,
|
||||
'font' => [
|
||||
'bold' => true,
|
||||
],
|
||||
'alignment' => [
|
||||
'horizontal' => Alignment::HORIZONTAL_RIGHT,
|
||||
],
|
||||
'borders' => [
|
||||
'top' => [
|
||||
'borderStyle' => Border::BORDER_THIN,
|
||||
],
|
||||
'alignment' => [
|
||||
'horizontal' => Alignment::HORIZONTAL_RIGHT,
|
||||
],
|
||||
'fill' => [
|
||||
'fillType' => Fill::FILL_GRADIENT_LINEAR,
|
||||
'rotation' => 90,
|
||||
'startColor' => [
|
||||
'argb' => 'FFA0A0A0',
|
||||
],
|
||||
'borders' => [
|
||||
'top' => [
|
||||
'borderStyle' => Border::BORDER_THIN,
|
||||
],
|
||||
'endColor' => [
|
||||
'argb' => 'FFFFFFFF',
|
||||
],
|
||||
'fill' => [
|
||||
'fillType' => Fill::FILL_GRADIENT_LINEAR,
|
||||
'rotation' => 90,
|
||||
'startColor' => [
|
||||
'argb' => 'FFA0A0A0',
|
||||
],
|
||||
'endColor' => [
|
||||
'argb' => 'FFFFFFFF',
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray(
|
||||
[
|
||||
'alignment' => [
|
||||
'horizontal' => Alignment::HORIZONTAL_LEFT,
|
||||
'alignment' => [
|
||||
'horizontal' => Alignment::HORIZONTAL_LEFT,
|
||||
],
|
||||
'borders' => [
|
||||
'left' => [
|
||||
'borderStyle' => Border::BORDER_THIN,
|
||||
],
|
||||
'borders' => [
|
||||
'left' => [
|
||||
'borderStyle' => Border::BORDER_THIN,
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle('B3')->applyFromArray(
|
||||
[
|
||||
'alignment' => [
|
||||
'horizontal' => Alignment::HORIZONTAL_LEFT,
|
||||
],
|
||||
]
|
||||
'alignment' => [
|
||||
'horizontal' => Alignment::HORIZONTAL_LEFT,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle('E3')->applyFromArray(
|
||||
[
|
||||
'borders' => [
|
||||
'right' => [
|
||||
'borderStyle' => Border::BORDER_THIN,
|
||||
],
|
||||
'borders' => [
|
||||
'right' => [
|
||||
'borderStyle' => Border::BORDER_THIN,
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Unprotect a cell
|
||||
|
|
|
@ -11,6 +11,7 @@ use PhpOffice\PhpSpreadsheet\NamedRange;
|
|||
use PhpOffice\PhpSpreadsheet\Shared;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use ReflectionMethod;
|
||||
|
||||
class Calculation
|
||||
{
|
||||
|
@ -2263,16 +2264,16 @@ class Calculation
|
|||
],
|
||||
];
|
||||
|
||||
public function __construct(Spreadsheet $spreadsheet = null)
|
||||
public function __construct(?Spreadsheet $spreadsheet = null)
|
||||
{
|
||||
$this->delta = 1 * pow(10, 0 - ini_get('precision'));
|
||||
$this->delta = 1 * 10 ** (0 - ini_get('precision'));
|
||||
|
||||
$this->spreadsheet = $spreadsheet;
|
||||
$this->cyclicReferenceStack = new CyclicReferenceStack();
|
||||
$this->debugLog = new Logger($this->cyclicReferenceStack);
|
||||
}
|
||||
|
||||
private static function loadLocales()
|
||||
private static function loadLocales(): void
|
||||
{
|
||||
$localeFileDirectory = __DIR__ . '/locale/';
|
||||
foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) {
|
||||
|
@ -2291,7 +2292,7 @@ class Calculation
|
|||
*
|
||||
* @return Calculation
|
||||
*/
|
||||
public static function getInstance(Spreadsheet $spreadsheet = null)
|
||||
public static function getInstance(?Spreadsheet $spreadsheet = null)
|
||||
{
|
||||
if ($spreadsheet !== null) {
|
||||
$instance = $spreadsheet->getCalculationEngine();
|
||||
|
@ -2311,7 +2312,7 @@ class Calculation
|
|||
* Flush the calculation cache for any existing instance of this class
|
||||
* but only if a Calculation instance exists.
|
||||
*/
|
||||
public function flushInstance()
|
||||
public function flushInstance(): void
|
||||
{
|
||||
$this->clearCalculationCache();
|
||||
$this->clearBranchStore();
|
||||
|
@ -2400,7 +2401,7 @@ class Calculation
|
|||
*
|
||||
* @param bool $pValue
|
||||
*/
|
||||
public function setCalculationCacheEnabled($pValue)
|
||||
public function setCalculationCacheEnabled($pValue): void
|
||||
{
|
||||
$this->calculationCacheEnabled = $pValue;
|
||||
$this->clearCalculationCache();
|
||||
|
@ -2409,7 +2410,7 @@ class Calculation
|
|||
/**
|
||||
* Enable calculation cache.
|
||||
*/
|
||||
public function enableCalculationCache()
|
||||
public function enableCalculationCache(): void
|
||||
{
|
||||
$this->setCalculationCacheEnabled(true);
|
||||
}
|
||||
|
@ -2417,7 +2418,7 @@ class Calculation
|
|||
/**
|
||||
* Disable calculation cache.
|
||||
*/
|
||||
public function disableCalculationCache()
|
||||
public function disableCalculationCache(): void
|
||||
{
|
||||
$this->setCalculationCacheEnabled(false);
|
||||
}
|
||||
|
@ -2425,7 +2426,7 @@ class Calculation
|
|||
/**
|
||||
* Clear calculation cache.
|
||||
*/
|
||||
public function clearCalculationCache()
|
||||
public function clearCalculationCache(): void
|
||||
{
|
||||
$this->calculationCache = [];
|
||||
}
|
||||
|
@ -2435,7 +2436,7 @@ class Calculation
|
|||
*
|
||||
* @param string $worksheetName
|
||||
*/
|
||||
public function clearCalculationCacheForWorksheet($worksheetName)
|
||||
public function clearCalculationCacheForWorksheet($worksheetName): void
|
||||
{
|
||||
if (isset($this->calculationCache[$worksheetName])) {
|
||||
unset($this->calculationCache[$worksheetName]);
|
||||
|
@ -2448,7 +2449,7 @@ class Calculation
|
|||
* @param string $fromWorksheetName
|
||||
* @param string $toWorksheetName
|
||||
*/
|
||||
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
|
||||
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName): void
|
||||
{
|
||||
if (isset($this->calculationCache[$fromWorksheetName])) {
|
||||
$this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
|
||||
|
@ -2459,25 +2460,24 @@ class Calculation
|
|||
/**
|
||||
* Enable/disable calculation cache.
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @param mixed $enabled
|
||||
*/
|
||||
public function setBranchPruningEnabled($enabled)
|
||||
public function setBranchPruningEnabled($enabled): void
|
||||
{
|
||||
$this->branchPruningEnabled = $enabled;
|
||||
}
|
||||
|
||||
public function enableBranchPruning()
|
||||
public function enableBranchPruning(): void
|
||||
{
|
||||
$this->setBranchPruningEnabled(true);
|
||||
}
|
||||
|
||||
public function disableBranchPruning()
|
||||
public function disableBranchPruning(): void
|
||||
{
|
||||
$this->setBranchPruningEnabled(false);
|
||||
}
|
||||
|
||||
public function clearBranchStore()
|
||||
public function clearBranchStore(): void
|
||||
{
|
||||
$this->branchStoreKeyCounter = 0;
|
||||
}
|
||||
|
@ -2779,7 +2779,7 @@ class Calculation
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculate(Cell $pCell = null)
|
||||
public function calculate(?Cell $pCell = null)
|
||||
{
|
||||
try {
|
||||
return $this->calculateCellValue($pCell);
|
||||
|
@ -2796,7 +2796,7 @@ class Calculation
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculateCellValue(Cell $pCell = null, $resetLog = true)
|
||||
public function calculateCellValue(?Cell $pCell = null, $resetLog = true)
|
||||
{
|
||||
if ($pCell === null) {
|
||||
return null;
|
||||
|
@ -2898,7 +2898,7 @@ class Calculation
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculateFormula($formula, $cellID = null, Cell $pCell = null)
|
||||
public function calculateFormula($formula, $cellID = null, ?Cell $pCell = null)
|
||||
{
|
||||
// Initialise the logging settings
|
||||
$this->formulaError = null;
|
||||
|
@ -2957,7 +2957,7 @@ class Calculation
|
|||
* @param string $cellReference
|
||||
* @param mixed $cellValue
|
||||
*/
|
||||
public function saveValueToCache($cellReference, $cellValue)
|
||||
public function saveValueToCache($cellReference, $cellValue): void
|
||||
{
|
||||
if ($this->calculationCacheEnabled) {
|
||||
$this->calculationCache[$cellReference] = $cellValue;
|
||||
|
@ -2973,7 +2973,7 @@ class Calculation
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null)
|
||||
public function _calculateFormulaValue($formula, $cellID = null, ?Cell $pCell = null)
|
||||
{
|
||||
$cellValue = null;
|
||||
|
||||
|
@ -3119,7 +3119,7 @@ class Calculation
|
|||
* @param int $matrix2Rows Row size of second matrix operand
|
||||
* @param int $matrix2Columns Column size of second matrix operand
|
||||
*/
|
||||
private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
|
||||
private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns): void
|
||||
{
|
||||
if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
|
||||
if ($matrix2Rows < $matrix1Rows) {
|
||||
|
@ -3162,7 +3162,7 @@ class Calculation
|
|||
* @param int $matrix2Rows Row size of second matrix operand
|
||||
* @param int $matrix2Columns Column size of second matrix operand
|
||||
*/
|
||||
private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
|
||||
private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns): void
|
||||
{
|
||||
if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
|
||||
if ($matrix2Columns < $matrix1Columns) {
|
||||
|
@ -3371,11 +3371,10 @@ class Calculation
|
|||
|
||||
/**
|
||||
* @param string $formula
|
||||
* @param null|\PhpOffice\PhpSpreadsheet\Cell\Cell $pCell
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function _parseFormula($formula, Cell $pCell = null)
|
||||
private function _parseFormula($formula, ?Cell $pCell = null)
|
||||
{
|
||||
if (($formula = $this->convertMatrixReferences(trim($formula))) === false) {
|
||||
return false;
|
||||
|
@ -3469,7 +3468,7 @@ class Calculation
|
|||
++$index; // Drop the redundant plus symbol
|
||||
} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal
|
||||
return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
|
||||
} elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
|
||||
} elseif ((isset(self::$operators[$opCharacter]) || $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
|
||||
while ($stack->count() > 0 &&
|
||||
($o2 = $stack->last()) &&
|
||||
isset(self::$operators[$o2['value']]) &&
|
||||
|
@ -3495,7 +3494,7 @@ class Calculation
|
|||
// Branch pruning we decrease the depth whether is it a function
|
||||
// call or a parenthesis
|
||||
if (!empty($pendingStoreKey)) {
|
||||
$parenthesisDepthMap[$pendingStoreKey] -= 1;
|
||||
--$parenthesisDepthMap[$pendingStoreKey];
|
||||
}
|
||||
|
||||
if (is_array($d) && preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function?
|
||||
|
@ -3509,7 +3508,7 @@ class Calculation
|
|||
}
|
||||
$expectingThenMap[$pendingStoreKey] = false;
|
||||
$expectingElseMap[$pendingStoreKey] = false;
|
||||
$parenthesisDepthMap[$pendingStoreKey] -= 1;
|
||||
--$parenthesisDepthMap[$pendingStoreKey];
|
||||
array_pop($pendingStoreKeysStack);
|
||||
unset($pendingStoreKey);
|
||||
}
|
||||
|
@ -3615,7 +3614,7 @@ class Calculation
|
|||
++$index;
|
||||
} elseif ($opCharacter == '(' && !$expectingOperator) {
|
||||
if (!empty($pendingStoreKey)) { // Branch pruning: we go deeper
|
||||
$parenthesisDepthMap[$pendingStoreKey] += 1;
|
||||
++$parenthesisDepthMap[$pendingStoreKey];
|
||||
}
|
||||
$stack->push('Brace', '(', null, $currentCondition, $currentOnlyIf, $currentOnlyIf);
|
||||
++$index;
|
||||
|
@ -3641,7 +3640,7 @@ class Calculation
|
|||
$parenthesisDepthMap[$pendingStoreKey] = 0;
|
||||
} else { // this is not an if but we go deeper
|
||||
if (!empty($pendingStoreKey) && array_key_exists($pendingStoreKey, $parenthesisDepthMap)) {
|
||||
$parenthesisDepthMap[$pendingStoreKey] += 1;
|
||||
++$parenthesisDepthMap[$pendingStoreKey];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3818,11 +3817,10 @@ class Calculation
|
|||
/**
|
||||
* @param mixed $tokens
|
||||
* @param null|string $cellID
|
||||
* @param null|Cell $pCell
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
|
||||
private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null)
|
||||
{
|
||||
if ($tokens == false) {
|
||||
return false;
|
||||
|
@ -4361,7 +4359,6 @@ class Calculation
|
|||
* @param mixed $operand1
|
||||
* @param mixed $operand2
|
||||
* @param string $operation
|
||||
* @param Stack $stack
|
||||
* @param bool $recursingArrays
|
||||
*
|
||||
* @return mixed
|
||||
|
@ -4583,7 +4580,7 @@ class Calculation
|
|||
break;
|
||||
// Power
|
||||
case '^':
|
||||
$result = pow($operand1, $operand2);
|
||||
$result = $operand1 ** $operand2;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -4620,7 +4617,7 @@ class Calculation
|
|||
*
|
||||
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
|
||||
*/
|
||||
public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true)
|
||||
public function extractCellRange(&$pRange = 'A1', ?Worksheet $pSheet = null, $resetLog = true)
|
||||
{
|
||||
// Return value
|
||||
$returnValue = [];
|
||||
|
@ -4673,7 +4670,7 @@ class Calculation
|
|||
*
|
||||
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
|
||||
*/
|
||||
public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true)
|
||||
public function extractNamedRange(&$pRange = 'A1', ?Worksheet $pSheet = null, $resetLog = true)
|
||||
{
|
||||
// Return value
|
||||
$returnValue = [];
|
||||
|
@ -4773,21 +4770,19 @@ class Calculation
|
|||
/**
|
||||
* Add cell reference if needed while making sure that it is the last argument.
|
||||
*
|
||||
* @param array $args
|
||||
* @param bool $passCellReference
|
||||
* @param array|string $functionCall
|
||||
* @param null|Cell $pCell
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function addCellReference(array $args, $passCellReference, $functionCall, Cell $pCell = null)
|
||||
private function addCellReference(array $args, $passCellReference, $functionCall, ?Cell $pCell = null)
|
||||
{
|
||||
if ($passCellReference) {
|
||||
if (is_array($functionCall)) {
|
||||
$className = $functionCall[0];
|
||||
$methodName = $functionCall[1];
|
||||
|
||||
$reflectionMethod = new \ReflectionMethod($className, $methodName);
|
||||
$reflectionMethod = new ReflectionMethod($className, $methodName);
|
||||
$argumentCount = count($reflectionMethod->getParameters());
|
||||
while (count($args) < $argumentCount - 1) {
|
||||
$args[] = null;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||
|
||||
|
@ -66,7 +68,7 @@ class DateTime
|
|||
public static function getDateValue($dateValue)
|
||||
{
|
||||
if (!is_numeric($dateValue)) {
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof \DateTimeInterface)) {
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof DateTimeInterface)) {
|
||||
$dateValue = Date::PHPToExcel($dateValue);
|
||||
} else {
|
||||
$saveReturnDateType = Functions::getReturnDateType();
|
||||
|
@ -768,9 +770,9 @@ class DateTime
|
|||
*
|
||||
* @category Date/Time Functions
|
||||
*
|
||||
* @param \DateTimeImmutable|float|int|string $endDate Excel date serial value (float),
|
||||
* @param DateTimeImmutable|float|int|string $endDate Excel date serial value (float),
|
||||
* PHP date timestamp (integer), PHP DateTime object, or a standard date string
|
||||
* @param \DateTimeImmutable|float|int|string $startDate Excel date serial value (float),
|
||||
* @param DateTimeImmutable|float|int|string $startDate Excel date serial value (float),
|
||||
* PHP date timestamp (integer), PHP DateTime object, or a standard date string
|
||||
*
|
||||
* @return int|string Number of days between start date and end date or an error
|
||||
|
@ -1301,7 +1303,7 @@ class DateTime
|
|||
self::DOW_SATURDAY,
|
||||
self::DOW_SUNDAY,
|
||||
self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO,
|
||||
];
|
||||
];
|
||||
|
||||
/**
|
||||
* WEEKNUM.
|
||||
|
|
|
@ -26,7 +26,7 @@ class CyclicReferenceStack
|
|||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function push($value)
|
||||
public function push($value): void
|
||||
{
|
||||
$this->stack[$value] = $value;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class CyclicReferenceStack
|
|||
/**
|
||||
* Clear the stack.
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): void
|
||||
{
|
||||
$this->stack = [];
|
||||
}
|
||||
|
|
|
@ -39,8 +39,6 @@ class Logger
|
|||
|
||||
/**
|
||||
* Instantiate a Calculation engine logger.
|
||||
*
|
||||
* @param CyclicReferenceStack $stack
|
||||
*/
|
||||
public function __construct(CyclicReferenceStack $stack)
|
||||
{
|
||||
|
@ -52,7 +50,7 @@ class Logger
|
|||
*
|
||||
* @param bool $pValue
|
||||
*/
|
||||
public function setWriteDebugLog($pValue)
|
||||
public function setWriteDebugLog($pValue): void
|
||||
{
|
||||
$this->writeDebugLog = $pValue;
|
||||
}
|
||||
|
@ -72,7 +70,7 @@ class Logger
|
|||
*
|
||||
* @param bool $pValue
|
||||
*/
|
||||
public function setEchoDebugLog($pValue)
|
||||
public function setEchoDebugLog($pValue): void
|
||||
{
|
||||
$this->echoDebugLog = $pValue;
|
||||
}
|
||||
|
@ -90,11 +88,11 @@ class Logger
|
|||
/**
|
||||
* Write an entry to the calculation engine debug log.
|
||||
*/
|
||||
public function writeDebugLog(...$args)
|
||||
public function writeDebugLog(...$args): void
|
||||
{
|
||||
// Only write the debug log if logging is enabled
|
||||
if ($this->writeDebugLog) {
|
||||
$message = implode($args);
|
||||
$message = implode('', $args);
|
||||
$cellReference = implode(' -> ', $this->cellStack->showStack());
|
||||
if ($this->echoDebugLog) {
|
||||
echo $cellReference,
|
||||
|
@ -111,7 +109,7 @@ class Logger
|
|||
/**
|
||||
* Clear the calculation engine debug log.
|
||||
*/
|
||||
public function clearLog()
|
||||
public function clearLog(): void
|
||||
{
|
||||
$this->debugLog = [];
|
||||
}
|
||||
|
|
|
@ -799,7 +799,7 @@ class Engineering
|
|||
}
|
||||
|
||||
if (abs($x) <= 30) {
|
||||
$fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord);
|
||||
$fResult = $fTerm = ($x / 2) ** $ord / MathTrig::FACT($ord);
|
||||
$ordK = 1;
|
||||
$fSqrX = ($x * $x) / 4;
|
||||
do {
|
||||
|
@ -854,7 +854,7 @@ class Engineering
|
|||
|
||||
$fResult = 0;
|
||||
if (abs($x) <= 30) {
|
||||
$fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord);
|
||||
$fResult = $fTerm = ($x / 2) ** $ord / MathTrig::FACT($ord);
|
||||
$ordK = 1;
|
||||
$fSqrX = ($x * $x) / -4;
|
||||
do {
|
||||
|
@ -2357,7 +2357,7 @@ class Engineering
|
|||
} elseif (is_numeric($value)) {
|
||||
if ($value == (int) ($value)) {
|
||||
$value = (int) ($value);
|
||||
if (($value > pow(2, 48) - 1) || ($value < 0)) {
|
||||
if (($value > 2 ** 48 - 1) || ($value < 0)) {
|
||||
throw new Exception(Functions::NAN());
|
||||
}
|
||||
|
||||
|
@ -2477,7 +2477,7 @@ class Engineering
|
|||
$shiftAmount = Functions::flattenSingleValue($shiftAmount);
|
||||
|
||||
$result = $number << $shiftAmount;
|
||||
if ($result > pow(2, 48) - 1) {
|
||||
if ($result > 2 ** 48 - 1) {
|
||||
return Functions::NAN();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class Exception extends PhpSpreadsheetException
|
|||
* @param mixed $line
|
||||
* @param mixed $context
|
||||
*/
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context)
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context): void
|
||||
{
|
||||
$e = new self($string, $code);
|
||||
$e->line = $line;
|
||||
|
|
|
@ -851,7 +851,7 @@ class Financial
|
|||
return Functions::NAN();
|
||||
}
|
||||
// Set Fixed Depreciation Rate
|
||||
$fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
|
||||
$fixedDepreciationRate = 1 - ($salvage / $cost) ** (1 / $life);
|
||||
$fixedDepreciationRate = round($fixedDepreciationRate, 3);
|
||||
|
||||
// Loop through each period calculating the depreciation
|
||||
|
@ -917,7 +917,7 @@ class Financial
|
|||
return Functions::NAN();
|
||||
}
|
||||
// Set Fixed Depreciation Rate
|
||||
$fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
|
||||
$fixedDepreciationRate = 1 - ($salvage / $cost) ** (1 / $life);
|
||||
$fixedDepreciationRate = round($fixedDepreciationRate, 3);
|
||||
|
||||
// Loop through each period calculating the depreciation
|
||||
|
@ -1021,7 +1021,7 @@ class Financial
|
|||
$dollars = floor($fractional_dollar);
|
||||
$cents = fmod($fractional_dollar, 1);
|
||||
$cents /= $fraction;
|
||||
$cents *= pow(10, ceil(log10($fraction)));
|
||||
$cents *= 10 ** ceil(log10($fraction));
|
||||
|
||||
return $dollars + $cents;
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ class Financial
|
|||
$dollars = floor($decimal_dollar);
|
||||
$cents = fmod($decimal_dollar, 1);
|
||||
$cents *= $fraction;
|
||||
$cents *= pow(10, -ceil(log10($fraction)));
|
||||
$cents *= 10 ** (-ceil(log10($fraction)));
|
||||
|
||||
return $dollars + $cents;
|
||||
}
|
||||
|
@ -1090,7 +1090,7 @@ class Financial
|
|||
return Functions::NAN();
|
||||
}
|
||||
|
||||
return pow((1 + $nominal_rate / $npery), $npery) - 1;
|
||||
return (1 + $nominal_rate / $npery) ** $npery - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1131,7 +1131,7 @@ class Financial
|
|||
|
||||
// Calculate
|
||||
if ($rate !== null && $rate != 0) {
|
||||
return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate;
|
||||
return -$pv * (1 + $rate) ** $nper - $pmt * (1 + $rate * $type) * ((1 + $rate) ** $nper - 1) / $rate;
|
||||
}
|
||||
|
||||
return -$pv - $pmt * $nper;
|
||||
|
@ -1400,9 +1400,9 @@ class Financial
|
|||
$npv_pos = $npv_neg = 0.0;
|
||||
foreach ($values as $i => $v) {
|
||||
if ($v >= 0) {
|
||||
$npv_pos += $v / pow($rr, $i);
|
||||
$npv_pos += $v / $rr ** $i;
|
||||
} else {
|
||||
$npv_neg += $v / pow($fr, $i);
|
||||
$npv_neg += $v / $fr ** $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1410,8 +1410,8 @@ class Financial
|
|||
return Functions::VALUE();
|
||||
}
|
||||
|
||||
$mirr = pow((-$npv_pos * pow($rr, $n))
|
||||
/ ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0;
|
||||
$mirr = ((-$npv_pos * $rr ** $n)
|
||||
/ ($npv_neg * ($rr))) ** (1.0 / ($n - 1)) - 1.0;
|
||||
|
||||
return is_finite($mirr) ? $mirr : Functions::VALUE();
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ class Financial
|
|||
}
|
||||
|
||||
// Calculate
|
||||
return $npery * (pow($effect_rate + 1, 1 / $npery) - 1);
|
||||
return $npery * (($effect_rate + 1) ** (1 / $npery) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1502,7 +1502,7 @@ class Financial
|
|||
for ($i = 1; $i <= $countArgs; ++$i) {
|
||||
// Is it a numeric value?
|
||||
if (is_numeric($aArgs[$i - 1])) {
|
||||
$returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i);
|
||||
$returnValue += $aArgs[$i - 1] / (1 + $rate) ** $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1565,7 +1565,7 @@ class Financial
|
|||
|
||||
// Calculate
|
||||
if ($rate !== null && $rate != 0) {
|
||||
return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate);
|
||||
return (-$fv - $pv * (1 + $rate) ** $nper) / (1 + $rate * $type) / (((1 + $rate) ** $nper - 1) / $rate);
|
||||
}
|
||||
|
||||
return (-$pv - $fv) / $nper;
|
||||
|
@ -1672,9 +1672,9 @@ class Financial
|
|||
$rfp = 100 * ($rate / $frequency);
|
||||
$de = $dsc / $e;
|
||||
|
||||
$result = $redemption / pow($baseYF, (--$n + $de));
|
||||
$result = $redemption / $baseYF ** (--$n + $de);
|
||||
for ($k = 0; $k <= $n; ++$k) {
|
||||
$result += $rfp / (pow($baseYF, ($k + $de)));
|
||||
$result += $rfp / ($baseYF ** ($k + $de));
|
||||
}
|
||||
$result -= $rfp * ($a / $e);
|
||||
|
||||
|
@ -1820,7 +1820,7 @@ class Financial
|
|||
|
||||
// Calculate
|
||||
if ($rate !== null && $rate != 0) {
|
||||
return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper);
|
||||
return (-$pmt * (1 + $rate * $type) * (((1 + $rate) ** $nper - 1) / $rate) - $fv) / (1 + $rate) ** $nper;
|
||||
}
|
||||
|
||||
return -$fv - $pmt * $nper;
|
||||
|
@ -1889,8 +1889,8 @@ class Financial
|
|||
if ($rate == 0) {
|
||||
return Functions::NAN();
|
||||
}
|
||||
$tt1 = pow($rate + 1, $nper);
|
||||
$tt2 = pow($rate + 1, $nper - 1);
|
||||
$tt1 = ($rate + 1) ** $nper;
|
||||
$tt2 = ($rate + 1) ** ($nper - 1);
|
||||
$numerator = $fv + $tt1 * $pv + $pmt * ($tt1 - 1) * ($rate * $type + 1) / $rate;
|
||||
$denominator = $nper * $tt2 * $pv - $pmt * ($tt1 - 1) * ($rate * $type + 1) / ($rate * $rate)
|
||||
+ $nper * $pmt * $tt2 * ($rate * $type + 1) / $rate
|
||||
|
@ -1971,7 +1971,7 @@ class Financial
|
|||
return Functions::NAN();
|
||||
}
|
||||
|
||||
return pow($fv / $pv, 1 / $nper) - 1;
|
||||
return ($fv / $pv) ** (1 / $nper) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2377,7 +2377,7 @@ class Financial
|
|||
if (!is_numeric($dif)) {
|
||||
return $dif;
|
||||
}
|
||||
$xnpv += $values[$i] / pow(1 + $rate, $dif / 365);
|
||||
$xnpv += $values[$i] / (1 + $rate) ** ($dif / 365);
|
||||
}
|
||||
|
||||
return is_finite($xnpv) ? $xnpv : Functions::VALUE();
|
||||
|
|
|
@ -125,7 +125,7 @@ class FormulaParser
|
|||
/**
|
||||
* Parse to tokens.
|
||||
*/
|
||||
private function parseToTokens()
|
||||
private function parseToTokens(): void
|
||||
{
|
||||
// No attempt is made to verify formulas; assumes formulas are derived from Excel, where
|
||||
// they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions.
|
||||
|
|
|
@ -103,7 +103,7 @@ class FormulaToken
|
|||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setValue($value)
|
||||
public function setValue($value): void
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class FormulaToken
|
|||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTokenType($value)
|
||||
public function setTokenType($value): void
|
||||
{
|
||||
$this->tokenType = $value;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class FormulaToken
|
|||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTokenSubType($value)
|
||||
public function setTokenSubType($value): void
|
||||
{
|
||||
$this->tokenSubType = $value;
|
||||
}
|
||||
|
|
|
@ -660,7 +660,7 @@ class Functions
|
|||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function isFormula($cellReference = '', Cell $pCell = null)
|
||||
public static function isFormula($cellReference = '', ?Cell $pCell = null)
|
||||
{
|
||||
if ($pCell === null) {
|
||||
return self::REF();
|
||||
|
|
|
@ -238,7 +238,7 @@ class LookupRef
|
|||
*
|
||||
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
|
||||
*/
|
||||
public static function HYPERLINK($linkURL = '', $displayName = null, Cell $pCell = null)
|
||||
public static function HYPERLINK($linkURL = '', $displayName = null, ?Cell $pCell = null)
|
||||
{
|
||||
$linkURL = ($linkURL === null) ? '' : Functions::flattenSingleValue($linkURL);
|
||||
$displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName);
|
||||
|
@ -275,7 +275,7 @@ class LookupRef
|
|||
*
|
||||
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
||||
*/
|
||||
public static function INDIRECT($cellAddress = null, Cell $pCell = null)
|
||||
public static function INDIRECT($cellAddress = null, ?Cell $pCell = null)
|
||||
{
|
||||
$cellAddress = Functions::flattenSingleValue($cellAddress);
|
||||
if ($cellAddress === null || $cellAddress === '') {
|
||||
|
@ -339,11 +339,10 @@ class LookupRef
|
|||
* starting reference).
|
||||
* @param mixed $height The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
|
||||
* @param mixed $width The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
|
||||
* @param null|Cell $pCell
|
||||
*
|
||||
* @return string A reference to a cell or range of cells
|
||||
*/
|
||||
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, Cell $pCell = null)
|
||||
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, ?Cell $pCell = null)
|
||||
{
|
||||
$rows = Functions::flattenSingleValue($rows);
|
||||
$columns = Functions::flattenSingleValue($columns);
|
||||
|
@ -419,14 +418,6 @@ class LookupRef
|
|||
* Excel Function:
|
||||
* =CHOOSE(index_num, value1, [value2], ...)
|
||||
*
|
||||
* @param mixed $index_num Specifies which value argument is selected.
|
||||
* Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number
|
||||
* between 1 and 254.
|
||||
* @param mixed $value1 ... Value1 is required, subsequent values are optional.
|
||||
* Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on
|
||||
* index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or
|
||||
* text.
|
||||
*
|
||||
* @return mixed The selected value
|
||||
*/
|
||||
public static function CHOOSE(...$chooseArgs)
|
||||
|
@ -945,7 +936,7 @@ class LookupRef
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function FORMULATEXT($cellReference = '', Cell $pCell = null)
|
||||
public static function FORMULATEXT($cellReference = '', ?Cell $pCell = null)
|
||||
{
|
||||
if ($pCell === null) {
|
||||
return Functions::REF();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
use Exception;
|
||||
use Matrix\Exception as MatrixException;
|
||||
use Matrix\Matrix;
|
||||
|
||||
|
@ -68,7 +69,7 @@ class MathTrig
|
|||
|
||||
try {
|
||||
$arabic = self::calculateArabic(str_split($roman));
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return Functions::VALUE(); // Invalid character detected
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,6 @@ class MathTrig
|
|||
/**
|
||||
* Recursively calculate the arabic value of a roman numeral.
|
||||
*
|
||||
* @param array $roman
|
||||
* @param int $sum
|
||||
* @param int $subtract
|
||||
*
|
||||
|
@ -102,7 +102,7 @@ class MathTrig
|
|||
|
||||
$numeral = array_shift($roman);
|
||||
if (!isset($lookup[$numeral])) {
|
||||
throw new \Exception('Invalid character detected');
|
||||
throw new Exception('Invalid character detected');
|
||||
}
|
||||
|
||||
$arabic = $lookup[$numeral];
|
||||
|
@ -618,7 +618,7 @@ class MathTrig
|
|||
$myCountedFactors = array_count_values($myFactors);
|
||||
$myPoweredFactors = [];
|
||||
foreach ($myCountedFactors as $myCountedFactor => $myCountedPower) {
|
||||
$myPoweredFactors[$myCountedFactor] = pow($myCountedFactor, $myCountedPower);
|
||||
$myPoweredFactors[$myCountedFactor] = $myCountedFactor ** $myCountedPower;
|
||||
}
|
||||
foreach ($myPoweredFactors as $myPoweredValue => $myPoweredFactor) {
|
||||
if (isset($allPoweredFactors[$myPoweredValue])) {
|
||||
|
@ -986,7 +986,7 @@ class MathTrig
|
|||
}
|
||||
|
||||
// Return
|
||||
$result = pow($x, $y);
|
||||
$result = $x ** $y;
|
||||
|
||||
return (!is_nan($result) && !is_infinite($result)) ? $result : Functions::NAN();
|
||||
}
|
||||
|
@ -1139,10 +1139,10 @@ class MathTrig
|
|||
|
||||
if ((is_numeric($number)) && (is_numeric($digits))) {
|
||||
if ($number < 0.0) {
|
||||
return round($number - 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_DOWN);
|
||||
return round($number - 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_DOWN);
|
||||
}
|
||||
|
||||
return round($number + 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_DOWN);
|
||||
return round($number + 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_DOWN);
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
|
@ -1165,10 +1165,10 @@ class MathTrig
|
|||
|
||||
if ((is_numeric($number)) && (is_numeric($digits))) {
|
||||
if ($number < 0.0) {
|
||||
return round($number + 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_UP);
|
||||
return round($number + 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
return round($number - 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_UP);
|
||||
return round($number - 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
|
@ -1179,9 +1179,6 @@ class MathTrig
|
|||
*
|
||||
* Returns the sum of a power series
|
||||
*
|
||||
* @param float $x Input value to the power series
|
||||
* @param float $n Initial power to which you want to raise $x
|
||||
* @param float $m Step by which to increase $n for each term in the series
|
||||
* @param array of mixed Data Series
|
||||
*
|
||||
* @return float|string The result, or a string containing an error
|
||||
|
@ -1203,7 +1200,7 @@ class MathTrig
|
|||
foreach ($aArgs as $arg) {
|
||||
// Is it a numeric value?
|
||||
if ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$returnValue += $arg * pow($x, $n + ($m * $i++));
|
||||
$returnValue += $arg * $x ** ($n + ($m * $i++));
|
||||
} else {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
@ -1445,7 +1442,6 @@ class MathTrig
|
|||
* @category Mathematical and Trigonometric Functions
|
||||
*
|
||||
* @param mixed $args Data values
|
||||
* @param string $condition the criteria that defines which cells will be summed
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
@ -1663,7 +1659,7 @@ class MathTrig
|
|||
$digits = floor($digits);
|
||||
|
||||
// Truncate
|
||||
$adjust = pow(10, $digits);
|
||||
$adjust = 10 ** $digits;
|
||||
|
||||
if (($digits > 0) && (rtrim((int) ((abs($value) - abs((int) $value)) * $adjust), '0') < $adjust / 10)) {
|
||||
return $value;
|
||||
|
|
|
@ -397,10 +397,10 @@ class Statistical
|
|||
for ($i = 1; $i <= $n; ++$i) {
|
||||
$divisor *= ($a + $i);
|
||||
}
|
||||
$summer += (pow($x, $n) / $divisor);
|
||||
$summer += ($x ** $n / $divisor);
|
||||
}
|
||||
|
||||
return pow($x, $a) * exp(0 - $x) * $summer;
|
||||
return $x ** $a * exp(0 - $x) * $summer;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -874,13 +874,13 @@ class Statistical
|
|||
if ($cumulative) {
|
||||
$summer = 0;
|
||||
for ($i = 0; $i <= $value; ++$i) {
|
||||
$summer += MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i);
|
||||
$summer += MathTrig::COMBIN($trials, $i) * $probability ** $i * (1 - $probability) ** ($trials - $i);
|
||||
}
|
||||
|
||||
return $summer;
|
||||
}
|
||||
|
||||
return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value);
|
||||
return MathTrig::COMBIN($trials, $value) * $probability ** $value * (1 - $probability) ** ($trials - $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1320,7 +1320,7 @@ class Statistical
|
|||
$t = sqrt(log(1 / ($alpha * $alpha)));
|
||||
$trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t));
|
||||
} else {
|
||||
$t = sqrt(log(1 / pow(1 - $alpha, 2)));
|
||||
$t = sqrt(log(1 / (1 - $alpha) ** 2));
|
||||
$trialsApprox = $t - (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t);
|
||||
}
|
||||
|
||||
|
@ -1441,9 +1441,9 @@ class Statistical
|
|||
}
|
||||
if ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
if ($returnValue === null) {
|
||||
$returnValue = pow(($arg - $aMean), 2);
|
||||
$returnValue = ($arg - $aMean) ** 2;
|
||||
} else {
|
||||
$returnValue += pow(($arg - $aMean), 2);
|
||||
$returnValue += ($arg - $aMean) ** 2;
|
||||
}
|
||||
++$aCount;
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ class Statistical
|
|||
return self::incompleteGamma($a, $value / $b) / self::gamma($a);
|
||||
}
|
||||
|
||||
return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b));
|
||||
return (1 / ($b ** $a * self::gamma($a))) * $value ** ($a - 1) * exp(0 - ($value / $b));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1721,7 +1721,7 @@ class Statistical
|
|||
if (is_numeric($aMean) && ($aMean > 0)) {
|
||||
$aCount = self::COUNT($aArgs);
|
||||
if (self::MIN($aArgs) > 0) {
|
||||
return pow($aMean, (1 / $aCount));
|
||||
return $aMean ** (1 / $aCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1900,7 +1900,7 @@ class Statistical
|
|||
} else {
|
||||
// Is it a numeric value?
|
||||
if ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$summer += pow((($arg - $mean) / $stdDev), 4);
|
||||
$summer += (($arg - $mean) / $stdDev) ** 4;
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
@ -1908,7 +1908,7 @@ class Statistical
|
|||
|
||||
// Return
|
||||
if ($count > 3) {
|
||||
return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * pow($count - 1, 2) / (($count - 2) * ($count - 3)));
|
||||
return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * ($count - 1) ** 2 / (($count - 2) * ($count - 3)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1927,7 +1927,6 @@ class Statistical
|
|||
* @category Statistical Functions
|
||||
*
|
||||
* @param mixed $args Data values
|
||||
* @param int $entry Position (ordered from the largest) in the array or range of data to return
|
||||
*
|
||||
* @return float|string The result, or a string containing an error
|
||||
*/
|
||||
|
@ -2013,9 +2012,9 @@ class Statistical
|
|||
}
|
||||
|
||||
return [
|
||||
$bestFitLinear->getSlope(),
|
||||
$bestFitLinear->getIntersect(),
|
||||
];
|
||||
$bestFitLinear->getSlope(),
|
||||
$bestFitLinear->getIntersect(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2078,9 +2077,9 @@ class Statistical
|
|||
}
|
||||
|
||||
return [
|
||||
$bestFitExponential->getSlope(),
|
||||
$bestFitExponential->getIntersect(),
|
||||
];
|
||||
$bestFitExponential->getSlope(),
|
||||
$bestFitExponential->getIntersect(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2579,7 +2578,7 @@ class Statistical
|
|||
}
|
||||
}
|
||||
|
||||
return (MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures));
|
||||
return (MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * ($probability ** $successes) * ((1 - $probability) ** $failures);
|
||||
}
|
||||
|
||||
return Functions::VALUE();
|
||||
|
@ -2614,7 +2613,7 @@ class Statistical
|
|||
return 0.5 * (1 + Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2))));
|
||||
}
|
||||
|
||||
return (1 / (self::SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev))));
|
||||
return (1 / (self::SQRT2PI * $stdDev)) * exp(0 - (($value - $mean) ** 2 / (2 * ($stdDev * $stdDev))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2695,7 +2694,6 @@ class Statistical
|
|||
* @category Statistical Functions
|
||||
*
|
||||
* @param mixed $args Data values
|
||||
* @param float $entry Percentile value in the range 0..1, inclusive.
|
||||
*
|
||||
* @return float|string The result, or a string containing an error
|
||||
*/
|
||||
|
@ -2841,13 +2839,13 @@ class Statistical
|
|||
$summer = 0;
|
||||
$floor = floor($value);
|
||||
for ($i = 0; $i <= $floor; ++$i) {
|
||||
$summer += pow($mean, $i) / MathTrig::FACT($i);
|
||||
$summer += $mean ** $i / MathTrig::FACT($i);
|
||||
}
|
||||
|
||||
return exp(0 - $mean) * $summer;
|
||||
}
|
||||
|
||||
return (exp(0 - $mean) * pow($mean, $value)) / MathTrig::FACT($value);
|
||||
return (exp(0 - $mean) * $mean ** $value) / MathTrig::FACT($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2865,7 +2863,6 @@ class Statistical
|
|||
* @category Statistical Functions
|
||||
*
|
||||
* @param mixed $args Data values
|
||||
* @param int $entry Quartile value in the range 1..3, inclusive.
|
||||
*
|
||||
* @return float|string The result, or a string containing an error
|
||||
*/
|
||||
|
@ -2979,7 +2976,7 @@ class Statistical
|
|||
} else {
|
||||
// Is it a numeric value?
|
||||
if ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$summer += pow((($arg - $mean) / $stdDev), 3);
|
||||
$summer += (($arg - $mean) / $stdDev) ** 3;
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
@ -3033,7 +3030,6 @@ class Statistical
|
|||
* @category Statistical Functions
|
||||
*
|
||||
* @param mixed $args Data values
|
||||
* @param int $entry Position (ordered from the smallest) in the array or range of data to return
|
||||
*
|
||||
* @return float|string The result, or a string containing an error
|
||||
*/
|
||||
|
@ -3126,9 +3122,9 @@ class Statistical
|
|||
// Is it a numeric value?
|
||||
if ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
if ($returnValue === null) {
|
||||
$returnValue = pow(($arg - $aMean), 2);
|
||||
$returnValue = ($arg - $aMean) ** 2;
|
||||
} else {
|
||||
$returnValue += pow(($arg - $aMean), 2);
|
||||
$returnValue += ($arg - $aMean) ** 2;
|
||||
}
|
||||
++$aCount;
|
||||
}
|
||||
|
@ -3178,9 +3174,9 @@ class Statistical
|
|||
$arg = 0;
|
||||
}
|
||||
if ($returnValue === null) {
|
||||
$returnValue = pow(($arg - $aMean), 2);
|
||||
$returnValue = ($arg - $aMean) ** 2;
|
||||
} else {
|
||||
$returnValue += pow(($arg - $aMean), 2);
|
||||
$returnValue += ($arg - $aMean) ** 2;
|
||||
}
|
||||
++$aCount;
|
||||
}
|
||||
|
@ -3226,9 +3222,9 @@ class Statistical
|
|||
// Is it a numeric value?
|
||||
if ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
if ($returnValue === null) {
|
||||
$returnValue = pow(($arg - $aMean), 2);
|
||||
$returnValue = ($arg - $aMean) ** 2;
|
||||
} else {
|
||||
$returnValue += pow(($arg - $aMean), 2);
|
||||
$returnValue += ($arg - $aMean) ** 2;
|
||||
}
|
||||
++$aCount;
|
||||
}
|
||||
|
@ -3277,9 +3273,9 @@ class Statistical
|
|||
$arg = 0;
|
||||
}
|
||||
if ($returnValue === null) {
|
||||
$returnValue = pow(($arg - $aMean), 2);
|
||||
$returnValue = ($arg - $aMean) ** 2;
|
||||
} else {
|
||||
$returnValue += pow(($arg - $aMean), 2);
|
||||
$returnValue += ($arg - $aMean) ** 2;
|
||||
}
|
||||
++$aCount;
|
||||
}
|
||||
|
@ -3491,7 +3487,6 @@ class Statistical
|
|||
* @category Statistical Functions
|
||||
*
|
||||
* @param mixed $args Data values
|
||||
* @param float $discard Percentage to discard
|
||||
*
|
||||
* @return float|string
|
||||
*/
|
||||
|
@ -3746,10 +3741,10 @@ class Statistical
|
|||
}
|
||||
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
|
||||
if ($cumulative) {
|
||||
return 1 - exp(0 - pow($value / $beta, $alpha));
|
||||
return 1 - exp(0 - ($value / $beta) ** $alpha);
|
||||
}
|
||||
|
||||
return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha));
|
||||
return ($alpha / $beta ** $alpha) * $value ** ($alpha - 1) * exp(0 - ($value / $beta) ** $alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ class TextData
|
|||
if ($decimals > 0) {
|
||||
$mask .= '.' . str_repeat('0', $decimals);
|
||||
} else {
|
||||
$round = pow(10, abs($decimals));
|
||||
$round = 10 ** abs($decimals);
|
||||
if ($value < 0) {
|
||||
$round = 0 - $round;
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ class TextData
|
|||
$percentageAdjustment = strlen($value) - strlen($percentageString);
|
||||
if ($percentageAdjustment) {
|
||||
$value = (float) $percentageString;
|
||||
$value /= pow(10, $percentageAdjustment * 2);
|
||||
$value /= 10 ** ($percentageAdjustment * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class Stack
|
|||
$storeKey = null,
|
||||
$onlyIf = null,
|
||||
$onlyIfNot = null
|
||||
) {
|
||||
): void {
|
||||
$stackItem = $this->getStackItem($type, $value, $reference, $storeKey, $onlyIf, $onlyIfNot);
|
||||
|
||||
$this->stack[$this->count++] = $stackItem;
|
||||
|
@ -124,7 +124,7 @@ class Stack
|
|||
/**
|
||||
* Clear the stack.
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): void
|
||||
{
|
||||
$this->stack = [];
|
||||
$this->count = 0;
|
||||
|
|
|
@ -76,12 +76,12 @@ class Cell
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function detach()
|
||||
public function detach(): void
|
||||
{
|
||||
$this->parent = null;
|
||||
}
|
||||
|
||||
public function attach(Cells $parent)
|
||||
public function attach(Cells $parent): void
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ class Cell
|
|||
*
|
||||
* @param mixed $pValue
|
||||
* @param string $pDataType
|
||||
* @param Worksheet $pSheet
|
||||
*/
|
||||
public function __construct($pValue, $pDataType, Worksheet $pSheet)
|
||||
{
|
||||
|
@ -386,7 +385,7 @@ class Cell
|
|||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setDataValidation(DataValidation $pDataValidation = null)
|
||||
public function setDataValidation(?DataValidation $pDataValidation = null)
|
||||
{
|
||||
if (!isset($this->parent)) {
|
||||
throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
|
||||
|
@ -444,7 +443,7 @@ class Cell
|
|||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function setHyperlink(Hyperlink $pHyperlink = null)
|
||||
public function setHyperlink(?Hyperlink $pHyperlink = null)
|
||||
{
|
||||
if (!isset($this->parent)) {
|
||||
throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
|
||||
|
@ -532,8 +531,6 @@ class Cell
|
|||
/**
|
||||
* Re-bind parent.
|
||||
*
|
||||
* @param Worksheet $parent
|
||||
*
|
||||
* @return Cell
|
||||
*/
|
||||
public function rebindParent(Worksheet $parent)
|
||||
|
@ -600,10 +597,8 @@ class Cell
|
|||
|
||||
/**
|
||||
* Set value binder to use.
|
||||
*
|
||||
* @param IValueBinder $binder
|
||||
*/
|
||||
public static function setValueBinder(IValueBinder $binder)
|
||||
public static function setValueBinder(IValueBinder $binder): void
|
||||
{
|
||||
self::$valueBinder = $binder;
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ abstract class Coordinate
|
|||
* @param int $currentRow
|
||||
* @param int $endRow
|
||||
*/
|
||||
private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow)
|
||||
private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow): void
|
||||
{
|
||||
if ($startColumnIndex >= $endColumnIndex || $currentRow > $endRow) {
|
||||
throw new Exception('Invalid range: "' . $cellBlock . '"');
|
||||
|
|
|
@ -178,7 +178,7 @@ class Axis extends Properties
|
|||
* @param string $major_unit
|
||||
* @param string $minor_unit
|
||||
*/
|
||||
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
|
||||
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null): void
|
||||
{
|
||||
$this->axisOptions['axis_labels'] = (string) $axis_labels;
|
||||
($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
|
||||
|
@ -210,7 +210,7 @@ class Axis extends Properties
|
|||
*
|
||||
* @param string $orientation
|
||||
*/
|
||||
public function setAxisOrientation($orientation)
|
||||
public function setAxisOrientation($orientation): void
|
||||
{
|
||||
$this->axisOptions['orientation'] = (string) $orientation;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ class Axis extends Properties
|
|||
* @param int $alpha
|
||||
* @param string $type
|
||||
*/
|
||||
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
|
||||
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB): void
|
||||
{
|
||||
$this->fillProperties = $this->setColorProperties($color, $alpha, $type);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class Axis extends Properties
|
|||
* @param int $alpha
|
||||
* @param string $type
|
||||
*/
|
||||
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
|
||||
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB): void
|
||||
{
|
||||
$this->lineProperties = $this->setColorProperties($color, $alpha, $type);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ class Axis extends Properties
|
|||
* @param string $end_arrow_type
|
||||
* @param string $end_arrow_size
|
||||
*/
|
||||
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
|
||||
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null): void
|
||||
{
|
||||
($line_width !== null) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
|
||||
($compound_type !== null) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
|
||||
|
@ -336,7 +336,7 @@ class Axis extends Properties
|
|||
* @param int $sh_angle
|
||||
* @param float $sh_distance
|
||||
*/
|
||||
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
|
||||
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null): void
|
||||
{
|
||||
$this->setShadowPresetsProperties((int) $sh_presets)
|
||||
->setShadowColor(
|
||||
|
@ -367,7 +367,6 @@ class Axis extends Properties
|
|||
/**
|
||||
* Set Shadow Properties from Mapped Values.
|
||||
*
|
||||
* @param array $properties_map
|
||||
* @param mixed &$reference
|
||||
*
|
||||
* @return $this
|
||||
|
@ -479,7 +478,7 @@ class Axis extends Properties
|
|||
* @param int $color_alpha
|
||||
* @param string $color_type
|
||||
*/
|
||||
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
|
||||
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null): void
|
||||
{
|
||||
$this->setGlowSize($size)
|
||||
->setGlowColor(
|
||||
|
@ -538,7 +537,7 @@ class Axis extends Properties
|
|||
*
|
||||
* @param float $size
|
||||
*/
|
||||
public function setSoftEdges($size)
|
||||
public function setSoftEdges($size): void
|
||||
{
|
||||
if ($size !== null) {
|
||||
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
|
||||
|
|
|
@ -144,19 +144,10 @@ class Chart
|
|||
* Create a new Chart.
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param null|Title $title
|
||||
* @param null|Legend $legend
|
||||
* @param null|PlotArea $plotArea
|
||||
* @param mixed $plotVisibleOnly
|
||||
* @param string $displayBlanksAs
|
||||
* @param null|Title $xAxisLabel
|
||||
* @param null|Title $yAxisLabel
|
||||
* @param null|Axis $xAxis
|
||||
* @param null|Axis $yAxis
|
||||
* @param null|GridLines $majorGridlines
|
||||
* @param null|GridLines $minorGridlines
|
||||
*/
|
||||
public function __construct($name, Title $title = null, Legend $legend = null, PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = DataSeries::EMPTY_AS_GAP, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null)
|
||||
public function __construct($name, ?Title $title = null, ?Legend $legend = null, ?PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = DataSeries::EMPTY_AS_GAP, ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
|
@ -199,7 +190,7 @@ class Chart
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setWorksheet(Worksheet $pValue = null)
|
||||
public function setWorksheet(?Worksheet $pValue = null)
|
||||
{
|
||||
$this->worksheet = $pValue;
|
||||
|
||||
|
@ -219,8 +210,6 @@ class Chart
|
|||
/**
|
||||
* Set Title.
|
||||
*
|
||||
* @param Title $title
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(Title $title)
|
||||
|
@ -243,8 +232,6 @@ class Chart
|
|||
/**
|
||||
* Set Legend.
|
||||
*
|
||||
* @param Legend $legend
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLegend(Legend $legend)
|
||||
|
@ -267,8 +254,6 @@ class Chart
|
|||
/**
|
||||
* Set X-Axis Label.
|
||||
*
|
||||
* @param Title $label
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setXAxisLabel(Title $label)
|
||||
|
@ -291,8 +276,6 @@ class Chart
|
|||
/**
|
||||
* Set Y-Axis Label.
|
||||
*
|
||||
* @param Title $label
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setYAxisLabel(Title $label)
|
||||
|
@ -645,7 +628,7 @@ class Chart
|
|||
return $this->bottomRightYOffset;
|
||||
}
|
||||
|
||||
public function refresh()
|
||||
public function refresh(): void
|
||||
{
|
||||
if ($this->worksheet !== null) {
|
||||
$this->plotArea->refresh($this->worksheet);
|
||||
|
|
|
@ -373,7 +373,7 @@ class DataSeries
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function refresh(Worksheet $worksheet)
|
||||
public function refresh(Worksheet $worksheet): void
|
||||
{
|
||||
foreach ($this->plotValues as $plotValues) {
|
||||
if ($plotValues !== null) {
|
||||
|
|
|
@ -352,7 +352,7 @@ class DataSeriesValues
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function refresh(Worksheet $worksheet, $flatten = true)
|
||||
public function refresh(Worksheet $worksheet, $flatten = true): void
|
||||
{
|
||||
if ($this->dataSource !== null) {
|
||||
$calcEngine = Calculation::getInstance($worksheet->getParent());
|
||||
|
|
|
@ -107,7 +107,7 @@ class GridLines extends Properties
|
|||
* @param int $alpha
|
||||
* @param string $type
|
||||
*/
|
||||
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
|
||||
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD): void
|
||||
{
|
||||
$this->activateObject()
|
||||
->lineProperties['color'] = $this->setColorProperties(
|
||||
|
@ -130,7 +130,7 @@ class GridLines extends Properties
|
|||
* @param string $end_arrow_type
|
||||
* @param string $end_arrow_size
|
||||
*/
|
||||
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
|
||||
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null): void
|
||||
{
|
||||
$this->activateObject();
|
||||
($line_width !== null)
|
||||
|
@ -194,7 +194,7 @@ class GridLines extends Properties
|
|||
* @param int $color_alpha
|
||||
* @param string $color_type
|
||||
*/
|
||||
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
|
||||
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null): void
|
||||
{
|
||||
$this
|
||||
->activateObject()
|
||||
|
@ -286,7 +286,7 @@ class GridLines extends Properties
|
|||
* @param int $sh_angle
|
||||
* @param float $sh_distance
|
||||
*/
|
||||
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
|
||||
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null): void
|
||||
{
|
||||
$this->activateObject()
|
||||
->setShadowPresetsProperties((int) $sh_presets)
|
||||
|
@ -318,7 +318,6 @@ class GridLines extends Properties
|
|||
/**
|
||||
* Set Shadow Properties Values.
|
||||
*
|
||||
* @param array $properties_map
|
||||
* @param mixed &$reference
|
||||
*
|
||||
* @return $this
|
||||
|
@ -435,7 +434,7 @@ class GridLines extends Properties
|
|||
*
|
||||
* @param float $size
|
||||
*/
|
||||
public function setSoftEdgesSize($size)
|
||||
public function setSoftEdgesSize($size): void
|
||||
{
|
||||
if ($size !== null) {
|
||||
$this->activateObject();
|
||||
|
|
|
@ -110,8 +110,6 @@ class Layout
|
|||
|
||||
/**
|
||||
* Create a new Layout.
|
||||
*
|
||||
* @param array $layout
|
||||
*/
|
||||
public function __construct(array $layout = [])
|
||||
{
|
||||
|
|
|
@ -52,10 +52,9 @@ class Legend
|
|||
* Create a new Legend.
|
||||
*
|
||||
* @param string $position
|
||||
* @param null|Layout $layout
|
||||
* @param bool $overlay
|
||||
*/
|
||||
public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false)
|
||||
public function __construct($position = self::POSITION_RIGHT, ?Layout $layout = null, $overlay = false)
|
||||
{
|
||||
$this->setPosition($position);
|
||||
$this->layout = $layout;
|
||||
|
|
|
@ -23,10 +23,9 @@ class PlotArea
|
|||
/**
|
||||
* Create a new PlotArea.
|
||||
*
|
||||
* @param null|Layout $layout
|
||||
* @param DataSeries[] $plotSeries
|
||||
*/
|
||||
public function __construct(Layout $layout = null, array $plotSeries = [])
|
||||
public function __construct(?Layout $layout = null, array $plotSeries = [])
|
||||
{
|
||||
$this->layout = $layout;
|
||||
$this->plotSeries = $plotSeries;
|
||||
|
@ -103,7 +102,7 @@ class PlotArea
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function refresh(Worksheet $worksheet)
|
||||
public function refresh(Worksheet $worksheet): void
|
||||
{
|
||||
foreach ($this->plotSeries as $plotSeries) {
|
||||
$plotSeries->refresh($worksheet);
|
||||
|
|
|
@ -8,8 +8,6 @@ interface IRenderer
|
|||
{
|
||||
/**
|
||||
* IRenderer constructor.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Chart\Chart $chart
|
||||
*/
|
||||
public function __construct(Chart $chart);
|
||||
|
||||
|
|
|
@ -2,8 +2,24 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheet\Chart\Renderer;
|
||||
|
||||
use AccBarPlot;
|
||||
use AccLinePlot;
|
||||
use BarPlot;
|
||||
use ContourPlot;
|
||||
use Graph;
|
||||
use GroupBarPlot;
|
||||
use LinePlot;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\Chart;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use PieGraph;
|
||||
use PiePlot;
|
||||
use PiePlot3D;
|
||||
use PiePlotC;
|
||||
use RadarGraph;
|
||||
use RadarPlot;
|
||||
use ScatterPlot;
|
||||
use Spline;
|
||||
use StockPlot;
|
||||
|
||||
require_once __DIR__ . '/Polyfill.php';
|
||||
|
||||
|
@ -33,8 +49,6 @@ class JpGraph implements IRenderer
|
|||
|
||||
/**
|
||||
* Create a new jpgraph.
|
||||
*
|
||||
* @param Chart $chart
|
||||
*/
|
||||
public function __construct(Chart $chart)
|
||||
{
|
||||
|
@ -43,7 +57,7 @@ class JpGraph implements IRenderer
|
|||
$this->chart = $chart;
|
||||
}
|
||||
|
||||
private static function init()
|
||||
private static function init(): void
|
||||
{
|
||||
static $loaded = false;
|
||||
if ($loaded) {
|
||||
|
@ -179,7 +193,7 @@ class JpGraph implements IRenderer
|
|||
return $caption;
|
||||
}
|
||||
|
||||
private function renderTitle()
|
||||
private function renderTitle(): void
|
||||
{
|
||||
$title = $this->getCaption($this->chart->getTitle());
|
||||
if ($title !== null) {
|
||||
|
@ -187,7 +201,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderLegend()
|
||||
private function renderLegend(): void
|
||||
{
|
||||
$legend = $this->chart->getLegend();
|
||||
if ($legend !== null) {
|
||||
|
@ -220,9 +234,9 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderCartesianPlotArea($type = 'textlin')
|
||||
private function renderCartesianPlotArea($type = 'textlin'): void
|
||||
{
|
||||
$this->graph = new \Graph(self::$width, self::$height);
|
||||
$this->graph = new Graph(self::$width, self::$height);
|
||||
$this->graph->SetScale($type);
|
||||
|
||||
$this->renderTitle();
|
||||
|
@ -257,22 +271,22 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderPiePlotArea()
|
||||
private function renderPiePlotArea(): void
|
||||
{
|
||||
$this->graph = new \PieGraph(self::$width, self::$height);
|
||||
$this->graph = new PieGraph(self::$width, self::$height);
|
||||
|
||||
$this->renderTitle();
|
||||
}
|
||||
|
||||
private function renderRadarPlotArea()
|
||||
private function renderRadarPlotArea(): void
|
||||
{
|
||||
$this->graph = new \RadarGraph(self::$width, self::$height);
|
||||
$this->graph = new RadarGraph(self::$width, self::$height);
|
||||
$this->graph->SetScale('lin');
|
||||
|
||||
$this->renderTitle();
|
||||
}
|
||||
|
||||
private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d')
|
||||
private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d'): void
|
||||
{
|
||||
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
|
||||
|
@ -308,7 +322,7 @@ class JpGraph implements IRenderer
|
|||
++$testCurrentIndex;
|
||||
}
|
||||
|
||||
$seriesPlot = new \LinePlot($dataValues);
|
||||
$seriesPlot = new LinePlot($dataValues);
|
||||
if ($combination) {
|
||||
$seriesPlot->SetBarCenter();
|
||||
}
|
||||
|
@ -330,12 +344,12 @@ class JpGraph implements IRenderer
|
|||
if ($grouping == 'standard') {
|
||||
$groupPlot = $seriesPlots;
|
||||
} else {
|
||||
$groupPlot = new \AccLinePlot($seriesPlots);
|
||||
$groupPlot = new AccLinePlot($seriesPlots);
|
||||
}
|
||||
$this->graph->Add($groupPlot);
|
||||
}
|
||||
|
||||
private function renderPlotBar($groupID, $dimensions = '2d')
|
||||
private function renderPlotBar($groupID, $dimensions = '2d'): void
|
||||
{
|
||||
$rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
|
||||
// Rotate for bar rather than column chart
|
||||
|
@ -385,7 +399,7 @@ class JpGraph implements IRenderer
|
|||
if ($rotation == 'bar') {
|
||||
$dataValues = array_reverse($dataValues);
|
||||
}
|
||||
$seriesPlot = new \BarPlot($dataValues);
|
||||
$seriesPlot = new BarPlot($dataValues);
|
||||
$seriesPlot->SetColor('black');
|
||||
$seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
|
||||
if ($dimensions == '3d') {
|
||||
|
@ -406,11 +420,11 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
|
||||
if ($grouping == 'clustered') {
|
||||
$groupPlot = new \GroupBarPlot($seriesPlots);
|
||||
$groupPlot = new GroupBarPlot($seriesPlots);
|
||||
} elseif ($grouping == 'standard') {
|
||||
$groupPlot = new \GroupBarPlot($seriesPlots);
|
||||
$groupPlot = new GroupBarPlot($seriesPlots);
|
||||
} else {
|
||||
$groupPlot = new \AccBarPlot($seriesPlots);
|
||||
$groupPlot = new AccBarPlot($seriesPlots);
|
||||
if ($dimensions == '3d') {
|
||||
$groupPlot->SetShadow();
|
||||
}
|
||||
|
@ -419,7 +433,7 @@ class JpGraph implements IRenderer
|
|||
$this->graph->Add($groupPlot);
|
||||
}
|
||||
|
||||
private function renderPlotScatter($groupID, $bubble)
|
||||
private function renderPlotScatter($groupID, $bubble): void
|
||||
{
|
||||
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
$scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
@ -436,14 +450,14 @@ class JpGraph implements IRenderer
|
|||
$dataValuesY[$k] = $k;
|
||||
}
|
||||
|
||||
$seriesPlot = new \ScatterPlot($dataValuesX, $dataValuesY);
|
||||
$seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
|
||||
if ($scatterStyle == 'lineMarker') {
|
||||
$seriesPlot->SetLinkPoints();
|
||||
$seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]);
|
||||
} elseif ($scatterStyle == 'smoothMarker') {
|
||||
$spline = new \Spline($dataValuesY, $dataValuesX);
|
||||
$spline = new Spline($dataValuesY, $dataValuesX);
|
||||
[$splineDataY, $splineDataX] = $spline->Get(count($dataValuesX) * self::$width / 20);
|
||||
$lplot = new \LinePlot($splineDataX, $splineDataY);
|
||||
$lplot = new LinePlot($splineDataX, $splineDataY);
|
||||
$lplot->SetColor(self::$colourSet[self::$plotColour]);
|
||||
|
||||
$this->graph->Add($lplot);
|
||||
|
@ -464,7 +478,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderPlotRadar($groupID)
|
||||
private function renderPlotRadar($groupID): void
|
||||
{
|
||||
$radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
|
@ -488,7 +502,7 @@ class JpGraph implements IRenderer
|
|||
|
||||
$this->graph->SetTitles(array_reverse($dataValues));
|
||||
|
||||
$seriesPlot = new \RadarPlot(array_reverse($dataValuesX));
|
||||
$seriesPlot = new RadarPlot(array_reverse($dataValuesX));
|
||||
|
||||
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
|
||||
|
@ -502,7 +516,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderPlotContour($groupID)
|
||||
private function renderPlotContour($groupID): void
|
||||
{
|
||||
$contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
|
@ -517,12 +531,12 @@ class JpGraph implements IRenderer
|
|||
|
||||
$dataValues[$i] = $dataValuesX;
|
||||
}
|
||||
$seriesPlot = new \ContourPlot($dataValues);
|
||||
$seriesPlot = new ContourPlot($dataValues);
|
||||
|
||||
$this->graph->Add($seriesPlot);
|
||||
}
|
||||
|
||||
private function renderPlotStock($groupID)
|
||||
private function renderPlotStock($groupID): void
|
||||
{
|
||||
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
|
||||
|
@ -556,13 +570,13 @@ class JpGraph implements IRenderer
|
|||
$this->graph->xaxis->SetTickLabels($datasetLabels);
|
||||
}
|
||||
|
||||
$seriesPlot = new \StockPlot($dataValuesPlot);
|
||||
$seriesPlot = new StockPlot($dataValuesPlot);
|
||||
$seriesPlot->SetWidth(20);
|
||||
|
||||
$this->graph->Add($seriesPlot);
|
||||
}
|
||||
|
||||
private function renderAreaChart($groupCount, $dimensions = '2d')
|
||||
private function renderAreaChart($groupCount, $dimensions = '2d'): void
|
||||
{
|
||||
$this->renderCartesianPlotArea();
|
||||
|
||||
|
@ -571,7 +585,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderLineChart($groupCount, $dimensions = '2d')
|
||||
private function renderLineChart($groupCount, $dimensions = '2d'): void
|
||||
{
|
||||
$this->renderCartesianPlotArea();
|
||||
|
||||
|
@ -580,7 +594,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderBarChart($groupCount, $dimensions = '2d')
|
||||
private function renderBarChart($groupCount, $dimensions = '2d'): void
|
||||
{
|
||||
$this->renderCartesianPlotArea();
|
||||
|
||||
|
@ -589,7 +603,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderScatterChart($groupCount)
|
||||
private function renderScatterChart($groupCount): void
|
||||
{
|
||||
$this->renderCartesianPlotArea('linlin');
|
||||
|
||||
|
@ -598,7 +612,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderBubbleChart($groupCount)
|
||||
private function renderBubbleChart($groupCount): void
|
||||
{
|
||||
$this->renderCartesianPlotArea('linlin');
|
||||
|
||||
|
@ -607,7 +621,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
|
||||
private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false): void
|
||||
{
|
||||
$this->renderPiePlotArea();
|
||||
|
||||
|
@ -643,12 +657,12 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
|
||||
if ($dimensions == '3d') {
|
||||
$seriesPlot = new \PiePlot3D($dataValues);
|
||||
$seriesPlot = new PiePlot3D($dataValues);
|
||||
} else {
|
||||
if ($doughnut) {
|
||||
$seriesPlot = new \PiePlotC($dataValues);
|
||||
$seriesPlot = new PiePlotC($dataValues);
|
||||
} else {
|
||||
$seriesPlot = new \PiePlot($dataValues);
|
||||
$seriesPlot = new PiePlot($dataValues);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -679,7 +693,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderRadarChart($groupCount)
|
||||
private function renderRadarChart($groupCount): void
|
||||
{
|
||||
$this->renderRadarPlotArea();
|
||||
|
||||
|
@ -688,7 +702,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderStockChart($groupCount)
|
||||
private function renderStockChart($groupCount): void
|
||||
{
|
||||
$this->renderCartesianPlotArea('intint');
|
||||
|
||||
|
@ -697,7 +711,7 @@ class JpGraph implements IRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private function renderContourChart($groupCount, $dimensions)
|
||||
private function renderContourChart($groupCount, $dimensions): void
|
||||
{
|
||||
$this->renderCartesianPlotArea('intint');
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// This is a dirty workaround to output JpGraph charts even when antialiasing is not available
|
||||
if (!function_exists('imageantialias')) {
|
||||
function imageantialias(...$args)
|
||||
function imageantialias(...$args): void
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
|
|
@ -22,9 +22,8 @@ class Title
|
|||
* Create a new Title.
|
||||
*
|
||||
* @param null|mixed $caption
|
||||
* @param null|Layout $layout
|
||||
*/
|
||||
public function __construct($caption = null, Layout $layout = null)
|
||||
public function __construct($caption = null, ?Layout $layout = null)
|
||||
{
|
||||
$this->caption = $caption;
|
||||
$this->layout = $layout;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheet\Collection;
|
||||
|
||||
use Generator;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
|
||||
|
@ -61,7 +62,6 @@ class Cells
|
|||
* Initialise this new cell collection.
|
||||
*
|
||||
* @param Worksheet $parent The worksheet for this cell collection
|
||||
* @param CacheInterface $cache
|
||||
*/
|
||||
public function __construct(Worksheet $parent, CacheInterface $cache)
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ class Cells
|
|||
*
|
||||
* @param string $pCoord Coordinate of the cell to delete
|
||||
*/
|
||||
public function delete($pCoord)
|
||||
public function delete($pCoord): void
|
||||
{
|
||||
if ($pCoord === $this->currentCoordinate && $this->currentCell !== null) {
|
||||
$this->currentCell->detach();
|
||||
|
@ -346,7 +346,7 @@ class Cells
|
|||
*
|
||||
* @param string $row Row number to remove
|
||||
*/
|
||||
public function removeRow($row)
|
||||
public function removeRow($row): void
|
||||
{
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
|
@ -364,7 +364,7 @@ class Cells
|
|||
*
|
||||
* @param string $column Column ID to remove
|
||||
*/
|
||||
public function removeColumn($column)
|
||||
public function removeColumn($column): void
|
||||
{
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
|
@ -381,7 +381,7 @@ class Cells
|
|||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object.
|
||||
*/
|
||||
private function storeCurrentCell()
|
||||
private function storeCurrentCell(): void
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentCoordinate)) {
|
||||
$this->currentCell->detach();
|
||||
|
@ -459,7 +459,7 @@ class Cells
|
|||
/**
|
||||
* Clear the cell collection and disconnect from our parent.
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
public function unsetWorksheetCells(): void
|
||||
{
|
||||
if ($this->currentCell !== null) {
|
||||
$this->currentCell->detach();
|
||||
|
@ -487,7 +487,7 @@ class Cells
|
|||
/**
|
||||
* Returns all known cache keys.
|
||||
*
|
||||
* @return \Generator|string[]
|
||||
* @return Generator|string[]
|
||||
*/
|
||||
private function getAllCacheKeys()
|
||||
{
|
||||
|
|
|
@ -118,8 +118,6 @@ class Comment implements IComparable
|
|||
/**
|
||||
* Set Rich text comment.
|
||||
*
|
||||
* @param RichText $pValue
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setText(RichText $pValue)
|
||||
|
|
|
@ -458,10 +458,10 @@ class Properties
|
|||
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
|
||||
{
|
||||
if (($propertyType === null) || (!in_array($propertyType, [self::PROPERTY_TYPE_INTEGER,
|
||||
self::PROPERTY_TYPE_FLOAT,
|
||||
self::PROPERTY_TYPE_STRING,
|
||||
self::PROPERTY_TYPE_DATE,
|
||||
self::PROPERTY_TYPE_BOOLEAN, ]))) {
|
||||
self::PROPERTY_TYPE_FLOAT,
|
||||
self::PROPERTY_TYPE_STRING,
|
||||
self::PROPERTY_TYPE_DATE,
|
||||
self::PROPERTY_TYPE_BOOLEAN, ]))) {
|
||||
if ($propertyValue === null) {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
} elseif (is_float($propertyValue)) {
|
||||
|
|
|
@ -11,8 +11,6 @@ class DocumentGenerator
|
|||
{
|
||||
/**
|
||||
* @param array[] $phpSpreadsheetFunctions
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generateFunctionListByCategory(array $phpSpreadsheetFunctions): string
|
||||
{
|
||||
|
@ -40,7 +38,7 @@ class DocumentGenerator
|
|||
return (new ReflectionClass(Category::class))->getConstants();
|
||||
}
|
||||
|
||||
private static function tableRow(array $lengths, array $values = null): string
|
||||
private static function tableRow(array $lengths, ?array $values = null): string
|
||||
{
|
||||
$result = '';
|
||||
foreach (array_map(null, $lengths, $values ?? []) as $i => [$length, $value]) {
|
||||
|
@ -73,8 +71,6 @@ class DocumentGenerator
|
|||
|
||||
/**
|
||||
* @param array[] $phpSpreadsheetFunctions
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generateFunctionListByName(array $phpSpreadsheetFunctions): string
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ class HashTable
|
|||
*
|
||||
* @param IComparable[] $pSource Source array to create HashTable from
|
||||
*/
|
||||
public function addFromSource(array $pSource = null)
|
||||
public function addFromSource(?array $pSource = null): void
|
||||
{
|
||||
// Check if an array was passed
|
||||
if ($pSource == null) {
|
||||
|
@ -53,7 +53,7 @@ class HashTable
|
|||
*
|
||||
* @param IComparable $pSource Item to add
|
||||
*/
|
||||
public function add(IComparable $pSource)
|
||||
public function add(IComparable $pSource): void
|
||||
{
|
||||
$hash = $pSource->getHashCode();
|
||||
if (!isset($this->items[$hash])) {
|
||||
|
@ -67,7 +67,7 @@ class HashTable
|
|||
*
|
||||
* @param IComparable $pSource Item to remove
|
||||
*/
|
||||
public function remove(IComparable $pSource)
|
||||
public function remove(IComparable $pSource): void
|
||||
{
|
||||
$hash = $pSource->getHashCode();
|
||||
if (isset($this->items[$hash])) {
|
||||
|
@ -90,7 +90,7 @@ class HashTable
|
|||
/**
|
||||
* Clear HashTable.
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): void
|
||||
{
|
||||
$this->items = [];
|
||||
$this->keyMap = [];
|
||||
|
|
|
@ -593,7 +593,7 @@ class Html
|
|||
*/
|
||||
protected $richTextObject;
|
||||
|
||||
protected function initialise()
|
||||
protected function initialise(): void
|
||||
{
|
||||
$this->face = $this->size = $this->color = null;
|
||||
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
|
||||
|
@ -632,7 +632,7 @@ class Html
|
|||
return $this->richTextObject;
|
||||
}
|
||||
|
||||
protected function cleanWhitespace()
|
||||
protected function cleanWhitespace(): void
|
||||
{
|
||||
foreach ($this->richTextObject->getRichTextElements() as $key => $element) {
|
||||
$text = $element->getText();
|
||||
|
@ -646,7 +646,7 @@ class Html
|
|||
}
|
||||
}
|
||||
|
||||
protected function buildTextRun()
|
||||
protected function buildTextRun(): void
|
||||
{
|
||||
$text = $this->stringData;
|
||||
if (trim($text) === '') {
|
||||
|
@ -691,7 +691,7 @@ class Html
|
|||
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
return implode($values[0]);
|
||||
return implode('', $values[0]);
|
||||
}
|
||||
|
||||
protected function colourNameLookup($rgb)
|
||||
|
@ -699,7 +699,7 @@ class Html
|
|||
return self::$colourMap[$rgb];
|
||||
}
|
||||
|
||||
protected function startFontTag($tag)
|
||||
protected function startFontTag($tag): void
|
||||
{
|
||||
foreach ($tag->attributes as $attribute) {
|
||||
$attributeName = strtolower($attribute->name);
|
||||
|
@ -719,77 +719,77 @@ class Html
|
|||
}
|
||||
}
|
||||
|
||||
protected function endFontTag()
|
||||
protected function endFontTag(): void
|
||||
{
|
||||
$this->face = $this->size = $this->color = null;
|
||||
}
|
||||
|
||||
protected function startBoldTag()
|
||||
protected function startBoldTag(): void
|
||||
{
|
||||
$this->bold = true;
|
||||
}
|
||||
|
||||
protected function endBoldTag()
|
||||
protected function endBoldTag(): void
|
||||
{
|
||||
$this->bold = false;
|
||||
}
|
||||
|
||||
protected function startItalicTag()
|
||||
protected function startItalicTag(): void
|
||||
{
|
||||
$this->italic = true;
|
||||
}
|
||||
|
||||
protected function endItalicTag()
|
||||
protected function endItalicTag(): void
|
||||
{
|
||||
$this->italic = false;
|
||||
}
|
||||
|
||||
protected function startUnderlineTag()
|
||||
protected function startUnderlineTag(): void
|
||||
{
|
||||
$this->underline = true;
|
||||
}
|
||||
|
||||
protected function endUnderlineTag()
|
||||
protected function endUnderlineTag(): void
|
||||
{
|
||||
$this->underline = false;
|
||||
}
|
||||
|
||||
protected function startSubscriptTag()
|
||||
protected function startSubscriptTag(): void
|
||||
{
|
||||
$this->subscript = true;
|
||||
}
|
||||
|
||||
protected function endSubscriptTag()
|
||||
protected function endSubscriptTag(): void
|
||||
{
|
||||
$this->subscript = false;
|
||||
}
|
||||
|
||||
protected function startSuperscriptTag()
|
||||
protected function startSuperscriptTag(): void
|
||||
{
|
||||
$this->superscript = true;
|
||||
}
|
||||
|
||||
protected function endSuperscriptTag()
|
||||
protected function endSuperscriptTag(): void
|
||||
{
|
||||
$this->superscript = false;
|
||||
}
|
||||
|
||||
protected function startStrikethruTag()
|
||||
protected function startStrikethruTag(): void
|
||||
{
|
||||
$this->strikethrough = true;
|
||||
}
|
||||
|
||||
protected function endStrikethruTag()
|
||||
protected function endStrikethruTag(): void
|
||||
{
|
||||
$this->strikethrough = false;
|
||||
}
|
||||
|
||||
protected function breakTag()
|
||||
protected function breakTag(): void
|
||||
{
|
||||
$this->stringData .= "\n";
|
||||
}
|
||||
|
||||
protected function parseTextNode(DOMText $textNode)
|
||||
protected function parseTextNode(DOMText $textNode): void
|
||||
{
|
||||
$domText = preg_replace(
|
||||
'/\s+/u',
|
||||
|
@ -801,11 +801,9 @@ class Html
|
|||
}
|
||||
|
||||
/**
|
||||
* @param DOMElement $element
|
||||
* @param string $callbackTag
|
||||
* @param array $callbacks
|
||||
*/
|
||||
protected function handleCallback(DOMElement $element, $callbackTag, array $callbacks)
|
||||
protected function handleCallback(DOMElement $element, $callbackTag, array $callbacks): void
|
||||
{
|
||||
if (isset($callbacks[$callbackTag])) {
|
||||
$elementHandler = $callbacks[$callbackTag];
|
||||
|
@ -815,7 +813,7 @@ class Html
|
|||
}
|
||||
}
|
||||
|
||||
protected function parseElementNode(DOMElement $element)
|
||||
protected function parseElementNode(DOMElement $element): void
|
||||
{
|
||||
$callbackTag = strtolower($element->nodeName);
|
||||
$this->stack[] = $callbackTag;
|
||||
|
@ -828,7 +826,7 @@ class Html
|
|||
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
|
||||
}
|
||||
|
||||
protected function parseElements(DOMNode $element)
|
||||
protected function parseElements(DOMNode $element): void
|
||||
{
|
||||
foreach ($element->childNodes as $child) {
|
||||
if ($child instanceof DOMText) {
|
||||
|
|
|
@ -11,6 +11,7 @@ use RecursiveIteratorIterator;
|
|||
use RecursiveRegexIterator;
|
||||
use ReflectionClass;
|
||||
use RegexIterator;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Helper class to be used in sample code.
|
||||
|
@ -106,11 +107,10 @@ class Sample
|
|||
/**
|
||||
* Write documents.
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $filename
|
||||
* @param string[] $writers
|
||||
*/
|
||||
public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls'])
|
||||
public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls']): void
|
||||
{
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
@ -142,7 +142,7 @@ class Sample
|
|||
$tempFolder = sys_get_temp_dir() . '/phpspreadsheet';
|
||||
if (!is_dir($tempFolder)) {
|
||||
if (!mkdir($tempFolder) && !is_dir($tempFolder)) {
|
||||
throw new \RuntimeException(sprintf('Directory "%s" was not created', $tempFolder));
|
||||
throw new RuntimeException(sprintf('Directory "%s" was not created', $tempFolder));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ class Sample
|
|||
return $temporaryFilename . '.' . $extension;
|
||||
}
|
||||
|
||||
public function log($message)
|
||||
public function log($message): void
|
||||
{
|
||||
$eol = $this->isCli() ? PHP_EOL : '<br />';
|
||||
echo date('H:i:s ') . $message . $eol;
|
||||
|
@ -188,7 +188,7 @@ class Sample
|
|||
/**
|
||||
* Log ending notes.
|
||||
*/
|
||||
public function logEndingNotes()
|
||||
public function logEndingNotes(): void
|
||||
{
|
||||
// Do not show execution time for index
|
||||
$this->log('Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . 'MB');
|
||||
|
@ -197,11 +197,10 @@ class Sample
|
|||
/**
|
||||
* Log a line about the write operation.
|
||||
*
|
||||
* @param IWriter $writer
|
||||
* @param string $path
|
||||
* @param float $callStartTime
|
||||
*/
|
||||
public function logWrite(IWriter $writer, $path, $callStartTime)
|
||||
public function logWrite(IWriter $writer, $path, $callStartTime): void
|
||||
{
|
||||
$callEndTime = microtime(true);
|
||||
$callTime = $callEndTime - $callStartTime;
|
||||
|
@ -219,7 +218,7 @@ class Sample
|
|||
* @param string $path
|
||||
* @param float $callStartTime
|
||||
*/
|
||||
public function logRead($format, $path, $callStartTime)
|
||||
public function logRead($format, $path, $callStartTime): void
|
||||
{
|
||||
$callEndTime = microtime(true);
|
||||
$callTime = $callEndTime - $callStartTime;
|
||||
|
|
|
@ -37,7 +37,6 @@ abstract class IOFactory
|
|||
/**
|
||||
* Create Writer\IWriter.
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $writerType Example: Xlsx
|
||||
*
|
||||
* @return Writer\IWriter
|
||||
|
@ -192,7 +191,7 @@ abstract class IOFactory
|
|||
* @param string $writerType
|
||||
* @param string $writerClass
|
||||
*/
|
||||
public static function registerWriter($writerType, $writerClass)
|
||||
public static function registerWriter($writerType, $writerClass): void
|
||||
{
|
||||
if (!is_a($writerClass, Writer\IWriter::class, true)) {
|
||||
throw new Writer\Exception('Registered writers must implement ' . Writer\IWriter::class);
|
||||
|
@ -207,7 +206,7 @@ abstract class IOFactory
|
|||
* @param string $readerType
|
||||
* @param string $readerClass
|
||||
*/
|
||||
public static function registerReader($readerType, $readerClass)
|
||||
public static function registerReader($readerType, $readerClass): void
|
||||
{
|
||||
if (!is_a($readerClass, Reader\IReader::class, true)) {
|
||||
throw new Reader\Exception('Registered readers must implement ' . Reader\IReader::class);
|
||||
|
|
|
@ -45,7 +45,6 @@ class NamedRange
|
|||
* Create a new NamedRange.
|
||||
*
|
||||
* @param string $pName
|
||||
* @param Worksheet $pWorksheet
|
||||
* @param string $pRange
|
||||
* @param bool $pLocalOnly
|
||||
* @param null|Worksheet $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
||||
|
@ -123,7 +122,7 @@ class NamedRange
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setWorksheet(Worksheet $value = null)
|
||||
public function setWorksheet(?Worksheet $value = null)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->worksheet = $value;
|
||||
|
@ -196,11 +195,9 @@ class NamedRange
|
|||
/**
|
||||
* Set scope.
|
||||
*
|
||||
* @param null|Worksheet $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setScope(Worksheet $value = null)
|
||||
public function setScope(?Worksheet $value = null)
|
||||
{
|
||||
$this->scope = $value;
|
||||
$this->localOnly = $value != null;
|
||||
|
|
|
@ -145,12 +145,12 @@ abstract class BaseReader implements IReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
*/
|
||||
protected function openFile($pFilename)
|
||||
protected function openFile($pFilename): void
|
||||
{
|
||||
File::assertFile($pFilename);
|
||||
|
||||
// Open file
|
||||
$this->fileHandle = fopen($pFilename, 'r');
|
||||
$this->fileHandle = fopen($pFilename, 'rb');
|
||||
if ($this->fileHandle === false) {
|
||||
throw new Exception('Could not open file ' . $pFilename . ' for reading.');
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
@ -85,7 +86,7 @@ class Csv extends BaseReader
|
|||
/**
|
||||
* Move filepointer past any BOM marker.
|
||||
*/
|
||||
protected function skipBOM()
|
||||
protected function skipBOM(): void
|
||||
{
|
||||
rewind($this->fileHandle);
|
||||
|
||||
|
@ -101,7 +102,7 @@ class Csv extends BaseReader
|
|||
/**
|
||||
* Identify any separator that is explicitly set in the file.
|
||||
*/
|
||||
protected function checkSeparator()
|
||||
protected function checkSeparator(): void
|
||||
{
|
||||
$line = fgets($this->fileHandle);
|
||||
if ($line === false) {
|
||||
|
@ -120,7 +121,7 @@ class Csv extends BaseReader
|
|||
/**
|
||||
* Infer the separator if it isn't explicitly set in the file or specified by the user.
|
||||
*/
|
||||
protected function inferSeparator()
|
||||
protected function inferSeparator(): void
|
||||
{
|
||||
if ($this->delimiter !== null) {
|
||||
return;
|
||||
|
@ -178,7 +179,7 @@ class Csv extends BaseReader
|
|||
$meanSquareDeviations[$delimiter] = array_reduce(
|
||||
$series,
|
||||
function ($sum, $value) use ($median) {
|
||||
return $sum + pow($value - $median, 2);
|
||||
return $sum + ($value - $median) ** 2;
|
||||
}
|
||||
) / count($series);
|
||||
}
|
||||
|
@ -292,7 +293,7 @@ class Csv extends BaseReader
|
|||
return $this->loadIntoExisting($pFilename, $spreadsheet);
|
||||
}
|
||||
|
||||
private function openFileOrMemory($pFilename)
|
||||
private function openFileOrMemory($pFilename): void
|
||||
{
|
||||
// Open file
|
||||
$fhandle = $this->canRead($pFilename);
|
||||
|
@ -303,7 +304,7 @@ class Csv extends BaseReader
|
|||
if ($this->inputEncoding !== 'UTF-8') {
|
||||
fclose($this->fileHandle);
|
||||
$entireFile = file_get_contents($pFilename);
|
||||
$this->fileHandle = fopen('php://memory', 'r+');
|
||||
$this->fileHandle = fopen('php://memory', 'r+b');
|
||||
$data = StringHelper::convertEncoding($entireFile, 'UTF-8', $this->inputEncoding);
|
||||
fwrite($this->fileHandle, $data);
|
||||
rewind($this->fileHandle);
|
||||
|
@ -314,7 +315,6 @@ class Csv extends BaseReader
|
|||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
|
@ -508,7 +508,7 @@ class Csv extends BaseReader
|
|||
// Check if file exists
|
||||
try {
|
||||
$this->openFile($pFilename);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (InvalidArgumentException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Gnumeric extends BaseReader
|
|||
}
|
||||
|
||||
// Read signature data (first 3 bytes)
|
||||
$fh = fopen($pFilename, 'r');
|
||||
$fh = fopen($pFilename, 'rb');
|
||||
$data = fread($fh, 2);
|
||||
fclose($fh);
|
||||
|
||||
|
@ -182,7 +182,6 @@ class Gnumeric extends BaseReader
|
|||
* Loads from file into Spreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
|
@ -473,7 +472,7 @@ class Gnumeric extends BaseReader
|
|||
$endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
|
||||
$endColumn = Coordinate::stringFromColumnIndex($endColumn + 1);
|
||||
$endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
|
||||
$endRow += 1;
|
||||
++$endRow;
|
||||
$cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow;
|
||||
|
||||
$styleAttributes = $styleRegion->Style->attributes();
|
||||
|
|
|
@ -270,7 +270,7 @@ class Html extends BaseReader
|
|||
return array_pop($this->nestedColumn);
|
||||
}
|
||||
|
||||
protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent)
|
||||
protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent): void
|
||||
{
|
||||
if (is_string($cellContent)) {
|
||||
// Simple String content
|
||||
|
@ -290,13 +290,11 @@ class Html extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param DOMNode $element
|
||||
* @param Worksheet $sheet
|
||||
* @param int $row
|
||||
* @param string $column
|
||||
* @param string $cellContent
|
||||
*/
|
||||
protected function processDomElement(DOMNode $element, Worksheet $sheet, &$row, &$column, &$cellContent)
|
||||
protected function processDomElement(DOMNode $element, Worksheet $sheet, &$row, &$column, &$cellContent): void
|
||||
{
|
||||
foreach ($element->childNodes as $child) {
|
||||
if ($child instanceof DOMText) {
|
||||
|
@ -577,7 +575,6 @@ class Html extends BaseReader
|
|||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
|
@ -603,9 +600,6 @@ class Html extends BaseReader
|
|||
* Spreadsheet from content.
|
||||
*
|
||||
* @param string $content
|
||||
* @param null|Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
public function loadFromString($content, ?Spreadsheet $spreadsheet = null): Spreadsheet
|
||||
{
|
||||
|
@ -622,11 +616,6 @@ class Html extends BaseReader
|
|||
|
||||
/**
|
||||
* Loads PhpSpreadsheet from DOMDocument into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param DOMDocument $document
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
private function loadDocument(DOMDocument $document, Spreadsheet $spreadsheet): Spreadsheet
|
||||
{
|
||||
|
@ -687,7 +676,7 @@ class Html extends BaseReader
|
|||
* @param string $column
|
||||
* @param array $attributeArray
|
||||
*/
|
||||
private function applyInlineStyle(&$sheet, $row, $column, $attributeArray)
|
||||
private function applyInlineStyle(&$sheet, $row, $column, $attributeArray): void
|
||||
{
|
||||
if (!isset($attributeArray['style'])) {
|
||||
return;
|
||||
|
@ -852,12 +841,10 @@ class Html extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Worksheet $sheet
|
||||
* @param string $column
|
||||
* @param int $row
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function insertImage(Worksheet $sheet, $column, $row, array $attributes)
|
||||
private function insertImage(Worksheet $sheet, $column, $row, array $attributes): void
|
||||
{
|
||||
if (!isset($attributes['src'])) {
|
||||
return;
|
||||
|
@ -941,11 +928,10 @@ class Html extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Style $cellStyle
|
||||
* @param string $styleValue
|
||||
* @param string $type
|
||||
*/
|
||||
private function setBorderStyle(Style $cellStyle, $styleValue, $type)
|
||||
private function setBorderStyle(Style $cellStyle, $styleValue, $type): void
|
||||
{
|
||||
[, $borderStyle, $color] = explode(' ', $styleValue);
|
||||
|
||||
|
|
|
@ -118,8 +118,6 @@ interface IReader
|
|||
/**
|
||||
* Set read filter.
|
||||
*
|
||||
* @param IReadFilter $pValue
|
||||
*
|
||||
* @return IReader
|
||||
*/
|
||||
public function setReadFilter(IReadFilter $pValue);
|
||||
|
|
|
@ -4,6 +4,10 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use DOMAttr;
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||
|
@ -242,7 +246,6 @@ class Ods extends BaseReader
|
|||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
|
@ -251,7 +254,7 @@ class Ods extends BaseReader
|
|||
File::assertFile($pFilename);
|
||||
|
||||
$timezoneObj = new DateTimeZone('Europe/London');
|
||||
$GMT = new \DateTimeZone('UTC');
|
||||
$GMT = new DateTimeZone('UTC');
|
||||
|
||||
$zip = new ZipArchive();
|
||||
if (!$zip->open($pFilename)) {
|
||||
|
@ -275,7 +278,7 @@ class Ods extends BaseReader
|
|||
|
||||
// Content
|
||||
|
||||
$dom = new \DOMDocument('1.01', 'UTF-8');
|
||||
$dom = new DOMDocument('1.01', 'UTF-8');
|
||||
$dom->loadXML(
|
||||
$this->securityScanner->scan($zip->getFromName('content.xml')),
|
||||
Settings::getLibXmlLoaderOptions()
|
||||
|
@ -291,12 +294,12 @@ class Ods extends BaseReader
|
|||
->getElementsByTagNameNS($officeNs, 'spreadsheet');
|
||||
|
||||
foreach ($spreadsheets as $workbookData) {
|
||||
/** @var \DOMElement $workbookData */
|
||||
/** @var DOMElement $workbookData */
|
||||
$tables = $workbookData->getElementsByTagNameNS($tableNs, 'table');
|
||||
|
||||
$worksheetID = 0;
|
||||
foreach ($tables as $worksheetDataSet) {
|
||||
/** @var \DOMElement $worksheetDataSet */
|
||||
/** @var DOMElement $worksheetDataSet */
|
||||
$worksheetName = $worksheetDataSet->getAttributeNS($tableNs, 'name');
|
||||
|
||||
// Check loadSheetsOnly
|
||||
|
@ -322,7 +325,7 @@ class Ods extends BaseReader
|
|||
// Go through every child of table element
|
||||
$rowID = 1;
|
||||
foreach ($worksheetDataSet->childNodes as $childNode) {
|
||||
/** @var \DOMElement $childNode */
|
||||
/** @var DOMElement $childNode */
|
||||
|
||||
// Filter elements which are not under the "table" ns
|
||||
if ($childNode->namespaceURI != $tableNs) {
|
||||
|
@ -395,11 +398,11 @@ class Ods extends BaseReader
|
|||
|
||||
// Content
|
||||
|
||||
/** @var \DOMElement[] $paragraphs */
|
||||
/** @var DOMElement[] $paragraphs */
|
||||
$paragraphs = [];
|
||||
|
||||
foreach ($cellData->childNodes as $item) {
|
||||
/** @var \DOMElement $item */
|
||||
/** @var DOMElement $item */
|
||||
|
||||
// Filter text:p elements
|
||||
if ($item->nodeName == 'text:p') {
|
||||
|
@ -649,22 +652,20 @@ class Ods extends BaseReader
|
|||
/**
|
||||
* Recursively scan element.
|
||||
*
|
||||
* @param \DOMNode $element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function scanElementForText(\DOMNode $element)
|
||||
protected function scanElementForText(DOMNode $element)
|
||||
{
|
||||
$str = '';
|
||||
foreach ($element->childNodes as $child) {
|
||||
/** @var \DOMNode $child */
|
||||
/** @var DOMNode $child */
|
||||
if ($child->nodeType == XML_TEXT_NODE) {
|
||||
$str .= $child->nodeValue;
|
||||
} elseif ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == 'text:s') {
|
||||
// It's a space
|
||||
|
||||
// Multiple spaces?
|
||||
/** @var \DOMAttr $cAttr */
|
||||
/** @var DOMAttr $cAttr */
|
||||
$cAttr = $child->attributes->getNamedItem('c');
|
||||
if ($cAttr) {
|
||||
$multiplier = (int) $cAttr->nodeValue;
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Ods;
|
|||
|
||||
use PhpOffice\PhpSpreadsheet\Document\Properties as DocumentProperties;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class Properties
|
||||
{
|
||||
|
@ -14,7 +15,7 @@ class Properties
|
|||
$this->spreadsheet = $spreadsheet;
|
||||
}
|
||||
|
||||
public function load(\SimpleXMLElement $xml, $namespacesMeta)
|
||||
public function load(SimpleXMLElement $xml, $namespacesMeta): void
|
||||
{
|
||||
$docProps = $this->spreadsheet->getProperties();
|
||||
$officeProperty = $xml->children($namespacesMeta['office']);
|
||||
|
@ -35,7 +36,7 @@ class Properties
|
|||
}
|
||||
}
|
||||
|
||||
private function setCoreProperties(DocumentProperties $docProps, \SimpleXMLElement $officePropertyDC)
|
||||
private function setCoreProperties(DocumentProperties $docProps, SimpleXMLElement $officePropertyDC): void
|
||||
{
|
||||
foreach ($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
|
@ -73,10 +74,10 @@ class Properties
|
|||
|
||||
private function setMetaProperties(
|
||||
$namespacesMeta,
|
||||
\SimpleXMLElement $propertyValue,
|
||||
SimpleXMLElement $propertyValue,
|
||||
$propertyName,
|
||||
DocumentProperties $docProps
|
||||
) {
|
||||
): void {
|
||||
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
|
@ -100,7 +101,7 @@ class Properties
|
|||
}
|
||||
}
|
||||
|
||||
private function setUserDefinedProperty($propertyValueAttributes, $propertyValue, DocumentProperties $docProps)
|
||||
private function setUserDefinedProperty($propertyValueAttributes, $propertyValue, DocumentProperties $docProps): void
|
||||
{
|
||||
$propertyValueName = '';
|
||||
$propertyValueType = DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
|
|
|
@ -61,7 +61,7 @@ class XmlScanner
|
|||
return false;
|
||||
}
|
||||
|
||||
private function disableEntityLoaderCheck()
|
||||
private function disableEntityLoaderCheck(): void
|
||||
{
|
||||
if (Settings::getLibXmlDisableEntityLoader()) {
|
||||
$libxmlDisableEntityLoaderValue = libxml_disable_entity_loader(true);
|
||||
|
@ -72,7 +72,7 @@ class XmlScanner
|
|||
}
|
||||
}
|
||||
|
||||
public static function shutdown()
|
||||
public static function shutdown(): void
|
||||
{
|
||||
if (self::$libxmlDisableEntityLoaderValue !== null) {
|
||||
libxml_disable_entity_loader(self::$libxmlDisableEntityLoaderValue);
|
||||
|
@ -85,7 +85,7 @@ class XmlScanner
|
|||
self::shutdown();
|
||||
}
|
||||
|
||||
public function setAdditionalCallback(callable $callback)
|
||||
public function setAdditionalCallback(callable $callback): void
|
||||
{
|
||||
$this->callback = $callback;
|
||||
}
|
||||
|
|
|
@ -190,7 +190,6 @@ class Slk extends BaseReader
|
|||
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
|
|
|
@ -1248,10 +1248,10 @@ class Xls extends BaseReader
|
|||
[$firstColumn, $firstRow] = Coordinate::coordinateFromString($coordinateStrings[0]);
|
||||
[$lastColumn, $lastRow] = Coordinate::coordinateFromString($coordinateStrings[1]);
|
||||
|
||||
if ($firstColumn == 'A' and $lastColumn == 'IV') {
|
||||
if ($firstColumn == 'A' && $lastColumn == 'IV') {
|
||||
// then we have repeating rows
|
||||
$docSheet->getPageSetup()->setRowsToRepeatAtTop([$firstRow, $lastRow]);
|
||||
} elseif ($firstRow == 1 and $lastRow == 65536) {
|
||||
} elseif ($firstRow == 1 && $lastRow == 65536) {
|
||||
// then we have repeating columns
|
||||
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft([$firstColumn, $lastColumn]);
|
||||
}
|
||||
|
@ -1348,7 +1348,7 @@ class Xls extends BaseReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
*/
|
||||
private function loadOLE($pFilename)
|
||||
private function loadOLE($pFilename): void
|
||||
{
|
||||
// OLE reader
|
||||
$ole = new OLERead();
|
||||
|
@ -1365,7 +1365,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read summary information.
|
||||
*/
|
||||
private function readSummaryInformation()
|
||||
private function readSummaryInformation(): void
|
||||
{
|
||||
if (!isset($this->summaryInformation)) {
|
||||
return;
|
||||
|
@ -1512,7 +1512,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read additional document summary information.
|
||||
*/
|
||||
private function readDocumentSummaryInformation()
|
||||
private function readDocumentSummaryInformation(): void
|
||||
{
|
||||
if (!isset($this->documentSummaryInformation)) {
|
||||
return;
|
||||
|
@ -1650,7 +1650,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record.
|
||||
*/
|
||||
private function readDefault()
|
||||
private function readDefault(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
|
||||
|
@ -1662,7 +1662,7 @@ class Xls extends BaseReader
|
|||
* The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions,
|
||||
* this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
|
||||
*/
|
||||
private function readNote()
|
||||
private function readNote(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -1715,7 +1715,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* The TEXT Object record contains the text associated with a cell annotation.
|
||||
*/
|
||||
private function readTextObject()
|
||||
private function readTextObject(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -1762,7 +1762,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read BOF.
|
||||
*/
|
||||
private function readBof()
|
||||
private function readBof(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = substr($this->data, $this->pos + 4, $length);
|
||||
|
@ -1813,7 +1813,7 @@ class Xls extends BaseReader
|
|||
* are based on the source of Spreadsheet-ParseExcel:
|
||||
* https://metacpan.org/release/Spreadsheet-ParseExcel
|
||||
*/
|
||||
private function readFilepass()
|
||||
private function readFilepass(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
|
||||
|
@ -1963,7 +1963,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readCodepage()
|
||||
private function readCodepage(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -1989,7 +1989,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readDateMode()
|
||||
private function readDateMode(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2007,7 +2007,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read a FONT record.
|
||||
*/
|
||||
private function readFont()
|
||||
private function readFont(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2115,7 +2115,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readFormat()
|
||||
private function readFormat(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2152,7 +2152,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readXf()
|
||||
private function readXf(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2449,7 +2449,7 @@ class Xls extends BaseReader
|
|||
}
|
||||
}
|
||||
|
||||
private function readXfExt()
|
||||
private function readXfExt(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2498,7 +2498,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$fill = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill();
|
||||
$fill->getStartColor()->setRGB($rgb);
|
||||
unset($fill->startcolorIndex); // normal color index does not apply, discard
|
||||
$fill->startcolorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2514,7 +2514,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$fill = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill();
|
||||
$fill->getEndColor()->setRGB($rgb);
|
||||
unset($fill->endcolorIndex); // normal color index does not apply, discard
|
||||
$fill->endcolorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2530,7 +2530,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$top = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getTop();
|
||||
$top->getColor()->setRGB($rgb);
|
||||
unset($top->colorIndex); // normal color index does not apply, discard
|
||||
$top->colorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2546,7 +2546,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$bottom = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getBottom();
|
||||
$bottom->getColor()->setRGB($rgb);
|
||||
unset($bottom->colorIndex); // normal color index does not apply, discard
|
||||
$bottom->colorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2562,7 +2562,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$left = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getLeft();
|
||||
$left->getColor()->setRGB($rgb);
|
||||
unset($left->colorIndex); // normal color index does not apply, discard
|
||||
$left->colorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2578,7 +2578,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$right = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getRight();
|
||||
$right->getColor()->setRGB($rgb);
|
||||
unset($right->colorIndex); // normal color index does not apply, discard
|
||||
$right->colorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2594,7 +2594,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$diagonal = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getDiagonal();
|
||||
$diagonal->getColor()->setRGB($rgb);
|
||||
unset($diagonal->colorIndex); // normal color index does not apply, discard
|
||||
$diagonal->colorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2610,7 +2610,7 @@ class Xls extends BaseReader
|
|||
if (isset($this->mapCellXfIndex[$ixfe])) {
|
||||
$font = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFont();
|
||||
$font->getColor()->setRGB($rgb);
|
||||
unset($font->colorIndex); // normal color index does not apply, discard
|
||||
$font->colorIndex = null; // normal color index does not apply, discard
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2625,7 +2625,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read STYLE record.
|
||||
*/
|
||||
private function readStyle()
|
||||
private function readStyle(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2662,7 +2662,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read PALETTE record.
|
||||
*/
|
||||
private function readPalette()
|
||||
private function readPalette(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2694,7 +2694,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readSheet()
|
||||
private function readSheet(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2749,7 +2749,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read EXTERNALBOOK record.
|
||||
*/
|
||||
private function readExternalBook()
|
||||
private function readExternalBook(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2811,7 +2811,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read EXTERNNAME record.
|
||||
*/
|
||||
private function readExternName()
|
||||
private function readExternName(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2845,7 +2845,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read EXTERNSHEET record.
|
||||
*/
|
||||
private function readExternSheet()
|
||||
private function readExternSheet(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2881,7 +2881,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readDefinedName()
|
||||
private function readDefinedName(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -2935,7 +2935,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read MSODRAWINGGROUP record.
|
||||
*/
|
||||
private function readMsoDrawingGroup()
|
||||
private function readMsoDrawingGroup(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
|
||||
|
@ -2957,7 +2957,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readSst()
|
||||
private function readSst(): void
|
||||
{
|
||||
// offset within (spliced) record data
|
||||
$pos = 0;
|
||||
|
@ -3138,7 +3138,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read PRINTGRIDLINES record.
|
||||
*/
|
||||
private function readPrintGridlines()
|
||||
private function readPrintGridlines(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3156,7 +3156,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read DEFAULTROWHEIGHT record.
|
||||
*/
|
||||
private function readDefaultRowHeight()
|
||||
private function readDefaultRowHeight(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3173,7 +3173,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read SHEETPR record.
|
||||
*/
|
||||
private function readSheetPr()
|
||||
private function readSheetPr(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3199,7 +3199,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read HORIZONTALPAGEBREAKS record.
|
||||
*/
|
||||
private function readHorizontalPageBreaks()
|
||||
private function readHorizontalPageBreaks(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3226,7 +3226,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read VERTICALPAGEBREAKS record.
|
||||
*/
|
||||
private function readVerticalPageBreaks()
|
||||
private function readVerticalPageBreaks(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3253,7 +3253,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read HEADER record.
|
||||
*/
|
||||
private function readHeader()
|
||||
private function readHeader(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3280,7 +3280,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read FOOTER record.
|
||||
*/
|
||||
private function readFooter()
|
||||
private function readFooter(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3306,7 +3306,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read HCENTER record.
|
||||
*/
|
||||
private function readHcenter()
|
||||
private function readHcenter(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3325,7 +3325,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read VCENTER record.
|
||||
*/
|
||||
private function readVcenter()
|
||||
private function readVcenter(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3344,7 +3344,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read LEFTMARGIN record.
|
||||
*/
|
||||
private function readLeftMargin()
|
||||
private function readLeftMargin(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3361,7 +3361,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read RIGHTMARGIN record.
|
||||
*/
|
||||
private function readRightMargin()
|
||||
private function readRightMargin(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3378,7 +3378,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read TOPMARGIN record.
|
||||
*/
|
||||
private function readTopMargin()
|
||||
private function readTopMargin(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3395,7 +3395,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read BOTTOMMARGIN record.
|
||||
*/
|
||||
private function readBottomMargin()
|
||||
private function readBottomMargin(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3412,7 +3412,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read PAGESETUP record.
|
||||
*/
|
||||
private function readPageSetup()
|
||||
private function readPageSetup(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3475,7 +3475,7 @@ class Xls extends BaseReader
|
|||
* PROTECT - Sheet protection (BIFF2 through BIFF8)
|
||||
* if this record is omitted, then it also means no sheet protection.
|
||||
*/
|
||||
private function readProtect()
|
||||
private function readProtect(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3497,7 +3497,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* SCENPROTECT.
|
||||
*/
|
||||
private function readScenProtect()
|
||||
private function readScenProtect(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3520,7 +3520,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* OBJECTPROTECT.
|
||||
*/
|
||||
private function readObjectProtect()
|
||||
private function readObjectProtect(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3543,7 +3543,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8).
|
||||
*/
|
||||
private function readPassword()
|
||||
private function readPassword(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3561,7 +3561,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read DEFCOLWIDTH record.
|
||||
*/
|
||||
private function readDefColWidth()
|
||||
private function readDefColWidth(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3579,7 +3579,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read COLINFO record.
|
||||
*/
|
||||
private function readColInfo()
|
||||
private function readColInfo(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3637,7 +3637,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readRow()
|
||||
private function readRow(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3706,7 +3706,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readRk()
|
||||
private function readRk(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3750,7 +3750,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readLabelSst()
|
||||
private function readLabelSst(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3834,7 +3834,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readMulRk()
|
||||
private function readMulRk(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3887,7 +3887,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readNumber()
|
||||
private function readNumber(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -3928,7 +3928,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readFormula()
|
||||
private function readFormula(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4054,7 +4054,7 @@ class Xls extends BaseReader
|
|||
* which usually contains relative references.
|
||||
* These will be used to construct the formula in each shared formula part after the sheet is read.
|
||||
*/
|
||||
private function readSharedFmla()
|
||||
private function readSharedFmla(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4112,7 +4112,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readBoolErr()
|
||||
private function readBoolErr(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4171,7 +4171,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readMulBlank()
|
||||
private function readMulBlank(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4212,7 +4212,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readLabel()
|
||||
private function readLabel(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4256,7 +4256,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read BLANK record.
|
||||
*/
|
||||
private function readBlank()
|
||||
private function readBlank(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4286,7 +4286,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read MSODRAWING record.
|
||||
*/
|
||||
private function readMsoDrawing()
|
||||
private function readMsoDrawing(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
|
||||
|
@ -4300,7 +4300,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read OBJ record.
|
||||
*/
|
||||
private function readObj()
|
||||
private function readObj(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4340,7 +4340,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read WINDOW2 record.
|
||||
*/
|
||||
private function readWindow2()
|
||||
private function readWindow2(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4411,7 +4411,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read PLV Record(Created by Excel2007 or upper).
|
||||
*/
|
||||
private function readPageLayoutView()
|
||||
private function readPageLayoutView(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4448,7 +4448,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read SCL record.
|
||||
*/
|
||||
private function readScl()
|
||||
private function readScl(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4469,7 +4469,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read PANE record.
|
||||
*/
|
||||
private function readPane()
|
||||
private function readPane(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4503,7 +4503,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read SELECTION record. There is one such record for each pane in the sheet.
|
||||
*/
|
||||
private function readSelection()
|
||||
private function readSelection(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4580,7 +4580,7 @@ class Xls extends BaseReader
|
|||
* -- "OpenOffice.org's Documentation of the Microsoft
|
||||
* Excel File Format"
|
||||
*/
|
||||
private function readMergedCells()
|
||||
private function readMergedCells(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4602,7 +4602,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read HYPERLINK record.
|
||||
*/
|
||||
private function readHyperLink()
|
||||
private function readHyperLink(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4775,7 +4775,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read DATAVALIDATIONS record.
|
||||
*/
|
||||
private function readDataValidations()
|
||||
private function readDataValidations(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4787,7 +4787,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read DATAVALIDATION record.
|
||||
*/
|
||||
private function readDataValidation()
|
||||
private function readDataValidation(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -4997,7 +4997,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read SHEETLAYOUT record. Stores sheet tab color information.
|
||||
*/
|
||||
private function readSheetLayout()
|
||||
private function readSheetLayout(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -5037,7 +5037,7 @@ class Xls extends BaseReader
|
|||
/**
|
||||
* Read SHEETPROTECTION record (FEATHEADR).
|
||||
*/
|
||||
private function readSheetProtection()
|
||||
private function readSheetProtection(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -5137,7 +5137,7 @@ class Xls extends BaseReader
|
|||
* Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification,
|
||||
* where it is referred to as FEAT record.
|
||||
*/
|
||||
private function readRangeProtection()
|
||||
private function readRangeProtection(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -5199,7 +5199,7 @@ class Xls extends BaseReader
|
|||
* When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented.
|
||||
* In this case, we must treat the CONTINUE record as a MSODRAWING record.
|
||||
*/
|
||||
private function readContinue()
|
||||
private function readContinue(): void
|
||||
{
|
||||
$length = self::getUInt2d($this->data, $this->pos + 2);
|
||||
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
|
||||
|
@ -5319,7 +5319,7 @@ class Xls extends BaseReader
|
|||
// start parsing the formula data
|
||||
$tokens = [];
|
||||
|
||||
while (strlen($formulaData) > 0 and $token = $this->getNextToken($formulaData, $baseCell)) {
|
||||
while (strlen($formulaData) > 0 && $token = $this->getNextToken($formulaData, $baseCell)) {
|
||||
$tokens[] = $token;
|
||||
$formulaData = substr($formulaData, $token['size']);
|
||||
}
|
||||
|
@ -7203,7 +7203,7 @@ class Xls extends BaseReader
|
|||
$fc = Coordinate::stringFromColumnIndex($fc + 1);
|
||||
$lc = Coordinate::stringFromColumnIndex($lc + 1);
|
||||
|
||||
if ($fr == $lr and $fc == $lc) {
|
||||
if ($fr == $lr && $fc == $lc) {
|
||||
return "$fc$fr";
|
||||
}
|
||||
|
||||
|
@ -7242,7 +7242,7 @@ class Xls extends BaseReader
|
|||
$fc = Coordinate::stringFromColumnIndex($fc + 1);
|
||||
$lc = Coordinate::stringFromColumnIndex($lc + 1);
|
||||
|
||||
if ($fr == $lr and $fc == $lc) {
|
||||
if ($fr == $lr && $fc == $lc) {
|
||||
return "$fc$fr";
|
||||
}
|
||||
|
||||
|
@ -7463,7 +7463,7 @@ class Xls extends BaseReader
|
|||
switch ($type) {
|
||||
case 'internal':
|
||||
// check if we have a deleted 3d reference
|
||||
if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF or $this->ref[$index]['lastSheetIndex'] == 0xFFFF) {
|
||||
if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF || $this->ref[$index]['lastSheetIndex'] == 0xFFFF) {
|
||||
throw new Exception('Deleted sheet reference');
|
||||
}
|
||||
|
||||
|
@ -7688,7 +7688,7 @@ class Xls extends BaseReader
|
|||
$string = self::readUnicodeString(substr($subData, 1), $characterCount);
|
||||
|
||||
// add 1 for the string length
|
||||
$string['size'] += 1;
|
||||
++$string['size'];
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
@ -7781,13 +7781,13 @@ class Xls extends BaseReader
|
|||
$mantissa = (0x100000 | ($rknumhigh & 0x000fffff));
|
||||
$mantissalow1 = ($rknumlow & 0x80000000) >> 31;
|
||||
$mantissalow2 = ($rknumlow & 0x7fffffff);
|
||||
$value = $mantissa / pow(2, (20 - $exp));
|
||||
$value = $mantissa / 2 ** (20 - $exp);
|
||||
|
||||
if ($mantissalow1 != 0) {
|
||||
$value += 1 / pow(2, (21 - $exp));
|
||||
$value += 1 / 2 ** (21 - $exp);
|
||||
}
|
||||
|
||||
$value += $mantissalow2 / pow(2, (52 - $exp));
|
||||
$value += $mantissalow2 / 2 ** (52 - $exp);
|
||||
if ($sign) {
|
||||
$value *= -1;
|
||||
}
|
||||
|
@ -7813,7 +7813,7 @@ class Xls extends BaseReader
|
|||
$sign = ($rknum & 0x80000000) >> 31;
|
||||
$exp = ($rknum & 0x7ff00000) >> 20;
|
||||
$mantissa = (0x100000 | ($rknum & 0x000ffffc));
|
||||
$value = $mantissa / pow(2, (20 - ($exp - 1023)));
|
||||
$value = $mantissa / 2 ** (20 - ($exp - 1023));
|
||||
if ($sign) {
|
||||
$value = -1 * $value;
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ class Escher
|
|||
/**
|
||||
* Read a generic record.
|
||||
*/
|
||||
private function readDefault()
|
||||
private function readDefault(): void
|
||||
{
|
||||
// offset 0; size: 2; recVer and recInstance
|
||||
$verInstance = Xls::getUInt2d($this->data, $this->pos);
|
||||
|
@ -199,7 +199,7 @@ class Escher
|
|||
/**
|
||||
* Read DggContainer record (Drawing Group Container).
|
||||
*/
|
||||
private function readDggContainer()
|
||||
private function readDggContainer(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -217,7 +217,7 @@ class Escher
|
|||
/**
|
||||
* Read Dgg record (Drawing Group).
|
||||
*/
|
||||
private function readDgg()
|
||||
private function readDgg(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -229,7 +229,7 @@ class Escher
|
|||
/**
|
||||
* Read BstoreContainer record (Blip Store Container).
|
||||
*/
|
||||
private function readBstoreContainer()
|
||||
private function readBstoreContainer(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -247,7 +247,7 @@ class Escher
|
|||
/**
|
||||
* Read BSE record.
|
||||
*/
|
||||
private function readBSE()
|
||||
private function readBSE(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -313,7 +313,7 @@ class Escher
|
|||
/**
|
||||
* Read BlipJPEG record. Holds raw JPEG image data.
|
||||
*/
|
||||
private function readBlipJPEG()
|
||||
private function readBlipJPEG(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -340,7 +340,7 @@ class Escher
|
|||
|
||||
// offset: var; size: 1; tag
|
||||
$tag = ord($recordData[$pos]);
|
||||
$pos += 1;
|
||||
++$pos;
|
||||
|
||||
// offset: var; size: var; the raw image data
|
||||
$data = substr($recordData, $pos);
|
||||
|
@ -354,7 +354,7 @@ class Escher
|
|||
/**
|
||||
* Read BlipPNG record. Holds raw PNG image data.
|
||||
*/
|
||||
private function readBlipPNG()
|
||||
private function readBlipPNG(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -381,7 +381,7 @@ class Escher
|
|||
|
||||
// offset: var; size: 1; tag
|
||||
$tag = ord($recordData[$pos]);
|
||||
$pos += 1;
|
||||
++$pos;
|
||||
|
||||
// offset: var; size: var; the raw image data
|
||||
$data = substr($recordData, $pos);
|
||||
|
@ -395,7 +395,7 @@ class Escher
|
|||
/**
|
||||
* Read OPT record. This record may occur within DggContainer record or SpContainer.
|
||||
*/
|
||||
private function readOPT()
|
||||
private function readOPT(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -414,7 +414,7 @@ class Escher
|
|||
/**
|
||||
* Read TertiaryOPT record.
|
||||
*/
|
||||
private function readTertiaryOPT()
|
||||
private function readTertiaryOPT(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -431,7 +431,7 @@ class Escher
|
|||
/**
|
||||
* Read SplitMenuColors record.
|
||||
*/
|
||||
private function readSplitMenuColors()
|
||||
private function readSplitMenuColors(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -443,7 +443,7 @@ class Escher
|
|||
/**
|
||||
* Read DgContainer record (Drawing Container).
|
||||
*/
|
||||
private function readDgContainer()
|
||||
private function readDgContainer(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -461,7 +461,7 @@ class Escher
|
|||
/**
|
||||
* Read Dg record (Drawing).
|
||||
*/
|
||||
private function readDg()
|
||||
private function readDg(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -473,7 +473,7 @@ class Escher
|
|||
/**
|
||||
* Read SpgrContainer record (Shape Group Container).
|
||||
*/
|
||||
private function readSpgrContainer()
|
||||
private function readSpgrContainer(): void
|
||||
{
|
||||
// context is either context DgContainer or SpgrContainer
|
||||
|
||||
|
@ -501,7 +501,7 @@ class Escher
|
|||
/**
|
||||
* Read SpContainer record (Shape Container).
|
||||
*/
|
||||
private function readSpContainer()
|
||||
private function readSpContainer(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -521,7 +521,7 @@ class Escher
|
|||
/**
|
||||
* Read Spgr record (Shape Group).
|
||||
*/
|
||||
private function readSpgr()
|
||||
private function readSpgr(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -533,7 +533,7 @@ class Escher
|
|||
/**
|
||||
* Read Sp record (Shape).
|
||||
*/
|
||||
private function readSp()
|
||||
private function readSp(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -550,7 +550,7 @@ class Escher
|
|||
/**
|
||||
* Read ClientTextbox record.
|
||||
*/
|
||||
private function readClientTextbox()
|
||||
private function readClientTextbox(): void
|
||||
{
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
|
@ -567,7 +567,7 @@ class Escher
|
|||
/**
|
||||
* Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet.
|
||||
*/
|
||||
private function readClientAnchor()
|
||||
private function readClientAnchor(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -621,7 +621,7 @@ class Escher
|
|||
/**
|
||||
* Read ClientData record.
|
||||
*/
|
||||
private function readClientData()
|
||||
private function readClientData(): void
|
||||
{
|
||||
$length = Xls::getInt4d($this->data, $this->pos + 4);
|
||||
$recordData = substr($this->data, $this->pos + 8, $length);
|
||||
|
@ -636,7 +636,7 @@ class Escher
|
|||
* @param string $data Binary data
|
||||
* @param int $n Number of properties
|
||||
*/
|
||||
private function readOfficeArtRGFOPTE($data, $n)
|
||||
private function readOfficeArtRGFOPTE($data, $n): void
|
||||
{
|
||||
$splicedComplexData = substr($data, 6 * $n);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class MD5
|
|||
/**
|
||||
* Reset the MD5 stream context.
|
||||
*/
|
||||
public function reset()
|
||||
public function reset(): void
|
||||
{
|
||||
$this->a = 0x67452301;
|
||||
$this->b = 0xEFCDAB89;
|
||||
|
@ -56,7 +56,7 @@ class MD5
|
|||
*
|
||||
* @param string $data Data to add
|
||||
*/
|
||||
public function add($data)
|
||||
public function add($data): void
|
||||
{
|
||||
$words = array_values(unpack('V16', $data));
|
||||
|
||||
|
@ -168,7 +168,7 @@ class MD5
|
|||
return $Y ^ ($X | (~$Z)); // Y XOR (X OR NOT Z)
|
||||
}
|
||||
|
||||
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
||||
private static function step($func, &$A, $B, $C, $D, $M, $s, $t): void
|
||||
{
|
||||
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
||||
$A = self::rotate($A, $s);
|
||||
|
|
|
@ -35,6 +35,8 @@ use PhpOffice\PhpSpreadsheet\Style\Style;
|
|||
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
use stdClass;
|
||||
use Throwable;
|
||||
use XMLReader;
|
||||
use ZipArchive;
|
||||
|
||||
|
@ -256,7 +258,7 @@ class Xlsx extends BaseReader
|
|||
return isset($c->v) ? (string) $c->v : null;
|
||||
}
|
||||
|
||||
private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
|
||||
private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType): void
|
||||
{
|
||||
$cellDataType = 'f';
|
||||
$value = "={$c->f}";
|
||||
|
@ -282,7 +284,6 @@ class Xlsx extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param ZipArchive $archive
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return string
|
||||
|
@ -658,7 +659,7 @@ class Xlsx extends BaseReader
|
|||
$coordinates = Coordinate::coordinateFromString($r);
|
||||
|
||||
if (!$this->getReadFilter()->readCell($coordinates[0], (int) $coordinates[1], $docSheet->getTitle())) {
|
||||
$rowIndex += 1;
|
||||
++$rowIndex;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -744,9 +745,9 @@ class Xlsx extends BaseReader
|
|||
(int) ($c['s']) : 0);
|
||||
}
|
||||
}
|
||||
$rowIndex += 1;
|
||||
++$rowIndex;
|
||||
}
|
||||
$cIndex += 1;
|
||||
++$cIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -891,7 +892,7 @@ class Xlsx extends BaseReader
|
|||
Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
||||
} catch (\Throwable $ex) {
|
||||
} catch (Throwable $ex) {
|
||||
//Ignore unparsable vmlDrawings. Later they will be moved from $unparsedVmlDrawings to $unparsedLoadedData
|
||||
continue;
|
||||
}
|
||||
|
@ -1115,7 +1116,7 @@ class Xlsx extends BaseReader
|
|||
$xfrm = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm;
|
||||
/** @var SimpleXMLElement $outerShdw */
|
||||
$outerShdw = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw;
|
||||
/** @var \SimpleXMLElement $hlinkClick */
|
||||
/** @var SimpleXMLElement $hlinkClick */
|
||||
$hlinkClick = $oneCellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick;
|
||||
|
||||
$objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
|
||||
|
@ -1556,10 +1557,9 @@ class Xlsx extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Style $docStyle
|
||||
* @param SimpleXMLElement|\stdClass $style
|
||||
* @param SimpleXMLElement|stdClass $style
|
||||
*/
|
||||
private static function readStyle(Style $docStyle, $style)
|
||||
private static function readStyle(Style $docStyle, $style): void
|
||||
{
|
||||
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
||||
|
||||
|
@ -1684,10 +1684,9 @@ class Xlsx extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Border $docBorder
|
||||
* @param SimpleXMLElement $eleBorder
|
||||
*/
|
||||
private static function readBorder(Border $docBorder, $eleBorder)
|
||||
private static function readBorder(Border $docBorder, $eleBorder): void
|
||||
{
|
||||
if (isset($eleBorder['style'])) {
|
||||
$docBorder->setBorderStyle((string) $eleBorder['style']);
|
||||
|
@ -1760,11 +1759,10 @@ class Xlsx extends BaseReader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Spreadsheet $excel
|
||||
* @param mixed $customUITarget
|
||||
* @param mixed $zip
|
||||
*/
|
||||
private function readRibbon(Spreadsheet $excel, $customUITarget, $zip)
|
||||
private function readRibbon(Spreadsheet $excel, $customUITarget, $zip): void
|
||||
{
|
||||
$baseDir = dirname($customUITarget);
|
||||
$nameCustomUI = basename($customUITarget);
|
||||
|
@ -1866,10 +1864,10 @@ class Xlsx extends BaseReader
|
|||
|
||||
/**
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet\Drawing $objDrawing
|
||||
* @param \SimpleXMLElement $cellAnchor
|
||||
* @param SimpleXMLElement $cellAnchor
|
||||
* @param array $hyperlinks
|
||||
*/
|
||||
private function readHyperLinkDrawing($objDrawing, $cellAnchor, $hyperlinks)
|
||||
private function readHyperLinkDrawing($objDrawing, $cellAnchor, $hyperlinks): void
|
||||
{
|
||||
$hlinkClick = $cellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick;
|
||||
|
||||
|
@ -1885,7 +1883,7 @@ class Xlsx extends BaseReader
|
|||
$objDrawing->setHyperlink($hyperlink);
|
||||
}
|
||||
|
||||
private function readProtection(Spreadsheet $excel, SimpleXMLElement $xmlWorkbook)
|
||||
private function readProtection(Spreadsheet $excel, SimpleXMLElement $xmlWorkbook): void
|
||||
{
|
||||
if (!$xmlWorkbook->workbookProtection) {
|
||||
return;
|
||||
|
@ -1912,7 +1910,7 @@ class Xlsx extends BaseReader
|
|||
}
|
||||
}
|
||||
|
||||
private function readFormControlProperties(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData)
|
||||
private function readFormControlProperties(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData): void
|
||||
{
|
||||
if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) {
|
||||
return;
|
||||
|
@ -1944,7 +1942,7 @@ class Xlsx extends BaseReader
|
|||
unset($unparsedCtrlProps);
|
||||
}
|
||||
|
||||
private function readPrinterSettings(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData)
|
||||
private function readPrinterSettings(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData): void
|
||||
{
|
||||
if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) {
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class AutoFilter
|
||||
{
|
||||
|
@ -12,13 +13,13 @@ class AutoFilter
|
|||
|
||||
private $worksheetXml;
|
||||
|
||||
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml)
|
||||
public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml)
|
||||
{
|
||||
$this->worksheet = $workSheet;
|
||||
$this->worksheetXml = $worksheetXml;
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function load(): void
|
||||
{
|
||||
// Remove all "$" in the auto filter range
|
||||
$autoFilterRange = preg_replace('/\$/', '', $this->worksheetXml->autoFilter['ref']);
|
||||
|
@ -27,7 +28,7 @@ class AutoFilter
|
|||
}
|
||||
}
|
||||
|
||||
private function readAutoFilter($autoFilterRange, $xmlSheet)
|
||||
private function readAutoFilter($autoFilterRange, $xmlSheet): void
|
||||
{
|
||||
$autoFilter = $this->worksheet->getAutoFilter();
|
||||
$autoFilter->setRange($autoFilterRange);
|
||||
|
@ -62,7 +63,7 @@ class AutoFilter
|
|||
}
|
||||
}
|
||||
|
||||
private function readDateRangeAutoFilter(\SimpleXMLElement $filters, Column $column)
|
||||
private function readDateRangeAutoFilter(SimpleXMLElement $filters, Column $column): void
|
||||
{
|
||||
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
||||
// Operator is undefined, but always treated as EQUAL
|
||||
|
@ -81,7 +82,7 @@ class AutoFilter
|
|||
}
|
||||
}
|
||||
|
||||
private function readCustomAutoFilter(\SimpleXMLElement $filterColumn, Column $column)
|
||||
private function readCustomAutoFilter(SimpleXMLElement $filterColumn, Column $column): void
|
||||
{
|
||||
if ($filterColumn->customFilters) {
|
||||
$column->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER);
|
||||
|
@ -100,7 +101,7 @@ class AutoFilter
|
|||
}
|
||||
}
|
||||
|
||||
private function readDynamicAutoFilter(\SimpleXMLElement $filterColumn, Column $column)
|
||||
private function readDynamicAutoFilter(SimpleXMLElement $filterColumn, Column $column): void
|
||||
{
|
||||
if ($filterColumn->dynamicFilter) {
|
||||
$column->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
||||
|
@ -122,7 +123,7 @@ class AutoFilter
|
|||
}
|
||||
}
|
||||
|
||||
private function readTopTenAutoFilter(\SimpleXMLElement $filterColumn, Column $column)
|
||||
private function readTopTenAutoFilter(SimpleXMLElement $filterColumn, Column $column): void
|
||||
{
|
||||
if ($filterColumn->top10) {
|
||||
$column->setFilterType(Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER);
|
||||
|
|
|
@ -17,7 +17,6 @@ use SimpleXMLElement;
|
|||
class Chart
|
||||
{
|
||||
/**
|
||||
* @param SimpleXMLElement $component
|
||||
* @param string $name
|
||||
* @param string $format
|
||||
*
|
||||
|
@ -51,7 +50,6 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* @param SimpleXMLElement $chartElements
|
||||
* @param string $chartName
|
||||
*
|
||||
* @return \PhpOffice\PhpSpreadsheet\Chart\Chart
|
||||
|
@ -529,10 +527,9 @@ class Chart
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Layout $plotArea
|
||||
* @param mixed $plotAttributes
|
||||
*/
|
||||
private static function setChartAttributes(Layout $plotArea, $plotAttributes)
|
||||
private static function setChartAttributes(Layout $plotArea, $plotAttributes): void
|
||||
{
|
||||
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||
switch ($plotAttributeKey) {
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class ColumnAndRowAttributes extends BaseParserClass
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
|
||||
private $worksheetXml;
|
||||
|
||||
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null)
|
||||
public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null)
|
||||
{
|
||||
$this->worksheet = $workSheet;
|
||||
$this->worksheetXml = $worksheetXml;
|
||||
|
@ -25,7 +26,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
* @param array $columnAttributes array of attributes (indexes are attribute name, values are value)
|
||||
* 'xfIndex', 'visible', 'collapsed', 'outlineLevel', 'width', ... ?
|
||||
*/
|
||||
private function setColumnAttributes($columnAddress, array $columnAttributes)
|
||||
private function setColumnAttributes($columnAddress, array $columnAttributes): void
|
||||
{
|
||||
if (isset($columnAttributes['xfIndex'])) {
|
||||
$this->worksheet->getColumnDimension($columnAddress)->setXfIndex($columnAttributes['xfIndex']);
|
||||
|
@ -51,7 +52,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
* @param array $rowAttributes array of attributes (indexes are attribute name, values are value)
|
||||
* 'xfIndex', 'visible', 'collapsed', 'outlineLevel', 'rowHeight', ... ?
|
||||
*/
|
||||
private function setRowAttributes($rowNumber, array $rowAttributes)
|
||||
private function setRowAttributes($rowNumber, array $rowAttributes): void
|
||||
{
|
||||
if (isset($rowAttributes['xfIndex'])) {
|
||||
$this->worksheet->getRowDimension($rowNumber)->setXfIndex($rowAttributes['xfIndex']);
|
||||
|
@ -74,7 +75,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
* @param IReadFilter $readFilter
|
||||
* @param bool $readDataOnly
|
||||
*/
|
||||
public function load(IReadFilter $readFilter = null, $readDataOnly = false)
|
||||
public function load(?IReadFilter $readFilter = null, $readDataOnly = false): void
|
||||
{
|
||||
if ($this->worksheetXml === null) {
|
||||
return;
|
||||
|
@ -125,7 +126,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
return false;
|
||||
}
|
||||
|
||||
private function readColumnAttributes(\SimpleXMLElement $worksheetCols, $readDataOnly)
|
||||
private function readColumnAttributes(SimpleXMLElement $worksheetCols, $readDataOnly)
|
||||
{
|
||||
$columnAttributes = [];
|
||||
|
||||
|
@ -145,7 +146,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
return $columnAttributes;
|
||||
}
|
||||
|
||||
private function readColumnRangeAttributes(\SimpleXMLElement $column, $readDataOnly)
|
||||
private function readColumnRangeAttributes(SimpleXMLElement $column, $readDataOnly)
|
||||
{
|
||||
$columnAttributes = [];
|
||||
|
||||
|
@ -177,7 +178,7 @@ class ColumnAndRowAttributes extends BaseParserClass
|
|||
return false;
|
||||
}
|
||||
|
||||
private function readRowAttributes(\SimpleXMLElement $worksheetRow, $readDataOnly)
|
||||
private function readRowAttributes(SimpleXMLElement $worksheetRow, $readDataOnly)
|
||||
{
|
||||
$rowAttributes = [];
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Conditional;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class ConditionalStyles
|
||||
{
|
||||
|
@ -13,14 +14,14 @@ class ConditionalStyles
|
|||
|
||||
private $dxfs;
|
||||
|
||||
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml, array $dxfs = [])
|
||||
public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml, array $dxfs = [])
|
||||
{
|
||||
$this->worksheet = $workSheet;
|
||||
$this->worksheetXml = $worksheetXml;
|
||||
$this->dxfs = $dxfs;
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function load(): void
|
||||
{
|
||||
$this->setConditionalStyles(
|
||||
$this->worksheet,
|
||||
|
@ -48,7 +49,7 @@ class ConditionalStyles
|
|||
return $conditionals;
|
||||
}
|
||||
|
||||
private function setConditionalStyles(Worksheet $worksheet, array $conditionals)
|
||||
private function setConditionalStyles(Worksheet $worksheet, array $conditionals): void
|
||||
{
|
||||
foreach ($conditionals as $ref => $cfRules) {
|
||||
ksort($cfRules);
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class DataValidations
|
||||
{
|
||||
|
@ -11,13 +12,13 @@ class DataValidations
|
|||
|
||||
private $worksheetXml;
|
||||
|
||||
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml)
|
||||
public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml)
|
||||
{
|
||||
$this->worksheet = $workSheet;
|
||||
$this->worksheetXml = $worksheetXml;
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function load(): void
|
||||
{
|
||||
foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) {
|
||||
// Uppercase coordinate
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class Hyperlinks
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ class Hyperlinks
|
|||
$this->worksheet = $workSheet;
|
||||
}
|
||||
|
||||
public function readHyperlinks(\SimpleXMLElement $relsWorksheet)
|
||||
public function readHyperlinks(SimpleXMLElement $relsWorksheet): void
|
||||
{
|
||||
foreach ($relsWorksheet->Relationship as $element) {
|
||||
if ($element['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink') {
|
||||
|
@ -25,14 +26,14 @@ class Hyperlinks
|
|||
}
|
||||
}
|
||||
|
||||
public function setHyperlinks(\SimpleXMLElement $worksheetXml)
|
||||
public function setHyperlinks(SimpleXMLElement $worksheetXml): void
|
||||
{
|
||||
foreach ($worksheetXml->hyperlink as $hyperlink) {
|
||||
$this->setHyperlink($hyperlink, $this->worksheet);
|
||||
}
|
||||
}
|
||||
|
||||
private function setHyperlink(\SimpleXMLElement $hyperlink, Worksheet $worksheet)
|
||||
private function setHyperlink(SimpleXMLElement $hyperlink, Worksheet $worksheet): void
|
||||
{
|
||||
// Link url
|
||||
$linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class PageSetup extends BaseParserClass
|
||||
{
|
||||
|
@ -11,7 +12,7 @@ class PageSetup extends BaseParserClass
|
|||
|
||||
private $worksheetXml;
|
||||
|
||||
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null)
|
||||
public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null)
|
||||
{
|
||||
$this->worksheet = $workSheet;
|
||||
$this->worksheetXml = $worksheetXml;
|
||||
|
@ -31,7 +32,7 @@ class PageSetup extends BaseParserClass
|
|||
return $unparsedLoadedData;
|
||||
}
|
||||
|
||||
private function margins(\SimpleXMLElement $xmlSheet, Worksheet $worksheet)
|
||||
private function margins(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void
|
||||
{
|
||||
if ($xmlSheet->pageMargins) {
|
||||
$docPageMargins = $worksheet->getPageMargins();
|
||||
|
@ -44,7 +45,7 @@ class PageSetup extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function pageSetup(\SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData)
|
||||
private function pageSetup(SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData)
|
||||
{
|
||||
if ($xmlSheet->pageSetup) {
|
||||
$docPageSetup = $worksheet->getPageSetup();
|
||||
|
@ -78,7 +79,7 @@ class PageSetup extends BaseParserClass
|
|||
return $unparsedLoadedData;
|
||||
}
|
||||
|
||||
private function headerFooter(\SimpleXMLElement $xmlSheet, Worksheet $worksheet)
|
||||
private function headerFooter(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void
|
||||
{
|
||||
if ($xmlSheet->headerFooter) {
|
||||
$docHeaderFooter = $worksheet->getHeaderFooter();
|
||||
|
@ -117,7 +118,7 @@ class PageSetup extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function pageBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet)
|
||||
private function pageBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void
|
||||
{
|
||||
if ($xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk) {
|
||||
$this->rowBreaks($xmlSheet, $worksheet);
|
||||
|
@ -127,7 +128,7 @@ class PageSetup extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function rowBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet)
|
||||
private function rowBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void
|
||||
{
|
||||
foreach ($xmlSheet->rowBreaks->brk as $brk) {
|
||||
if ($brk['man']) {
|
||||
|
@ -136,7 +137,7 @@ class PageSetup extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function columnBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet)
|
||||
private function columnBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet): void
|
||||
{
|
||||
foreach ($xmlSheet->colBreaks->brk as $brk) {
|
||||
if ($brk['man']) {
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
use PhpOffice\PhpSpreadsheet\Document\Properties as DocumentProperties;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
|
||||
use PhpOffice\PhpSpreadsheet\Settings;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class Properties
|
||||
{
|
||||
|
@ -27,7 +28,7 @@ class Properties
|
|||
);
|
||||
}
|
||||
|
||||
public function readCoreProperties($propertyData)
|
||||
public function readCoreProperties($propertyData): void
|
||||
{
|
||||
$xmlCore = $this->extractPropertyData($propertyData);
|
||||
|
||||
|
@ -48,7 +49,7 @@ class Properties
|
|||
}
|
||||
}
|
||||
|
||||
public function readExtendedProperties($propertyData)
|
||||
public function readExtendedProperties($propertyData): void
|
||||
{
|
||||
$xmlCore = $this->extractPropertyData($propertyData);
|
||||
|
||||
|
@ -62,13 +63,13 @@ class Properties
|
|||
}
|
||||
}
|
||||
|
||||
public function readCustomProperties($propertyData)
|
||||
public function readCustomProperties($propertyData): void
|
||||
{
|
||||
$xmlCore = $this->extractPropertyData($propertyData);
|
||||
|
||||
if (is_object($xmlCore)) {
|
||||
foreach ($xmlCore as $xmlProperty) {
|
||||
/** @var \SimpleXMLElement $xmlProperty */
|
||||
/** @var SimpleXMLElement $xmlProperty */
|
||||
$cellDataOfficeAttributes = $xmlProperty->attributes();
|
||||
if (isset($cellDataOfficeAttributes['name'])) {
|
||||
$propertyName = (string) $cellDataOfficeAttributes['name'];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class SheetViewOptions extends BaseParserClass
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ class SheetViewOptions extends BaseParserClass
|
|||
|
||||
private $worksheetXml;
|
||||
|
||||
public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml = null)
|
||||
public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null)
|
||||
{
|
||||
$this->worksheet = $workSheet;
|
||||
$this->worksheetXml = $worksheetXml;
|
||||
|
@ -19,7 +20,7 @@ class SheetViewOptions extends BaseParserClass
|
|||
/**
|
||||
* @param bool $readDataOnly
|
||||
*/
|
||||
public function load($readDataOnly = false)
|
||||
public function load($readDataOnly = false): void
|
||||
{
|
||||
if ($this->worksheetXml === null) {
|
||||
return;
|
||||
|
@ -41,21 +42,21 @@ class SheetViewOptions extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function tabColor(\SimpleXMLElement $sheetPr)
|
||||
private function tabColor(SimpleXMLElement $sheetPr): void
|
||||
{
|
||||
if (isset($sheetPr->tabColor, $sheetPr->tabColor['rgb'])) {
|
||||
$this->worksheet->getTabColor()->setARGB((string) $sheetPr->tabColor['rgb']);
|
||||
}
|
||||
}
|
||||
|
||||
private function codeName(\SimpleXMLElement $sheetPr)
|
||||
private function codeName(SimpleXMLElement $sheetPr): void
|
||||
{
|
||||
if (isset($sheetPr['codeName'])) {
|
||||
$this->worksheet->setCodeName((string) $sheetPr['codeName'], false);
|
||||
}
|
||||
}
|
||||
|
||||
private function outlines(\SimpleXMLElement $sheetPr)
|
||||
private function outlines(SimpleXMLElement $sheetPr): void
|
||||
{
|
||||
if (isset($sheetPr->outlinePr)) {
|
||||
if (isset($sheetPr->outlinePr['summaryRight']) &&
|
||||
|
@ -74,7 +75,7 @@ class SheetViewOptions extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function pageSetup(\SimpleXMLElement $sheetPr)
|
||||
private function pageSetup(SimpleXMLElement $sheetPr): void
|
||||
{
|
||||
if (isset($sheetPr->pageSetUpPr)) {
|
||||
if (isset($sheetPr->pageSetUpPr['fitToPage']) &&
|
||||
|
@ -86,7 +87,7 @@ class SheetViewOptions extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function sheetFormat(\SimpleXMLElement $sheetFormatPr)
|
||||
private function sheetFormat(SimpleXMLElement $sheetFormatPr): void
|
||||
{
|
||||
if (isset($sheetFormatPr['customHeight']) &&
|
||||
self::boolean((string) $sheetFormatPr['customHeight']) &&
|
||||
|
@ -106,7 +107,7 @@ class SheetViewOptions extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function printOptions(\SimpleXMLElement $printOptions)
|
||||
private function printOptions(SimpleXMLElement $printOptions): void
|
||||
{
|
||||
if (self::boolean((string) $printOptions['gridLinesSet'])) {
|
||||
$this->worksheet->setShowGridlines(true);
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class SheetViews extends BaseParserClass
|
||||
{
|
||||
|
@ -11,13 +12,13 @@ class SheetViews extends BaseParserClass
|
|||
|
||||
private $worksheet;
|
||||
|
||||
public function __construct(\SimpleXMLElement $sheetViewXml, Worksheet $workSheet)
|
||||
public function __construct(SimpleXMLElement $sheetViewXml, Worksheet $workSheet)
|
||||
{
|
||||
$this->sheetViewXml = $sheetViewXml;
|
||||
$this->worksheet = $workSheet;
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function load(): void
|
||||
{
|
||||
$this->zoomScale();
|
||||
$this->view();
|
||||
|
@ -34,7 +35,7 @@ class SheetViews extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function zoomScale()
|
||||
private function zoomScale(): void
|
||||
{
|
||||
if (isset($this->sheetViewXml['zoomScale'])) {
|
||||
$zoomScale = (int) ($this->sheetViewXml['zoomScale']);
|
||||
|
@ -59,14 +60,14 @@ class SheetViews extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function view()
|
||||
private function view(): void
|
||||
{
|
||||
if (isset($this->sheetViewXml['view'])) {
|
||||
$this->worksheet->getSheetView()->setView((string) $this->sheetViewXml['view']);
|
||||
}
|
||||
}
|
||||
|
||||
private function gridLines()
|
||||
private function gridLines(): void
|
||||
{
|
||||
if (isset($this->sheetViewXml['showGridLines'])) {
|
||||
$this->worksheet->setShowGridLines(
|
||||
|
@ -75,7 +76,7 @@ class SheetViews extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function headers()
|
||||
private function headers(): void
|
||||
{
|
||||
if (isset($this->sheetViewXml['showRowColHeaders'])) {
|
||||
$this->worksheet->setShowRowColHeaders(
|
||||
|
@ -84,7 +85,7 @@ class SheetViews extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function direction()
|
||||
private function direction(): void
|
||||
{
|
||||
if (isset($this->sheetViewXml['rightToLeft'])) {
|
||||
$this->worksheet->setRightToLeft(
|
||||
|
@ -93,7 +94,7 @@ class SheetViews extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function showZeros()
|
||||
private function showZeros(): void
|
||||
{
|
||||
if (isset($this->sheetViewXml['showZeros'])) {
|
||||
$this->worksheet->getSheetView()->setShowZeros(
|
||||
|
@ -102,7 +103,7 @@ class SheetViews extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function pane()
|
||||
private function pane(): void
|
||||
{
|
||||
$xSplit = 0;
|
||||
$ySplit = 0;
|
||||
|
@ -126,7 +127,7 @@ class SheetViews extends BaseParserClass
|
|||
);
|
||||
}
|
||||
|
||||
private function selection()
|
||||
private function selection(): void
|
||||
{
|
||||
$sqref = (string) $this->sheetViewXml->selection['sqref'];
|
||||
$sqref = explode(' ', $sqref);
|
||||
|
|
|
@ -11,6 +11,7 @@ use PhpOffice\PhpSpreadsheet\Style\Font;
|
|||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Protection;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Style;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class Styles extends BaseParserClass
|
||||
{
|
||||
|
@ -27,19 +28,19 @@ class Styles extends BaseParserClass
|
|||
|
||||
private $styleXml;
|
||||
|
||||
public function __construct(\SimpleXMLElement $styleXml)
|
||||
public function __construct(SimpleXMLElement $styleXml)
|
||||
{
|
||||
$this->styleXml = $styleXml;
|
||||
}
|
||||
|
||||
public function setStyleBaseData(Theme $theme = null, $styles = [], $cellStyles = [])
|
||||
public function setStyleBaseData(?Theme $theme = null, $styles = [], $cellStyles = []): void
|
||||
{
|
||||
self::$theme = $theme;
|
||||
$this->styles = $styles;
|
||||
$this->cellStyles = $cellStyles;
|
||||
}
|
||||
|
||||
private static function readFontStyle(Font $fontStyle, \SimpleXMLElement $fontStyleXml)
|
||||
private static function readFontStyle(Font $fontStyle, SimpleXMLElement $fontStyleXml): void
|
||||
{
|
||||
$fontStyle->setName((string) $fontStyleXml->name['val']);
|
||||
$fontStyle->setSize((float) $fontStyleXml->sz['val']);
|
||||
|
@ -72,7 +73,7 @@ class Styles extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private static function readNumberFormat(NumberFormat $numfmtStyle, \SimpleXMLElement $numfmtStyleXml)
|
||||
private static function readNumberFormat(NumberFormat $numfmtStyle, SimpleXMLElement $numfmtStyleXml): void
|
||||
{
|
||||
if ($numfmtStyleXml->count() === 0) {
|
||||
return;
|
||||
|
@ -83,10 +84,10 @@ class Styles extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private static function readFillStyle(Fill $fillStyle, \SimpleXMLElement $fillStyleXml)
|
||||
private static function readFillStyle(Fill $fillStyle, SimpleXMLElement $fillStyleXml): void
|
||||
{
|
||||
if ($fillStyleXml->gradientFill) {
|
||||
/** @var \SimpleXMLElement $gradientFill */
|
||||
/** @var SimpleXMLElement $gradientFill */
|
||||
$gradientFill = $fillStyleXml->gradientFill[0];
|
||||
if (!empty($gradientFill['type'])) {
|
||||
$fillStyle->setFillType((string) $gradientFill['type']);
|
||||
|
@ -109,7 +110,7 @@ class Styles extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private static function readBorderStyle(Borders $borderStyle, \SimpleXMLElement $borderStyleXml)
|
||||
private static function readBorderStyle(Borders $borderStyle, SimpleXMLElement $borderStyleXml): void
|
||||
{
|
||||
$diagonalUp = self::boolean((string) $borderStyleXml['diagonalUp']);
|
||||
$diagonalDown = self::boolean((string) $borderStyleXml['diagonalDown']);
|
||||
|
@ -130,7 +131,7 @@ class Styles extends BaseParserClass
|
|||
self::readBorder($borderStyle->getDiagonal(), $borderStyleXml->diagonal);
|
||||
}
|
||||
|
||||
private static function readBorder(Border $border, \SimpleXMLElement $borderXml)
|
||||
private static function readBorder(Border $border, SimpleXMLElement $borderXml): void
|
||||
{
|
||||
if (isset($borderXml['style'])) {
|
||||
$border->setBorderStyle((string) $borderXml['style']);
|
||||
|
@ -140,7 +141,7 @@ class Styles extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private static function readAlignmentStyle(Alignment $alignment, \SimpleXMLElement $alignmentXml)
|
||||
private static function readAlignmentStyle(Alignment $alignment, SimpleXMLElement $alignmentXml): void
|
||||
{
|
||||
$alignment->setHorizontal((string) $alignmentXml->alignment['horizontal']);
|
||||
$alignment->setVertical((string) $alignmentXml->alignment['vertical']);
|
||||
|
@ -159,9 +160,9 @@ class Styles extends BaseParserClass
|
|||
$alignment->setReadOrder((int) ((string) $alignmentXml->alignment['readingOrder']) > 0 ? (int) ((string) $alignmentXml->alignment['readingOrder']) : 0);
|
||||
}
|
||||
|
||||
private function readStyle(Style $docStyle, $style)
|
||||
private function readStyle(Style $docStyle, $style): void
|
||||
{
|
||||
if ($style->numFmt instanceof \SimpleXMLElement) {
|
||||
if ($style->numFmt instanceof SimpleXMLElement) {
|
||||
self::readNumberFormat($docStyle->getNumberFormat(), $style->numFmt);
|
||||
} else {
|
||||
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
||||
|
@ -195,7 +196,7 @@ class Styles extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function readProtectionLocked(Style $docStyle, $style)
|
||||
private function readProtectionLocked(Style $docStyle, $style): void
|
||||
{
|
||||
if (isset($style->protection['locked'])) {
|
||||
if (self::boolean((string) $style->protection['locked'])) {
|
||||
|
@ -206,7 +207,7 @@ class Styles extends BaseParserClass
|
|||
}
|
||||
}
|
||||
|
||||
private function readProtectionHidden(Style $docStyle, $style)
|
||||
private function readProtectionHidden(Style $docStyle, $style): void
|
||||
{
|
||||
if (isset($style->protection['hidden'])) {
|
||||
if (self::boolean((string) $style->protection['hidden'])) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class Xml extends BaseReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
*
|
||||
* @return false|\SimpleXMLElement
|
||||
* @return false|SimpleXMLElement
|
||||
*/
|
||||
public function trySimpleXMLLoadString($pFilename)
|
||||
{
|
||||
|
@ -288,7 +288,6 @@ class Xml extends BaseReader
|
|||
* Loads from file into Spreadsheet instance.
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param Spreadsheet $spreadsheet
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*/
|
||||
|
@ -653,11 +652,7 @@ class Xml extends BaseReader
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SimpleXMLElement $xml
|
||||
* @param array $namespaces
|
||||
*/
|
||||
private function parseStyles(SimpleXMLElement $xml, array $namespaces)
|
||||
private function parseStyles(SimpleXMLElement $xml, array $namespaces): void
|
||||
{
|
||||
if (!isset($xml->Styles)) {
|
||||
return;
|
||||
|
@ -697,9 +692,8 @@ class Xml extends BaseReader
|
|||
|
||||
/**
|
||||
* @param string $styleID
|
||||
* @param SimpleXMLElement $styleAttributes
|
||||
*/
|
||||
private function parseStyleAlignment($styleID, SimpleXMLElement $styleAttributes)
|
||||
private function parseStyleAlignment($styleID, SimpleXMLElement $styleAttributes): void
|
||||
{
|
||||
$verticalAlignmentStyles = [
|
||||
Alignment::VERTICAL_BOTTOM,
|
||||
|
@ -741,10 +735,8 @@ class Xml extends BaseReader
|
|||
|
||||
/**
|
||||
* @param $styleID
|
||||
* @param SimpleXMLElement $styleData
|
||||
* @param array $namespaces
|
||||
*/
|
||||
private function parseStyleBorders($styleID, SimpleXMLElement $styleData, array $namespaces)
|
||||
private function parseStyleBorders($styleID, SimpleXMLElement $styleData, array $namespaces): void
|
||||
{
|
||||
foreach ($styleData->Border as $borderStyle) {
|
||||
$borderAttributes = $borderStyle->attributes($namespaces['ss']);
|
||||
|
@ -778,9 +770,8 @@ class Xml extends BaseReader
|
|||
|
||||
/**
|
||||
* @param $styleID
|
||||
* @param SimpleXMLElement $styleAttributes
|
||||
*/
|
||||
private function parseStyleFont($styleID, SimpleXMLElement $styleAttributes)
|
||||
private function parseStyleFont($styleID, SimpleXMLElement $styleAttributes): void
|
||||
{
|
||||
$underlineStyles = [
|
||||
Font::UNDERLINE_NONE,
|
||||
|
@ -825,9 +816,8 @@ class Xml extends BaseReader
|
|||
|
||||
/**
|
||||
* @param $styleID
|
||||
* @param SimpleXMLElement $styleAttributes
|
||||
*/
|
||||
private function parseStyleInterior($styleID, SimpleXMLElement $styleAttributes)
|
||||
private function parseStyleInterior($styleID, SimpleXMLElement $styleAttributes): void
|
||||
{
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
switch ($styleAttributeKey) {
|
||||
|
@ -845,9 +835,8 @@ class Xml extends BaseReader
|
|||
|
||||
/**
|
||||
* @param $styleID
|
||||
* @param SimpleXMLElement $styleAttributes
|
||||
*/
|
||||
private function parseStyleNumberFormat($styleID, SimpleXMLElement $styleAttributes)
|
||||
private function parseStyleNumberFormat($styleID, SimpleXMLElement $styleAttributes): void
|
||||
{
|
||||
$fromFormats = ['\-', '\ '];
|
||||
$toFormats = ['-', ' '];
|
||||
|
|
|
@ -152,7 +152,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustPageBreaks(Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustPageBreaks(Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aBreaks = $pSheet->getBreaks();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
|
@ -185,7 +185,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aComments = $pSheet->getComments();
|
||||
$aNewComments = []; // the new array of all comments
|
||||
|
@ -212,7 +212,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
|
@ -237,7 +237,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aDataValidationCollection = $pSheet->getDataValidationCollection();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
|
@ -262,7 +262,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aMergeCells = $pSheet->getMergeCells();
|
||||
$aNewMergeCells = []; // the new array of all merge cells
|
||||
|
@ -283,7 +283,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aProtectedCells = $pSheet->getProtectedCells();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
|
@ -307,7 +307,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
|
||||
if (!empty($aColumnDimensions)) {
|
||||
|
@ -332,7 +332,7 @@ class ReferenceHelper
|
|||
* @param int $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows): void
|
||||
{
|
||||
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
|
||||
if (!empty($aRowDimensions)) {
|
||||
|
@ -364,7 +364,7 @@ class ReferenceHelper
|
|||
* @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
* @param Worksheet $pSheet The worksheet that we're editing
|
||||
*/
|
||||
public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pSheet)
|
||||
public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pSheet): void
|
||||
{
|
||||
$remove = ($pNumCols < 0 || $pNumRows < 0);
|
||||
$allCoordinates = $pSheet->getCoordinates();
|
||||
|
@ -789,7 +789,7 @@ class ReferenceHelper
|
|||
* @param string $oldName Old name (name to replace)
|
||||
* @param string $newName New name
|
||||
*/
|
||||
public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $newName = '')
|
||||
public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $newName = ''): void
|
||||
{
|
||||
if ($oldName == '') {
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@ class RichText implements IComparable
|
|||
*
|
||||
* @param Cell $pCell
|
||||
*/
|
||||
public function __construct(Cell $pCell = null)
|
||||
public function __construct(?Cell $pCell = null)
|
||||
{
|
||||
// Initialise variables
|
||||
$this->richTextElements = [];
|
||||
|
|
|
@ -42,7 +42,7 @@ class Run extends TextElement implements ITextElement
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFont(Font $pFont = null)
|
||||
public function setFont(?Font $pFont = null)
|
||||
{
|
||||
$this->font = $pFont;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class Settings
|
|||
* @param string $rendererClass Class name of the chart renderer
|
||||
* eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph
|
||||
*/
|
||||
public static function setChartRenderer($rendererClass)
|
||||
public static function setChartRenderer($rendererClass): void
|
||||
{
|
||||
if (!is_a($rendererClass, IRenderer::class, true)) {
|
||||
throw new Exception('Chart renderer must implement ' . IRenderer::class);
|
||||
|
@ -85,7 +85,7 @@ class Settings
|
|||
*
|
||||
* @param int $options Default options for libxml loader
|
||||
*/
|
||||
public static function setLibXmlLoaderOptions($options)
|
||||
public static function setLibXmlLoaderOptions($options): void
|
||||
{
|
||||
if ($options === null && defined('LIBXML_DTDLOAD')) {
|
||||
$options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
|
||||
|
@ -120,7 +120,7 @@ class Settings
|
|||
*
|
||||
* @param bool $state
|
||||
*/
|
||||
public static function setLibXmlDisableEntityLoader($state)
|
||||
public static function setLibXmlDisableEntityLoader($state): void
|
||||
{
|
||||
self::$libXmlDisableEntityLoader = (bool) $state;
|
||||
}
|
||||
|
@ -137,10 +137,8 @@ class Settings
|
|||
|
||||
/**
|
||||
* Sets the implementation of cache that should be used for cell collection.
|
||||
*
|
||||
* @param CacheInterface $cache
|
||||
*/
|
||||
public static function setCache(CacheInterface $cache)
|
||||
public static function setCache(CacheInterface $cache): void
|
||||
{
|
||||
self::$cache = $cache;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared;
|
|||
|
||||
use DateTimeInterface;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\DateTime;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
|
@ -57,7 +58,7 @@ class Date
|
|||
/**
|
||||
* Default timezone to use for DateTime objects.
|
||||
*
|
||||
* @var null|\DateTimeZone
|
||||
* @var null|DateTimeZone
|
||||
*/
|
||||
protected static $defaultTimeZone;
|
||||
|
||||
|
@ -139,7 +140,7 @@ class Date
|
|||
return new DateTimeZone($timeZone);
|
||||
}
|
||||
|
||||
throw new \Exception('Invalid timezone');
|
||||
throw new Exception('Invalid timezone');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -311,8 +312,6 @@ class Date
|
|||
/**
|
||||
* Is a given cell a date/time?
|
||||
*
|
||||
* @param Cell $pCell
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDateTime(Cell $pCell)
|
||||
|
@ -328,8 +327,6 @@ class Date
|
|||
/**
|
||||
* Is a given number format a date/time?
|
||||
*
|
||||
* @param NumberFormat $pFormat
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDateTimeFormat(NumberFormat $pFormat)
|
||||
|
|
|
@ -25,7 +25,7 @@ class DgContainer
|
|||
return $this->dgId;
|
||||
}
|
||||
|
||||
public function setDgId($value)
|
||||
public function setDgId($value): void
|
||||
{
|
||||
$this->dgId = $value;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class DgContainer
|
|||
return $this->lastSpId;
|
||||
}
|
||||
|
||||
public function setLastSpId($value)
|
||||
public function setLastSpId($value): void
|
||||
{
|
||||
$this->lastSpId = $value;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class SpgrContainer
|
|||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer $parent
|
||||
*/
|
||||
public function setParent($parent)
|
||||
public function setParent($parent): void
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class SpgrContainer
|
|||
*
|
||||
* @param mixed $child
|
||||
*/
|
||||
public function addChild($child)
|
||||
public function addChild($child): void
|
||||
{
|
||||
$this->children[] = $child;
|
||||
$child->setParent($this);
|
||||
|
|
|
@ -95,7 +95,7 @@ class SpContainer
|
|||
*
|
||||
* @param SpgrContainer $parent
|
||||
*/
|
||||
public function setParent($parent)
|
||||
public function setParent($parent): void
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class SpContainer
|
|||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setSpgr($value)
|
||||
public function setSpgr($value): void
|
||||
{
|
||||
$this->spgr = $value;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $value
|
||||
*/
|
||||
public function setSpType($value)
|
||||
public function setSpType($value): void
|
||||
{
|
||||
$this->spType = $value;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $value
|
||||
*/
|
||||
public function setSpFlag($value)
|
||||
public function setSpFlag($value): void
|
||||
{
|
||||
$this->spFlag = $value;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $value
|
||||
*/
|
||||
public function setSpId($value)
|
||||
public function setSpId($value): void
|
||||
{
|
||||
$this->spId = $value;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class SpContainer
|
|||
* @param int $property The number specifies the option
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setOPT($property, $value)
|
||||
public function setOPT($property, $value): void
|
||||
{
|
||||
$this->OPT[$property] = $value;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ class SpContainer
|
|||
*
|
||||
* @param string $value eg: 'A1'
|
||||
*/
|
||||
public function setStartCoordinates($value)
|
||||
public function setStartCoordinates($value): void
|
||||
{
|
||||
$this->startCoordinates = $value;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $startOffsetX
|
||||
*/
|
||||
public function setStartOffsetX($startOffsetX)
|
||||
public function setStartOffsetX($startOffsetX): void
|
||||
{
|
||||
$this->startOffsetX = $startOffsetX;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $startOffsetY
|
||||
*/
|
||||
public function setStartOffsetY($startOffsetY)
|
||||
public function setStartOffsetY($startOffsetY): void
|
||||
{
|
||||
$this->startOffsetY = $startOffsetY;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ class SpContainer
|
|||
*
|
||||
* @param string $value eg: 'A1'
|
||||
*/
|
||||
public function setEndCoordinates($value)
|
||||
public function setEndCoordinates($value): void
|
||||
{
|
||||
$this->endCoordinates = $value;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $endOffsetX
|
||||
*/
|
||||
public function setEndOffsetX($endOffsetX)
|
||||
public function setEndOffsetX($endOffsetX): void
|
||||
{
|
||||
$this->endOffsetX = $endOffsetX;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ class SpContainer
|
|||
*
|
||||
* @param int $endOffsetY
|
||||
*/
|
||||
public function setEndOffsetY($endOffsetY)
|
||||
public function setEndOffsetY($endOffsetY): void
|
||||
{
|
||||
$this->endOffsetY = $endOffsetY;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class DggContainer
|
|||
*
|
||||
* @param int $value
|
||||
*/
|
||||
public function setSpIdMax($value)
|
||||
public function setSpIdMax($value): void
|
||||
{
|
||||
$this->spIdMax = $value;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class DggContainer
|
|||
*
|
||||
* @param int $value
|
||||
*/
|
||||
public function setCDgSaved($value)
|
||||
public function setCDgSaved($value): void
|
||||
{
|
||||
$this->cDgSaved = $value;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class DggContainer
|
|||
*
|
||||
* @param int $value
|
||||
*/
|
||||
public function setCSpSaved($value)
|
||||
public function setCSpSaved($value): void
|
||||
{
|
||||
$this->cSpSaved = $value;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class DggContainer
|
|||
*
|
||||
* @param DggContainer\BstoreContainer $bstoreContainer
|
||||
*/
|
||||
public function setBstoreContainer($bstoreContainer)
|
||||
public function setBstoreContainer($bstoreContainer): void
|
||||
{
|
||||
$this->bstoreContainer = $bstoreContainer;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class DggContainer
|
|||
* @param int $property The number specifies the option
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setOPT($property, $value)
|
||||
public function setOPT($property, $value): void
|
||||
{
|
||||
$this->OPT[$property] = $value;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class DggContainer
|
|||
*
|
||||
* @param array $pValue
|
||||
*/
|
||||
public function setIDCLs($pValue)
|
||||
public function setIDCLs($pValue): void
|
||||
{
|
||||
$this->IDCLs = $pValue;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class BstoreContainer
|
|||
*
|
||||
* @param BstoreContainer\BSE $BSE
|
||||
*/
|
||||
public function addBSE($BSE)
|
||||
public function addBSE($BSE): void
|
||||
{
|
||||
$this->BSECollection[] = $BSE;
|
||||
$BSE->setParent($this);
|
||||
|
|
|
@ -41,7 +41,7 @@ class BSE
|
|||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer $parent
|
||||
*/
|
||||
public function setParent($parent)
|
||||
public function setParent($parent): void
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class BSE
|
|||
*
|
||||
* @param BSE\Blip $blip
|
||||
*/
|
||||
public function setBlip($blip)
|
||||
public function setBlip($blip): void
|
||||
{
|
||||
$this->blip = $blip;
|
||||
$blip->setParent($this);
|
||||
|
@ -82,7 +82,7 @@ class BSE
|
|||
*
|
||||
* @param int $blipType
|
||||
*/
|
||||
public function setBlipType($blipType)
|
||||
public function setBlipType($blipType): void
|
||||
{
|
||||
$this->blipType = $blipType;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class Blip
|
|||
*
|
||||
* @param string $data
|
||||
*/
|
||||
public function setData($data)
|
||||
public function setData($data): void
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class Blip
|
|||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE $parent
|
||||
*/
|
||||
public function setParent($parent)
|
||||
public function setParent($parent): void
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class File
|
|||
*
|
||||
* @param bool $useUploadTempDir Use File Upload Temporary directory (true or false)
|
||||
*/
|
||||
public static function setUseUploadTempDirectory($useUploadTempDir)
|
||||
public static function setUseUploadTempDirectory($useUploadTempDir): void
|
||||
{
|
||||
self::$useUploadTempDirectory = (bool) $useUploadTempDir;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ class File
|
|||
*
|
||||
* @param string $filename
|
||||
*/
|
||||
public static function assertFile($filename)
|
||||
public static function assertFile($filename): void
|
||||
{
|
||||
if (!is_file($filename)) {
|
||||
throw new InvalidArgumentException('File "' . $filename . '" does not exist.');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue