From c96e2dae02b49d1bc56970d4c44161a57ec3f303 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 28 Jan 2018 15:59:38 +0900 Subject: [PATCH] Update to PHP-CS-Fixer 2.10 --- .php_cs.dist | 328 +++++++++--------- composer.json | 4 +- composer.lock | 322 ++++++++--------- samples/Autofilter/10_Autofilter.php | 18 +- .../Autofilter/10_Autofilter_selection_1.php | 82 ++--- .../Autofilter/10_Autofilter_selection_2.php | 78 ++--- .../10_Autofilter_selection_display.php | 82 ++--- samples/Basic/01_Simple.php | 56 +-- samples/Basic/01_Simple_download_ods.php | 24 +- samples/Basic/01_Simple_download_pdf.php | 24 +- samples/Basic/01_Simple_download_xls.php | 24 +- samples/Basic/01_Simple_download_xlsx.php | 24 +- samples/Basic/02_Types.php | 140 ++++---- samples/Basic/03_Formulas.php | 52 +-- samples/Basic/04_Printing.php | 32 +- samples/Basic/08_Conditional_formatting.php | 40 +-- samples/Basic/08_Conditional_formatting_2.php | 44 +-- samples/Basic/09_Pagebreaks.php | 28 +- samples/Basic/11_Documentsecurity.php | 12 +- samples/Basic/12_CellProtection.php | 20 +- .../Basic/13_CalculationCyclicFormulae.php | 6 +- samples/Basic/15_Datavalidation.php | 34 +- samples/Basic/16_Csv.php | 8 +- samples/Basic/19_Namedrange.php | 32 +- samples/Basic/22_Heavily_formatted.php | 12 +- samples/Basic/23_Sharedstyles.php | 12 +- samples/Basic/25_In_memory_image.php | 12 +- samples/Basic/29_Advanced_value_binder.php | 68 ++-- samples/Basic/30_Template.php | 8 +- .../Basic/31_Document_properties_write.php | 6 +- .../31_Document_properties_write_xls.php | 6 +- samples/Basic/37_Page_layout_view.php | 16 +- samples/Basic/38_Clone_worksheet.php | 32 +- samples/Basic/39_Dropdown.php | 92 ++--- samples/Basic/42_RichText.php | 46 +-- ...eader_using_a_configurable_read_filter.php | 2 + ...a_configurable_read_filter_(version_1).php | 1 + ...a_configurable_read_filter_(version_2).php | 1 + ...ks_to_split_across_multiple_worksheets.php | 1 + samples/templates/largeSpreadsheet.php | 24 +- samples/templates/sampleSpreadsheet.php | 12 +- .../Calculation/Calculation.php | 9 +- src/PhpSpreadsheet/Calculation/Financial.php | 2 +- .../Calculation/FormulaParser.php | 2 +- src/PhpSpreadsheet/Calculation/Functions.php | 2 +- .../Calculation/Statistical.php | 7 +- src/PhpSpreadsheet/Cell/Cell.php | 3 +- src/PhpSpreadsheet/Cell/Coordinate.php | 2 +- src/PhpSpreadsheet/Chart/GridLines.php | 6 +- src/PhpSpreadsheet/Document/Properties.php | 15 + src/PhpSpreadsheet/Helper/Html.php | 7 + src/PhpSpreadsheet/Reader/Html.php | 2 + src/PhpSpreadsheet/Reader/Ods.php | 2 +- src/PhpSpreadsheet/Reader/Slk.php | 2 +- src/PhpSpreadsheet/Reader/Xls.php | 10 +- src/PhpSpreadsheet/Reader/Xls/MD5.php | 3 + src/PhpSpreadsheet/Reader/Xls/RC4.php | 2 + src/PhpSpreadsheet/ReferenceHelper.php | 2 +- src/PhpSpreadsheet/Shared/Font.php | 1 + .../Shared/JAMA/EigenvalueDecomposition.php | 6 +- src/PhpSpreadsheet/Shared/JAMA/Matrix.php | 19 + src/PhpSpreadsheet/Shared/OLERead.php | 2 + src/PhpSpreadsheet/Shared/Trend/BestFit.php | 14 +- .../Shared/Trend/ExponentialBestFit.php | 12 +- .../Shared/Trend/LinearBestFit.php | 8 +- .../Shared/Trend/LogarithmicBestFit.php | 8 +- .../Shared/Trend/PolynomialBestFit.php | 14 +- .../Shared/Trend/PowerBestFit.php | 10 +- src/PhpSpreadsheet/Shared/Trend/Trend.php | 6 +- src/PhpSpreadsheet/Spreadsheet.php | 2 + src/PhpSpreadsheet/Style/Border.php | 1 + src/PhpSpreadsheet/Style/NumberFormat.php | 6 +- src/PhpSpreadsheet/Worksheet/AutoFilter.php | 1 + src/PhpSpreadsheet/Worksheet/BaseDrawing.php | 2 +- src/PhpSpreadsheet/Writer/Ods/Content.php | 2 + src/PhpSpreadsheet/Writer/Xls/Parser.php | 69 ++-- src/PhpSpreadsheet/Writer/Xls/Workbook.php | 4 +- src/PhpSpreadsheet/Writer/Xls/Worksheet.php | 6 +- .../Cell/CoordinateTest.php | 5 +- .../Collection/CellsTest.php | 10 +- tests/PhpSpreadsheetTests/Custom/Complex.php | 2 + tests/PhpSpreadsheetTests/IOFactoryTest.php | 20 +- tests/PhpSpreadsheetTests/Reader/XmlTest.php | 6 +- .../Worksheet/AutoFilter/Column/RuleTest.php | 1 + .../Worksheet/AutoFilter/ColumnTest.php | 12 +- .../Worksheet/AutoFilterTest.php | 33 +- .../Worksheet/ColumnCellIteratorTest.php | 11 +- .../Worksheet/ColumnIteratorTest.php | 11 +- .../Worksheet/ColumnTest.php | 1 + .../Worksheet/RowCellIteratorTest.php | 11 +- .../Worksheet/RowIteratorTest.php | 11 +- .../PhpSpreadsheetTests/Worksheet/RowTest.php | 1 + 92 files changed, 1159 insertions(+), 1112 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 9467d869..5a494b87 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -7,161 +7,175 @@ $finder = PhpCsFixer\Finder::create() ->in('tests'); return PhpCsFixer\Config::create() - ->setRiskyAllowed(true) - ->setFinder($finder) - ->setRules([ - 'align_multiline_comment' => true, - 'array_syntax' => ['syntax' => 'short'], - 'binary_operator_spaces' => true, - 'blank_line_after_namespace' => true, - 'blank_line_after_opening_tag' => true, - 'blank_line_before_return' => true, - 'blank_line_before_statement' => true, - 'braces' => true, - 'cast_spaces' => true, - 'class_definition' => true, - 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => true, - 'declare_strict_types' => false, // Too early to adopt strict types - 'dir_constant' => true, - 'doctrine_annotation_array_assignment' => true, - 'doctrine_annotation_braces' => true, - 'doctrine_annotation_indentation' => true, - 'doctrine_annotation_spaces' => true, - 'elseif' => true, - 'encoding' => true, - 'ereg_to_preg' => true, - 'full_opening_tag' => 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, - 'header_comment' => false, // We don't use common header in all our files - 'heredoc_to_nowdoc' => false, // Not sure about this one - 'include' => true, - 'indentation_type' => true, - 'is_null' => ['use_yoda_style' => false], - 'linebreak_after_opening_tag' => true, - 'line_ending' => true, - 'list_syntax' => ['syntax' => 'long'], // Stay compatiblew with PHP 5.6 - 'lowercase_cast' => true, - 'lowercase_constants' => true, - 'lowercase_keywords' => true, - 'magic_constant_casing' => true, - 'mb_str_functions' => false, // No, too dangerous to change that - 'method_argument_space' => true, - 'method_separation' => true, - 'modernize_types_casting' => true, - '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 - 'new_with_braces' => true, - 'no_alias_functions' => 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 - 'no_break_comment' => true, - 'no_closing_tag' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'], - '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_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, - 'no_spaces_after_function_name' => true, - '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_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_trailing_whitespace' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unneeded_curly_braces' => true, - 'no_unneeded_final_method' => true, - 'no_unreachable_default_argument_value' => 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, - 'object_operator_without_whitespace' => true, - 'ordered_class_elements' => false, // We prefer to keep some freedom - 'ordered_imports' => true, - '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_no_access' => true, - 'phpdoc_no_alias_tag' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_no_package' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_return_self_reference' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => true, - 'phpdoc_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types_order' => true, - 'phpdoc_types' => true, - 'phpdoc_var_without_name' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => true, - 'php_unit_fqcn_annotation' => true, - 'php_unit_strict' => false, // We sometime actually need assertEquals - 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage - 'pow_to_exponentiation' => false, - 'pre_increment' => true, - 'protected_to_private' => true, - 'psr0' => true, - 'psr4' => true, - 'random_api_migration' => false, // This breaks our unit tests - 'return_type_declaration' => true, - 'self_accessor' => true, - 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` - 'short_scalar_cast' => true, - 'silenced_deprecation_error' => true, - 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null - '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_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'strict_comparison' => false, // No, too dangerous to change that - 'strict_param' => false, // No, too dangerous to change that - 'switch_case_semicolon_to_colon' => true, - 'switch_case_space' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6 - 'trailing_comma_in_multiline_array' => true, - 'trim_array_spaces' => true, - 'unary_operator_spaces' => true, - 'visibility_required' => true, - 'void_return' => false, // Cannot use that with PHP 5.6 - 'whitespace_after_comma_in_array' => true, - 'yoda_style' => false, + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setRules([ + 'align_multiline_comment' => 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_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 + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => true, + 'declare_strict_types' => false, // Too early to adopt strict types + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => true, + 'doctrine_annotation_braces' => true, + 'doctrine_annotation_indentation' => true, + 'doctrine_annotation_spaces' => true, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => 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_internal_class' => true, + 'full_opening_tag' => 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, + 'header_comment' => false, // We don't use common header in all our files + 'heredoc_to_nowdoc' => false, // Not sure about this one + 'include' => true, + 'increment_style' => true, + 'indentation_type' => true, + 'is_null' => ['use_yoda_style' => false], + 'linebreak_after_opening_tag' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'long'], // Stay compatiblew with PHP 5.6 + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'magic_constant_casing' => true, + 'mb_str_functions' => false, // No, too dangerous to change that + 'method_argument_space' => true, + 'method_chaining_indentation' => true, + 'method_separation' => true, + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + '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 + 'new_with_braces' => true, + 'no_alias_functions' => 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 + 'no_break_comment' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + '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_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, + 'no_spaces_after_function_name' => true, + '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_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_trailing_whitespace' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => 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, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => false, // We prefer to keep some freedom + 'ordered_imports' => true, + '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_no_access' => true, + 'phpdoc_no_alias_tag' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_types_order' => true, + 'phpdoc_types' => 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, + 'protected_to_private' => true, + 'psr0' => true, + 'psr4' => true, + 'random_api_migration' => false, // This breaks our unit tests + 'return_type_declaration' => true, + 'self_accessor' => true, + 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` + 'short_scalar_cast' => true, + 'silenced_deprecation_error' => true, + 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null + '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_quote' => true, + 'space_after_semicolon' => 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 + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6 + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'void_return' => false, // Cannot use that with PHP 5.6 + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => false, ]); diff --git a/composer.json b/composer.json index f30c4648..4bc30dbb 100644 --- a/composer.json +++ b/composer.json @@ -54,8 +54,8 @@ "phpunit/phpunit": "^5.7", "dompdf/dompdf": "^0.8.0", "mpdf/mpdf": "^7.0.0", - "friendsofphp/php-cs-fixer": "^2.7", - "jpgraph/jpgraph": "^4.0" + "jpgraph/jpgraph": "^4.0", + "friendsofphp/php-cs-fixer": "@stable" }, "suggest": { "ext-gd": "Required for exact column width autocalculation", diff --git a/composer.lock b/composer.lock index b7319bd8..29914657 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "804bbe054403d6532308f8a65f19adc2", + "content-hash": "e61a906bd83393400add286703f10557", "packages": [ { "name": "psr/simple-cache", @@ -120,30 +120,30 @@ }, { "name": "doctrine/annotations", - "version": "v1.4.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -184,7 +184,7 @@ "docblock", "parser" ], - "time": "2017-02-24T16:22:25+00:00" + "time": "2017-12-06T07:11:42+00:00" }, { "name": "doctrine/instantiator", @@ -358,16 +358,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.7.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "e4e93a120117e879cfc1f231fbf29274707cd834" + "reference": "513a3765b56dd029175f9f32995566657ee89dda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/e4e93a120117e879cfc1f231fbf29274707cd834", - "reference": "e4e93a120117e879cfc1f231fbf29274707cd834", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/513a3765b56dd029175f9f32995566657ee89dda", + "reference": "513a3765b56dd029175f9f32995566657ee89dda", "shasum": "" }, "require": { @@ -375,29 +375,32 @@ "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", - "gecko-packages/gecko-php-unit": "^2.0", + "gecko-packages/gecko-php-unit": "^2.0 || ^3.0", "php": "^5.6 || >=7.0 <7.3", - "php-cs-fixer/diff": "^1.0", - "symfony/console": "^3.2", - "symfony/event-dispatcher": "^3.0", - "symfony/filesystem": "^3.0", - "symfony/finder": "^3.0", - "symfony/options-resolver": "^3.0", + "php-cs-fixer/diff": "^1.2", + "symfony/console": "^3.2 || ^4.0", + "symfony/event-dispatcher": "^3.0 || ^4.0", + "symfony/filesystem": "^3.0 || ^4.0", + "symfony/finder": "^3.0 || ^4.0", + "symfony/options-resolver": "^3.0 || ^4.0", "symfony/polyfill-php70": "^1.0", "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0", - "symfony/stopwatch": "^3.0" + "symfony/process": "^3.0 || ^4.0", + "symfony/stopwatch": "^3.0 || ^4.0" }, "conflict": { "hhvm": "*" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1", + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev", "justinrainbow/json-schema": "^5.0", + "keradus/cli-executor": "^1.0", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.0", "php-cs-fixer/accessible-object": "^1.0", - "phpunit/phpunit": "^4.8.35 || ^5.4.3", - "satooshi/php-coveralls": "^1.0", - "symfony/phpunit-bridge": "^3.2.2" + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "phpunitgoodpractices/traits": "^1.0", + "symfony/phpunit-bridge": "^3.2.2 || ^4.0" }, "suggest": { "ext-mbstring": "For handling non-UTF8 characters in cache signature.", @@ -409,7 +412,7 @@ "type": "application", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.10-dev" } }, "autoload": { @@ -417,11 +420,12 @@ "PhpCsFixer\\": "src/" }, "classmap": [ - "tests/Test/Assert/AssertTokensTrait.php", "tests/Test/AbstractFixerTestCase.php", "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php" + "tests/Test/IntegrationCaseFactory.php", + "tests/TestCase.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -439,27 +443,27 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-09-29T15:19:05+00:00" + "time": "2018-01-10T17:16:15+00:00" }, { "name": "gecko-packages/gecko-php-unit", - "version": "v2.2", + "version": "v3.0", "source": { "type": "git", "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", - "reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1" + "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/ab525fac9a9ffea219687f261b02008b18ebf2d1", - "reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1", + "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/6a866551dffc2154c1b091bae3a7877d39c25ca3", + "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3", "shasum": "" }, "require": { - "php": "^5.3.6 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-dom": "When testing with xml.", @@ -467,6 +471,11 @@ "phpunit/phpunit": "This is an extension for it so make sure you have it some way." }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { "psr-4": { "GeckoPackages\\PHPUnit\\": "src/PHPUnit" @@ -483,7 +492,7 @@ "filesystem", "phpunit" ], - "time": "2017-08-23T07:39:54+00:00" + "time": "2017-08-23T07:46:41+00:00" }, { "name": "ircmaxell/password-compat", @@ -800,23 +809,24 @@ }, { "name": "php-cs-fixer/diff", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4" + "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4", - "reference": "d068edadcb8f7bc2ea3d3769cdbaf609026ec4f4", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/f0ef6133d674137e902fdf8a6f2e8e97e14a087b", + "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b", "shasum": "" }, "require": { "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3" + "phpunit/phpunit": "^4.8.35 || ^5.4.3", + "symfony/process": "^3.3" }, "type": "library", "autoload": { @@ -825,9 +835,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], "authors": [ { "name": "Kore Nordmann", @@ -836,6 +843,9 @@ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "SpacePossum" } ], "description": "sebastian/diff v2 backport support for PHP5.6", @@ -843,7 +853,7 @@ "keywords": [ "diff" ], - "time": "2017-09-23T16:02:08+00:00" + "time": "2017-10-19T09:58:18+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2174,44 +2184,44 @@ }, { "name": "symfony/console", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf" + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", - "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", + "url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0", + "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2238,90 +2248,34 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-09-06T16:40:18+00:00" - }, - { - "name": "symfony/debug", - "version": "v3.3.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "8beb24eec70b345c313640962df933499373a944" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944", - "reference": "8beb24eec70b345c313640962df933499373a944", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-09-01T13:23:39+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "54ca9520a00386f83bca145819ad3b619aaa2485" + "reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54ca9520a00386f83bca145819ad3b619aaa2485", - "reference": "54ca9520a00386f83bca145819ad3b619aaa2485", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74d33aac36208c4d6757807d9f598f0133a3a4eb", + "reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2330,7 +2284,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2357,29 +2311,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/filesystem", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb" + "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b32a0e5f928d0fa3d1dd03c78d020777e50c10cb", - "reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/760e47a4ee64b4c48f4b30017011e09d4c0f05ed", + "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2406,29 +2360,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/finder", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e" + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", - "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", + "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2455,29 +2409,29 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/options-resolver", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6" + "reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ee4e22978fe885b54ee5da8c7964f0a5301abfb6", - "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/30d9240b30696a69e893534c9fc4a5c72ab6689b", + "reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2509,20 +2463,20 @@ "configuration", "options" ], - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -2534,7 +2488,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -2568,7 +2522,7 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/polyfill-php54", @@ -2686,16 +2640,16 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "b6482e68974486984f59449ecea1fbbb22ff840f" + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/b6482e68974486984f59449ecea1fbbb22ff840f", - "reference": "b6482e68974486984f59449ecea1fbbb22ff840f", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", "shasum": "" }, "require": { @@ -2705,7 +2659,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -2741,20 +2695,20 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "8abc9097f5001d310f0edba727469c988acc6ea7" + "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8abc9097f5001d310f0edba727469c988acc6ea7", - "reference": "8abc9097f5001d310f0edba727469c988acc6ea7", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/6de4f4884b97abbbed9f0a84a95ff2ff77254254", + "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254", "shasum": "" }, "require": { @@ -2763,7 +2717,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -2796,7 +2750,7 @@ "portable", "shim" ], - "time": "2017-07-11T13:25:55+00:00" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/polyfill-xml", @@ -2858,25 +2812,25 @@ }, { "name": "symfony/process", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" + "reference": "2145b3e8137e463b1051b79440a59b38220944f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "url": "https://api.github.com/repos/symfony/process/zipball/2145b3e8137e463b1051b79440a59b38220944f0", + "reference": "2145b3e8137e463b1051b79440a59b38220944f0", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2903,29 +2857,29 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.3.9", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb" + "reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/9a5610a8d6a50985a7be485c0ba745c22607beeb", - "reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d52321f0e2b596bd03b5d1dd6eebe71caa925704", + "reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2952,7 +2906,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/yaml", @@ -3125,7 +3079,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "friendsofphp/php-cs-fixer": 0 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/samples/Autofilter/10_Autofilter.php b/samples/Autofilter/10_Autofilter.php index 04d176ce..db9de54a 100644 --- a/samples/Autofilter/10_Autofilter.php +++ b/samples/Autofilter/10_Autofilter.php @@ -11,20 +11,20 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Create the worksheet $helper->log('Add data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Year') - ->setCellValue('B1', 'Quarter') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Sales'); + ->setCellValue('B1', 'Quarter') + ->setCellValue('C1', 'Country') + ->setCellValue('D1', 'Sales'); $dataArray = [ ['2010', 'Q1', 'United States', 790], diff --git a/samples/Autofilter/10_Autofilter_selection_1.php b/samples/Autofilter/10_Autofilter_selection_1.php index 9bc47f8b..4f1fc486 100644 --- a/samples/Autofilter/10_Autofilter_selection_1.php +++ b/samples/Autofilter/10_Autofilter_selection_1.php @@ -15,22 +15,22 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Create the worksheet $helper->log('Add data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); + ->setCellValue('B1', 'Financial Period') + ->setCellValue('C1', 'Country') + ->setCellValue('D1', 'Date') + ->setCellValue('E1', 'Sales Value') + ->setCellValue('F1', 'Expenditure'); $startYear = $endYear = $currentYear = date('Y'); --$startYear; ++$endYear; @@ -110,47 +110,47 @@ $helper->log('Set active filters'); // Filter the Country column on a filter value of countries beginning with the letter U (or Japan) // We use * as a wildcard, so specify as U* and using a wildcard requires customFilter $autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + 'u*' + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); $autoFilter->getColumn('C') - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + 'japan' + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); // Filter the Date column on a filter value of the first day of every period of the current year // We us a dateGroup ruletype for this, although it is still a standard filter foreach ($periods as $period) { $endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear)); $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate, - ] - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) ->createRule() ->setRule( Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); + [ + 'year' => $currentYear, + 'month' => $period, + 'day' => $endDate, + ] + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); +} +// Display only sales values that are blank +// Standard filter, operator equals, and value of NULL +$autoFilter->getColumn('E') + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + '' + ); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/Autofilter/10_Autofilter_selection_2.php b/samples/Autofilter/10_Autofilter_selection_2.php index 9d0afa0f..63f11a22 100644 --- a/samples/Autofilter/10_Autofilter_selection_2.php +++ b/samples/Autofilter/10_Autofilter_selection_2.php @@ -15,22 +15,22 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Create the worksheet $helper->log('Add data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); + ->setCellValue('B1', 'Financial Period') + ->setCellValue('C1', 'Country') + ->setCellValue('D1', 'Date') + ->setCellValue('E1', 'Sales Value') + ->setCellValue('F1', 'Expenditure'); $startYear = $endYear = $currentYear = date('Y'); --$startYear; ++$endYear; @@ -110,39 +110,39 @@ $helper->log('Set active filters'); // Filter the Country column on a filter value of Germany // As it's just a simple value filter, we can use FILTERTYPE_FILTER $autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'Germany' - ); + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + 'Germany' + ); // Filter the Date column on a filter value of the year to date $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - null, - Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + null, + Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); // Display only sales values that are between 400 and 600 $autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, - 400 - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, + 400 + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); $autoFilter->getColumn('E') - ->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, - 600 - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, + 600 + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/Autofilter/10_Autofilter_selection_display.php b/samples/Autofilter/10_Autofilter_selection_display.php index 9a6e8c88..b2b77b74 100644 --- a/samples/Autofilter/10_Autofilter_selection_display.php +++ b/samples/Autofilter/10_Autofilter_selection_display.php @@ -15,22 +15,22 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Create the worksheet $helper->log('Add data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); + ->setCellValue('B1', 'Financial Period') + ->setCellValue('C1', 'Country') + ->setCellValue('D1', 'Date') + ->setCellValue('E1', 'Sales Value') + ->setCellValue('F1', 'Expenditure'); $startYear = $endYear = $currentYear = date('Y'); --$startYear; ++$endYear; @@ -110,47 +110,47 @@ $helper->log('Set active filters'); // Filter the Country column on a filter value of countries beginning with the letter U (or Japan) // We use * as a wildcard, so specify as U* and using a wildcard requires customFilter $autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + 'u*' + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); $autoFilter->getColumn('C') - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + 'japan' + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); // Filter the Date column on a filter value of the first day of every period of the current year // We us a dateGroup ruletype for this, although it is still a standard filter foreach ($periods as $period) { $endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear)); $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate, - ] - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) ->createRule() ->setRule( Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); + [ + 'year' => $currentYear, + 'month' => $period, + 'day' => $endDate, + ] + ) + ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); +} +// Display only sales values that are blank +// Standard filter, operator equals, and value of NULL +$autoFilter->getColumn('E') + ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) + ->createRule() + ->setRule( + Rule::AUTOFILTER_COLUMN_RULE_EQUAL, + '' + ); // Execute filtering $helper->log('Execute filtering'); diff --git a/samples/Basic/01_Simple.php b/samples/Basic/01_Simple.php index 02e39de0..89aca6d0 100644 --- a/samples/Basic/01_Simple.php +++ b/samples/Basic/01_Simple.php @@ -11,55 +11,55 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties() - ->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setCreator('Maarten Balliauw') + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!') + ->setCellValue('C1', 'Hello') + ->setCellValue('D2', 'world!'); // Miscellaneous glyphs, UTF-8 $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); + ->setCellValue('A4', 'Miscellaneous glyphs') + ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); $spreadsheet->getActiveSheet() - ->setCellValue('A8', "Hello\nWorld"); + ->setCellValue('A8', "Hello\nWorld"); $spreadsheet->getActiveSheet() - ->getRowDimension(8) - ->setRowHeight(-1); + ->getRowDimension(8) + ->setRowHeight(-1); $spreadsheet->getActiveSheet() - ->getStyle('A8') - ->getAlignment() - ->setWrapText(true); + ->getStyle('A8') + ->getAlignment() + ->setWrapText(true); $value = "-ValueA\n-Value B\n-Value C"; $spreadsheet->getActiveSheet() - ->setCellValue('A10', $value); + ->setCellValue('A10', $value); $spreadsheet->getActiveSheet() - ->getRowDimension(10) - ->setRowHeight(-1); + ->getRowDimension(10) + ->setRowHeight(-1); $spreadsheet->getActiveSheet() - ->getStyle('A10') - ->getAlignment() - ->setWrapText(true); + ->getStyle('A10') + ->getAlignment() + ->setWrapText(true); $spreadsheet->getActiveSheet() - ->getStyle('A10') - ->setQuotePrefix(true); + ->getStyle('A10') + ->setQuotePrefix(true); // Rename worksheet $helper->log('Rename worksheet'); $spreadsheet->getActiveSheet() - ->setTitle('Simple'); + ->setTitle('Simple'); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/Basic/01_Simple_download_ods.php b/samples/Basic/01_Simple_download_ods.php index 50a35768..0c38a004 100644 --- a/samples/Basic/01_Simple_download_ods.php +++ b/samples/Basic/01_Simple_download_ods.php @@ -18,24 +18,24 @@ $spreadsheet = new Spreadsheet(); // Set document properties $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!') + ->setCellValue('C1', 'Hello') + ->setCellValue('D2', 'world!'); // Miscellaneous glyphs, UTF-8 $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); + ->setCellValue('A4', 'Miscellaneous glyphs') + ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); // Rename worksheet $spreadsheet->getActiveSheet()->setTitle('Simple'); diff --git a/samples/Basic/01_Simple_download_pdf.php b/samples/Basic/01_Simple_download_pdf.php index 9a8507c5..5f3e71d7 100644 --- a/samples/Basic/01_Simple_download_pdf.php +++ b/samples/Basic/01_Simple_download_pdf.php @@ -18,24 +18,24 @@ $spreadsheet = new Spreadsheet(); // Set document properties $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PDF Test Document') - ->setSubject('PDF Test Document') - ->setDescription('Test document for PDF, generated using PHP classes.') - ->setKeywords('pdf php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PDF Test Document') + ->setSubject('PDF Test Document') + ->setDescription('Test document for PDF, generated using PHP classes.') + ->setKeywords('pdf php') + ->setCategory('Test result file'); // Add some data $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!') + ->setCellValue('C1', 'Hello') + ->setCellValue('D2', 'world!'); // Miscellaneous glyphs, UTF-8 $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); + ->setCellValue('A4', 'Miscellaneous glyphs') + ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); // Rename worksheet $spreadsheet->getActiveSheet()->setTitle('Simple'); diff --git a/samples/Basic/01_Simple_download_xls.php b/samples/Basic/01_Simple_download_xls.php index 94fb789e..46d12022 100644 --- a/samples/Basic/01_Simple_download_xls.php +++ b/samples/Basic/01_Simple_download_xls.php @@ -18,24 +18,24 @@ $spreadsheet = new Spreadsheet(); // Set document properties $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!') + ->setCellValue('C1', 'Hello') + ->setCellValue('D2', 'world!'); // Miscellaneous glyphs, UTF-8 $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); + ->setCellValue('A4', 'Miscellaneous glyphs') + ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); // Rename worksheet $spreadsheet->getActiveSheet()->setTitle('Simple'); diff --git a/samples/Basic/01_Simple_download_xlsx.php b/samples/Basic/01_Simple_download_xlsx.php index 4262b9cd..93efe73d 100644 --- a/samples/Basic/01_Simple_download_xlsx.php +++ b/samples/Basic/01_Simple_download_xlsx.php @@ -17,24 +17,24 @@ $spreadsheet = new Spreadsheet(); // Set document properties $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!') + ->setCellValue('C1', 'Hello') + ->setCellValue('D2', 'world!'); // Miscellaneous glyphs, UTF-8 $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); + ->setCellValue('A4', 'Miscellaneous glyphs') + ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); // Rename worksheet $spreadsheet->getActiveSheet()->setTitle('Simple'); diff --git a/samples/Basic/02_Types.php b/samples/Basic/02_Types.php index 13137586..79f109f5 100644 --- a/samples/Basic/02_Types.php +++ b/samples/Basic/02_Types.php @@ -15,94 +15,94 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties() - ->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setCreator('Maarten Balliauw') + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Set default font $helper->log('Set default font'); $spreadsheet->getDefaultStyle() - ->getFont() - ->setName('Arial') - ->setSize(10); + ->getFont() + ->setName('Arial') + ->setSize(10); // Add some data, resembling some different data types $helper->log('Add some data'); $spreadsheet->getActiveSheet() - ->setCellValue('A1', 'String') - ->setCellValue('B1', 'Simple') - ->setCellValue('C1', 'PhpSpreadsheet'); + ->setCellValue('A1', 'String') + ->setCellValue('B1', 'Simple') + ->setCellValue('C1', 'PhpSpreadsheet'); $spreadsheet->getActiveSheet() - ->setCellValue('A2', 'String') - ->setCellValue('B2', 'Symbols') - ->setCellValue('C2', '!+&=()~§±æþ'); + ->setCellValue('A2', 'String') + ->setCellValue('B2', 'Symbols') + ->setCellValue('C2', '!+&=()~§±æþ'); $spreadsheet->getActiveSheet() - ->setCellValue('A3', 'String') - ->setCellValue('B3', 'UTF-8') - ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); + ->setCellValue('A3', 'String') + ->setCellValue('B3', 'UTF-8') + ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); $spreadsheet->getActiveSheet() - ->setCellValue('A4', 'Number') - ->setCellValue('B4', 'Integer') - ->setCellValue('C4', 12); + ->setCellValue('A4', 'Number') + ->setCellValue('B4', 'Integer') + ->setCellValue('C4', 12); $spreadsheet->getActiveSheet() - ->setCellValue('A5', 'Number') - ->setCellValue('B5', 'Float') - ->setCellValue('C5', 34.56); + ->setCellValue('A5', 'Number') + ->setCellValue('B5', 'Float') + ->setCellValue('C5', 34.56); $spreadsheet->getActiveSheet() - ->setCellValue('A6', 'Number') - ->setCellValue('B6', 'Negative') - ->setCellValue('C6', -7.89); + ->setCellValue('A6', 'Number') + ->setCellValue('B6', 'Negative') + ->setCellValue('C6', -7.89); $spreadsheet->getActiveSheet() - ->setCellValue('A7', 'Boolean') - ->setCellValue('B7', 'True') - ->setCellValue('C7', true); + ->setCellValue('A7', 'Boolean') + ->setCellValue('B7', 'True') + ->setCellValue('C7', true); $spreadsheet->getActiveSheet() - ->setCellValue('A8', 'Boolean') - ->setCellValue('B8', 'False') - ->setCellValue('C8', false); + ->setCellValue('A8', 'Boolean') + ->setCellValue('B8', 'False') + ->setCellValue('C8', false); $dateTimeNow = time(); $spreadsheet->getActiveSheet() - ->setCellValue('A9', 'Date/Time') - ->setCellValue('B9', 'Date') - ->setCellValue('C9', Date::PHPToExcel($dateTimeNow)); + ->setCellValue('A9', 'Date/Time') + ->setCellValue('B9', 'Date') + ->setCellValue('C9', Date::PHPToExcel($dateTimeNow)); $spreadsheet->getActiveSheet() - ->getStyle('C9') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); + ->getStyle('C9') + ->getNumberFormat() + ->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); $spreadsheet->getActiveSheet() - ->setCellValue('A10', 'Date/Time') - ->setCellValue('B10', 'Time') - ->setCellValue('C10', Date::PHPToExcel($dateTimeNow)); + ->setCellValue('A10', 'Date/Time') + ->setCellValue('B10', 'Time') + ->setCellValue('C10', Date::PHPToExcel($dateTimeNow)); $spreadsheet->getActiveSheet() - ->getStyle('C10') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_TIME4); + ->getStyle('C10') + ->getNumberFormat() + ->setFormatCode(NumberFormat::FORMAT_DATE_TIME4); $spreadsheet->getActiveSheet() - ->setCellValue('A11', 'Date/Time') - ->setCellValue('B11', 'Date and Time') - ->setCellValue('C11', Date::PHPToExcel($dateTimeNow)); + ->setCellValue('A11', 'Date/Time') + ->setCellValue('B11', 'Date and Time') + ->setCellValue('C11', Date::PHPToExcel($dateTimeNow)); $spreadsheet->getActiveSheet() - ->getStyle('C11') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME); + ->getStyle('C11') + ->getNumberFormat() + ->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME); $spreadsheet->getActiveSheet() - ->setCellValue('A12', 'NULL') - ->setCellValue('C12', null); + ->setCellValue('A12', 'NULL') + ->setCellValue('C12', null); $richText = new RichText(); $richText->createText('你好 '); @@ -115,8 +115,8 @@ $payable->getFont()->setColor(new Color(Color::COLOR_DARKGREEN)); $richText->createText(', unless specified otherwise on the invoice.'); $spreadsheet->getActiveSheet() - ->setCellValue('A13', 'Rich Text') - ->setCellValue('C13', $richText); + ->setCellValue('A13', 'Rich Text') + ->setCellValue('C13', $richText); $richText2 = new RichText(); $richText2->createText("black text\n"); @@ -125,31 +125,31 @@ $red = $richText2->createTextRun('red text'); $red->getFont()->setColor(new Color(Color::COLOR_RED)); $spreadsheet->getActiveSheet() - ->getCell('C14') - ->setValue($richText2); + ->getCell('C14') + ->setValue($richText2); $spreadsheet->getActiveSheet() - ->getStyle('C14') - ->getAlignment()->setWrapText(true); + ->getStyle('C14') + ->getAlignment()->setWrapText(true); $spreadsheet->getActiveSheet()->setCellValue('A17', 'Hyperlink'); $spreadsheet->getActiveSheet() - ->setCellValue('C17', 'PhpSpreadsheet Web Site'); + ->setCellValue('C17', 'PhpSpreadsheet Web Site'); $spreadsheet->getActiveSheet() - ->getCell('C17') - ->getHyperlink() - ->setUrl('https://github.com/PHPOffice/PhpSpreadsheet') - ->setTooltip('Navigate to PhpSpreadsheet website'); + ->getCell('C17') + ->getHyperlink() + ->setUrl('https://github.com/PHPOffice/PhpSpreadsheet') + ->setTooltip('Navigate to PhpSpreadsheet website'); $spreadsheet->getActiveSheet() - ->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")'); + ->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")'); $spreadsheet->getActiveSheet() - ->getColumnDimension('B') - ->setAutoSize(true); + ->getColumnDimension('B') + ->setAutoSize(true); $spreadsheet->getActiveSheet() - ->getColumnDimension('C') - ->setAutoSize(true); + ->getColumnDimension('C') + ->setAutoSize(true); // Rename worksheet $helper->log('Rename worksheet'); diff --git a/samples/Basic/03_Formulas.php b/samples/Basic/03_Formulas.php index 0d810738..e4538231 100644 --- a/samples/Basic/03_Formulas.php +++ b/samples/Basic/03_Formulas.php @@ -11,63 +11,63 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data, we will use some formulas here $helper->log('Add some data'); $spreadsheet->getActiveSheet() - ->setCellValue('A5', 'Sum:'); + ->setCellValue('A5', 'Sum:'); $spreadsheet->getActiveSheet()->setCellValue('B1', 'Range #1') - ->setCellValue('B2', 3) - ->setCellValue('B3', 7) - ->setCellValue('B4', 13) - ->setCellValue('B5', '=SUM(B2:B4)'); + ->setCellValue('B2', 3) + ->setCellValue('B3', 7) + ->setCellValue('B4', 13) + ->setCellValue('B5', '=SUM(B2:B4)'); $helper->log('Sum of Range #1 is ' . $spreadsheet->getActiveSheet()->getCell('B5')->getCalculatedValue()); $spreadsheet->getActiveSheet()->setCellValue('C1', 'Range #2') - ->setCellValue('C2', 5) - ->setCellValue('C3', 11) - ->setCellValue('C4', 17) - ->setCellValue('C5', '=SUM(C2:C4)'); + ->setCellValue('C2', 5) + ->setCellValue('C3', 11) + ->setCellValue('C4', 17) + ->setCellValue('C5', '=SUM(C2:C4)'); $helper->log('Sum of Range #2 is ' . $spreadsheet->getActiveSheet()->getCell('C5')->getCalculatedValue()); $spreadsheet->getActiveSheet() - ->setCellValue('A7', 'Total of both ranges:'); + ->setCellValue('A7', 'Total of both ranges:'); $spreadsheet->getActiveSheet() - ->setCellValue('B7', '=SUM(B5:C5)'); + ->setCellValue('B7', '=SUM(B5:C5)'); $helper->log('Sum of both Ranges is ' . $spreadsheet->getActiveSheet()->getCell('B7')->getCalculatedValue()); $spreadsheet->getActiveSheet() - ->setCellValue('A8', 'Minimum of both ranges:'); + ->setCellValue('A8', 'Minimum of both ranges:'); $spreadsheet->getActiveSheet() - ->setCellValue('B8', '=MIN(B2:C4)'); + ->setCellValue('B8', '=MIN(B2:C4)'); $helper->log('Minimum value in either Range is ' . $spreadsheet->getActiveSheet()->getCell('B8')->getCalculatedValue()); $spreadsheet->getActiveSheet() - ->setCellValue('A9', 'Maximum of both ranges:'); + ->setCellValue('A9', 'Maximum of both ranges:'); $spreadsheet->getActiveSheet() - ->setCellValue('B9', '=MAX(B2:C4)'); + ->setCellValue('B9', '=MAX(B2:C4)'); $helper->log('Maximum value in either Range is ' . $spreadsheet->getActiveSheet()->getCell('B9')->getCalculatedValue()); $spreadsheet->getActiveSheet() - ->setCellValue('A10', 'Average of both ranges:'); + ->setCellValue('A10', 'Average of both ranges:'); $spreadsheet->getActiveSheet() - ->setCellValue('B10', '=AVERAGE(B2:C4)'); + ->setCellValue('B10', '=AVERAGE(B2:C4)'); $helper->log('Average value of both Ranges is ' . $spreadsheet->getActiveSheet()->getCell('B10')->getCalculatedValue()); $spreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setAutoSize(true); + ->getColumnDimension('A') + ->setAutoSize(true); // Rename worksheet $helper->log('Rename worksheet'); $spreadsheet->getActiveSheet() - ->setTitle('Formulas'); + ->setTitle('Formulas'); // // If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the diff --git a/samples/Basic/04_Printing.php b/samples/Basic/04_Printing.php index fc340a6c..5e90fc91 100644 --- a/samples/Basic/04_Printing.php +++ b/samples/Basic/04_Printing.php @@ -14,12 +14,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data, we will use printing features $helper->log('Add some data'); @@ -31,11 +31,11 @@ for ($i = 1; $i < 200; ++$i) { // Set header and footer. When no different headers for odd/even are used, odd header is assumed. $helper->log('Set header/footer'); $spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); + ->getHeaderFooter() + ->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); $spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); + ->getHeaderFooter() + ->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); // Add a drawing to the header $helper->log('Add a drawing to the header'); @@ -44,17 +44,17 @@ $drawing->setName('PhpSpreadsheet logo'); $drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png'); $drawing->setHeight(36); $spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT); + ->getHeaderFooter() + ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT); // Set page orientation and size $helper->log('Set page orientation and size'); $spreadsheet->getActiveSheet() - ->getPageSetup() - ->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); + ->getPageSetup() + ->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); $spreadsheet->getActiveSheet() - ->getPageSetup() - ->setPaperSize(PageSetup::PAPERSIZE_A4); + ->getPageSetup() + ->setPaperSize(PageSetup::PAPERSIZE_A4); // Rename worksheet $helper->log('Rename worksheet'); diff --git a/samples/Basic/08_Conditional_formatting.php b/samples/Basic/08_Conditional_formatting.php index 398e9c17..0ad45c36 100644 --- a/samples/Basic/08_Conditional_formatting.php +++ b/samples/Basic/08_Conditional_formatting.php @@ -15,36 +15,36 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Create a first sheet, representing sales data $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Description') - ->setCellValue('B1', 'Amount'); + ->setCellValue('B1', 'Amount'); $spreadsheet->getActiveSheet()->setCellValue('A2', 'Paycheck received') - ->setCellValue('B2', 100); + ->setCellValue('B2', 100); $spreadsheet->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought') - ->setCellValue('B3', -1.5); + ->setCellValue('B3', -1.5); $spreadsheet->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought') - ->setCellValue('B4', -1.5); + ->setCellValue('B4', -1.5); $spreadsheet->getActiveSheet()->setCellValue('A5', 'Cup of tea bought') - ->setCellValue('B5', -1.2); + ->setCellValue('B5', -1.2); $spreadsheet->getActiveSheet()->setCellValue('A6', 'Found some money') - ->setCellValue('B6', 8); + ->setCellValue('B6', 8); $spreadsheet->getActiveSheet()->setCellValue('A7', 'Total:') - ->setCellValue('B7', '=SUM(B2:B6)'); + ->setCellValue('B7', '=SUM(B2:B6)'); // Set column widths $helper->log('Set column widths'); @@ -55,25 +55,25 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12); $helper->log('Add conditional formatting'); $conditional1 = new Conditional(); $conditional1->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_BETWEEN) - ->addCondition('200') - ->addCondition('400'); + ->setOperatorType(Conditional::OPERATOR_BETWEEN) + ->addCondition('200') + ->addCondition('400'); $conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_YELLOW); $conditional1->getStyle()->getFont()->setBold(true); $conditional1->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); $conditional2 = new Conditional(); $conditional2->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); + ->setOperatorType(Conditional::OPERATOR_LESSTHAN) + ->addCondition('0'); $conditional2->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED); $conditional2->getStyle()->getFont()->setItalic(true); $conditional2->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); $conditional3 = new Conditional(); $conditional3->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('0'); + ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) + ->addCondition('0'); $conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN); $conditional3->getStyle()->getFont()->setItalic(true); $conditional3->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); diff --git a/samples/Basic/08_Conditional_formatting_2.php b/samples/Basic/08_Conditional_formatting_2.php index 27e8fd02..607578cd 100644 --- a/samples/Basic/08_Conditional_formatting_2.php +++ b/samples/Basic/08_Conditional_formatting_2.php @@ -14,44 +14,44 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Create a first sheet, representing sales data $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet() - ->setCellValue('A1', '-0.5') - ->setCellValue('A2', '-0.25') - ->setCellValue('A3', '0.0') - ->setCellValue('A4', '0.25') - ->setCellValue('A5', '0.5') - ->setCellValue('A6', '0.75') - ->setCellValue('A7', '1.0') - ->setCellValue('A8', '1.25'); + ->setCellValue('A1', '-0.5') + ->setCellValue('A2', '-0.25') + ->setCellValue('A3', '0.0') + ->setCellValue('A4', '0.25') + ->setCellValue('A5', '0.5') + ->setCellValue('A6', '0.75') + ->setCellValue('A7', '1.0') + ->setCellValue('A8', '1.25'); $spreadsheet->getActiveSheet()->getStyle('A1:A8') - ->getNumberFormat() - ->setFormatCode( - NumberFormat::FORMAT_PERCENTAGE_00 - ); + ->getNumberFormat() + ->setFormatCode( + NumberFormat::FORMAT_PERCENTAGE_00 + ); // Add conditional formatting $helper->log('Add conditional formatting'); $conditional1 = new Conditional(); $conditional1->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); + ->setOperatorType(Conditional::OPERATOR_LESSTHAN) + ->addCondition('0'); $conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED); $conditional3 = new Conditional(); $conditional3->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('1'); + ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) + ->addCondition('1'); $conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN); $conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles(); diff --git a/samples/Basic/09_Pagebreaks.php b/samples/Basic/09_Pagebreaks.php index 5ebb9db1..ab99a079 100644 --- a/samples/Basic/09_Pagebreaks.php +++ b/samples/Basic/09_Pagebreaks.php @@ -12,21 +12,21 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Create a first sheet $helper->log('Add data and page breaks'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname') - ->setCellValue('B1', 'Lastname') - ->setCellValue('C1', 'Phone') - ->setCellValue('D1', 'Fax') - ->setCellValue('E1', 'Is Client ?'); + ->setCellValue('B1', 'Lastname') + ->setCellValue('C1', 'Phone') + ->setCellValue('D1', 'Fax') + ->setCellValue('E1', 'Is Client ?'); // Add data for ($i = 2; $i <= 50; ++$i) { @@ -49,15 +49,15 @@ $spreadsheet->getActiveSheet()->setTitle('Printing Options'); // Set print headers $spreadsheet->getActiveSheet() - ->getHeaderFooter()->setOddHeader('&C&24&K0000FF&B&U&A'); + ->getHeaderFooter()->setOddHeader('&C&24&K0000FF&B&U&A'); $spreadsheet->getActiveSheet() - ->getHeaderFooter()->setEvenHeader('&C&24&K0000FF&B&U&A'); + ->getHeaderFooter()->setEvenHeader('&C&24&K0000FF&B&U&A'); // Set print footers $spreadsheet->getActiveSheet() - ->getHeaderFooter()->setOddFooter('&R&D &T&C&F&LPage &P / &N'); + ->getHeaderFooter()->setOddFooter('&R&D &T&C&F&LPage &P / &N'); $spreadsheet->getActiveSheet() - ->getHeaderFooter()->setEvenFooter('&L&D &T&C&F&RPage &P / &N'); + ->getHeaderFooter()->setEvenFooter('&L&D &T&C&F&RPage &P / &N'); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/Basic/11_Documentsecurity.php b/samples/Basic/11_Documentsecurity.php index d92c7d4e..ec537ab3 100644 --- a/samples/Basic/11_Documentsecurity.php +++ b/samples/Basic/11_Documentsecurity.php @@ -11,12 +11,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); diff --git a/samples/Basic/12_CellProtection.php b/samples/Basic/12_CellProtection.php index e29aa5e4..8a1b2a0b 100644 --- a/samples/Basic/12_CellProtection.php +++ b/samples/Basic/12_CellProtection.php @@ -12,12 +12,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Mark Baker') - ->setLastModifiedBy('Mark Baker') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Mark Baker') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); @@ -38,10 +38,10 @@ $helper->log('Set cell protection'); $helper->log('Set sheet security'); $spreadsheet->getActiveSheet()->getProtection()->setSheet(true); $spreadsheet->getActiveSheet() - ->getStyle('A2:B2') - ->getProtection()->setLocked( - Protection::PROTECTION_UNPROTECTED - ); + ->getStyle('A2:B2') + ->getProtection()->setLocked( + Protection::PROTECTION_UNPROTECTED + ); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/Basic/13_CalculationCyclicFormulae.php b/samples/Basic/13_CalculationCyclicFormulae.php index 2afeec3d..26e9784d 100644 --- a/samples/Basic/13_CalculationCyclicFormulae.php +++ b/samples/Basic/13_CalculationCyclicFormulae.php @@ -12,9 +12,9 @@ $spreadsheet = new Spreadsheet(); // Add some data, we will use some formulas here $helper->log('Add some data and formulas'); $spreadsheet->getActiveSheet()->setCellValue('A1', '=B1') - ->setCellValue('A2', '=B2+1') - ->setCellValue('B1', '=A1+1') - ->setCellValue('B2', '=A2'); + ->setCellValue('A2', '=B2+1') + ->setCellValue('B1', '=A1+1') + ->setCellValue('B2', '=A2'); Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100; diff --git a/samples/Basic/15_Datavalidation.php b/samples/Basic/15_Datavalidation.php index 45496ffb..fb76b4dc 100644 --- a/samples/Basic/15_Datavalidation.php +++ b/samples/Basic/15_Datavalidation.php @@ -12,28 +12,28 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Create a first sheet $helper->log('Add data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Cell B3 and B5 contain data validation...') - ->setCellValue('A3', 'Number:') - ->setCellValue('B3', '10') - ->setCellValue('A5', 'List:') - ->setCellValue('B5', 'Item A') - ->setCellValue('A7', 'List #2:') - ->setCellValue('B7', 'Item #2') - ->setCellValue('D2', 'Item #1') - ->setCellValue('D3', 'Item #2') - ->setCellValue('D4', 'Item #3') - ->setCellValue('D5', 'Item #4') - ->setCellValue('D6', 'Item #5'); + ->setCellValue('A3', 'Number:') + ->setCellValue('B3', '10') + ->setCellValue('A5', 'List:') + ->setCellValue('B5', 'Item A') + ->setCellValue('A7', 'List #2:') + ->setCellValue('B7', 'Item #2') + ->setCellValue('D2', 'Item #1') + ->setCellValue('D3', 'Item #2') + ->setCellValue('D4', 'Item #3') + ->setCellValue('D5', 'Item #4') + ->setCellValue('D6', 'Item #5'); // Set data validation $helper->log('Set data validation'); diff --git a/samples/Basic/16_Csv.php b/samples/Basic/16_Csv.php index 23c91d19..ceb8b2f5 100644 --- a/samples/Basic/16_Csv.php +++ b/samples/Basic/16_Csv.php @@ -7,8 +7,8 @@ $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php'; $helper->log('Write to CSV format'); $writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); + ->setEnclosure('"') + ->setSheetIndex(0); $callStartTime = microtime(true); $filename = $helper->getTemporaryFilename('csv'); @@ -18,8 +18,8 @@ $helper->logWrite($writer, $filename, $callStartTime); $helper->log('Read from CSV format'); $reader = IOFactory::createReader('Csv')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); + ->setEnclosure('"') + ->setSheetIndex(0); $callStartTime = microtime(true); $spreadsheetFromCSV = $reader->load($filename); diff --git a/samples/Basic/19_Namedrange.php b/samples/Basic/19_Namedrange.php index ad9abc45..d89e1b04 100644 --- a/samples/Basic/19_Namedrange.php +++ b/samples/Basic/19_Namedrange.php @@ -12,22 +12,22 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(0); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', 'Maarten') - ->setCellValue('B2', 'Balliauw') - ->setCellValue('B3', '=B1 & " " & B2'); + ->setCellValue('A2', 'Lastname:') + ->setCellValue('A3', 'Fullname:') + ->setCellValue('B1', 'Maarten') + ->setCellValue('B2', 'Balliauw') + ->setCellValue('B3', '=B1 & " " & B2'); // Define named ranges $helper->log('Define named ranges'); @@ -50,11 +50,11 @@ $spreadsheet->createSheet(); $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(1); $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', '=PersonFN') - ->setCellValue('B2', '=PersonLN') - ->setCellValue('B3', '=PersonFN & " " & PersonLN'); + ->setCellValue('A2', 'Lastname:') + ->setCellValue('A3', 'Fullname:') + ->setCellValue('B1', '=PersonFN') + ->setCellValue('B2', '=PersonLN') + ->setCellValue('B3', '=PersonFN & " " & PersonLN'); // Resolve range $helper->log('Resolve range'); diff --git a/samples/Basic/22_Heavily_formatted.php b/samples/Basic/22_Heavily_formatted.php index d8259990..d7ba861b 100644 --- a/samples/Basic/22_Heavily_formatted.php +++ b/samples/Basic/22_Heavily_formatted.php @@ -13,12 +13,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); diff --git a/samples/Basic/23_Sharedstyles.php b/samples/Basic/23_Sharedstyles.php index 93a10aef..b5398883 100644 --- a/samples/Basic/23_Sharedstyles.php +++ b/samples/Basic/23_Sharedstyles.php @@ -14,12 +14,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); diff --git a/samples/Basic/25_In_memory_image.php b/samples/Basic/25_In_memory_image.php index 09b25c64..a897486d 100644 --- a/samples/Basic/25_In_memory_image.php +++ b/samples/Basic/25_In_memory_image.php @@ -12,12 +12,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Generate an image $helper->log('Generate an image'); diff --git a/samples/Basic/29_Advanced_value_binder.php b/samples/Basic/29_Advanced_value_binder.php index c129d5a5..74c16c21 100644 --- a/samples/Basic/29_Advanced_value_binder.php +++ b/samples/Basic/29_Advanced_value_binder.php @@ -21,12 +21,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Set default font $helper->log('Set default font'); @@ -41,88 +41,88 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(14); // Add some data, resembling some different data types $helper->log('Add some data'); $spreadsheet->getActiveSheet()->setCellValue('A1', 'String value:') - ->setCellValue('B1', 'Mark Baker'); + ->setCellValue('B1', 'Mark Baker'); $spreadsheet->getActiveSheet()->setCellValue('A2', 'Numeric value #1:') - ->setCellValue('B2', 12345); + ->setCellValue('B2', 12345); $spreadsheet->getActiveSheet()->setCellValue('A3', 'Numeric value #2:') - ->setCellValue('B3', -12.345); + ->setCellValue('B3', -12.345); $spreadsheet->getActiveSheet()->setCellValue('A4', 'Numeric value #3:') - ->setCellValue('B4', .12345); + ->setCellValue('B4', .12345); $spreadsheet->getActiveSheet()->setCellValue('A5', 'Numeric value #4:') - ->setCellValue('B5', '12345'); + ->setCellValue('B5', '12345'); $spreadsheet->getActiveSheet()->setCellValue('A6', 'Numeric value #5:') - ->setCellValue('B6', '1.2345'); + ->setCellValue('B6', '1.2345'); $spreadsheet->getActiveSheet()->setCellValue('A7', 'Numeric value #6:') - ->setCellValue('B7', '.12345'); + ->setCellValue('B7', '.12345'); $spreadsheet->getActiveSheet()->setCellValue('A8', 'Numeric value #7:') - ->setCellValue('B8', '1.234e-5'); + ->setCellValue('B8', '1.234e-5'); $spreadsheet->getActiveSheet()->setCellValue('A9', 'Numeric value #8:') - ->setCellValue('B9', '-1.234e+5'); + ->setCellValue('B9', '-1.234e+5'); $spreadsheet->getActiveSheet()->setCellValue('A10', 'Boolean value:') - ->setCellValue('B10', 'TRUE'); + ->setCellValue('B10', 'TRUE'); $spreadsheet->getActiveSheet()->setCellValue('A11', 'Percentage value #1:') - ->setCellValue('B11', '10%'); + ->setCellValue('B11', '10%'); $spreadsheet->getActiveSheet()->setCellValue('A12', 'Percentage value #2:') - ->setCellValue('B12', '12.5%'); + ->setCellValue('B12', '12.5%'); $spreadsheet->getActiveSheet()->setCellValue('A13', 'Fraction value #1:') - ->setCellValue('B13', '-1/2'); + ->setCellValue('B13', '-1/2'); $spreadsheet->getActiveSheet()->setCellValue('A14', 'Fraction value #2:') - ->setCellValue('B14', '3 1/2'); + ->setCellValue('B14', '3 1/2'); $spreadsheet->getActiveSheet()->setCellValue('A15', 'Fraction value #3:') - ->setCellValue('B15', '-12 3/4'); + ->setCellValue('B15', '-12 3/4'); $spreadsheet->getActiveSheet()->setCellValue('A16', 'Fraction value #4:') - ->setCellValue('B16', '13/4'); + ->setCellValue('B16', '13/4'); $spreadsheet->getActiveSheet()->setCellValue('A17', 'Currency value #1:') - ->setCellValue('B17', '$12345'); + ->setCellValue('B17', '$12345'); $spreadsheet->getActiveSheet()->setCellValue('A18', 'Currency value #2:') - ->setCellValue('B18', '$12345.67'); + ->setCellValue('B18', '$12345.67'); $spreadsheet->getActiveSheet()->setCellValue('A19', 'Currency value #3:') - ->setCellValue('B19', '$12,345.67'); + ->setCellValue('B19', '$12,345.67'); $spreadsheet->getActiveSheet()->setCellValue('A20', 'Date value #1:') - ->setCellValue('B20', '21 December 1983'); + ->setCellValue('B20', '21 December 1983'); $spreadsheet->getActiveSheet()->setCellValue('A21', 'Date value #2:') - ->setCellValue('B21', '19-Dec-1960'); + ->setCellValue('B21', '19-Dec-1960'); $spreadsheet->getActiveSheet()->setCellValue('A22', 'Date value #3:') - ->setCellValue('B22', '07/12/1982'); + ->setCellValue('B22', '07/12/1982'); $spreadsheet->getActiveSheet()->setCellValue('A23', 'Date value #4:') - ->setCellValue('B23', '24-11-1950'); + ->setCellValue('B23', '24-11-1950'); $spreadsheet->getActiveSheet()->setCellValue('A24', 'Date value #5:') - ->setCellValue('B24', '17-Mar'); + ->setCellValue('B24', '17-Mar'); $spreadsheet->getActiveSheet()->setCellValue('A25', 'Time value #1:') - ->setCellValue('B25', '01:30'); + ->setCellValue('B25', '01:30'); $spreadsheet->getActiveSheet()->setCellValue('A26', 'Time value #2:') - ->setCellValue('B26', '01:30:15'); + ->setCellValue('B26', '01:30:15'); $spreadsheet->getActiveSheet()->setCellValue('A27', 'Date/Time value:') - ->setCellValue('B27', '19-Dec-1960 01:30'); + ->setCellValue('B27', '19-Dec-1960 01:30'); $spreadsheet->getActiveSheet()->setCellValue('A28', 'Formula:') - ->setCellValue('B28', '=SUM(B2:B9)'); + ->setCellValue('B28', '=SUM(B2:B9)'); // Rename worksheet $helper->log('Rename worksheet'); diff --git a/samples/Basic/30_Template.php b/samples/Basic/30_Template.php index 1f8a9629..b70c18b6 100644 --- a/samples/Basic/30_Template.php +++ b/samples/Basic/30_Template.php @@ -32,10 +32,10 @@ foreach ($data as $r => $dataRow) { $spreadsheet->getActiveSheet()->insertNewRowBefore($row, 1); $spreadsheet->getActiveSheet()->setCellValue('A' . $row, $r + 1) - ->setCellValue('B' . $row, $dataRow['title']) - ->setCellValue('C' . $row, $dataRow['price']) - ->setCellValue('D' . $row, $dataRow['quantity']) - ->setCellValue('E' . $row, '=C' . $row . '*D' . $row); + ->setCellValue('B' . $row, $dataRow['title']) + ->setCellValue('C' . $row, $dataRow['price']) + ->setCellValue('D' . $row, $dataRow['quantity']) + ->setCellValue('E' . $row, '=C' . $row . '*D' . $row); } $spreadsheet->getActiveSheet()->removeRow($baseRow - 1, 1); diff --git a/samples/Basic/31_Document_properties_write.php b/samples/Basic/31_Document_properties_write.php index 0611389f..dec3cc32 100644 --- a/samples/Basic/31_Document_properties_write.php +++ b/samples/Basic/31_Document_properties_write.php @@ -15,9 +15,9 @@ $helper->logRead($inputFileType, $inputFileName, $callStartTime); $helper->log('Adjust properties'); $spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test XLSX document, generated using PhpSpreadsheet') - ->setKeywords('office 2007 openxml php'); + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test XLSX document, generated using PhpSpreadsheet') + ->setKeywords('office 2007 openxml php'); // Save Excel 2007 file $filename = $helper->getFilename(__FILE__); diff --git a/samples/Basic/31_Document_properties_write_xls.php b/samples/Basic/31_Document_properties_write_xls.php index 4f63e443..d58c3182 100644 --- a/samples/Basic/31_Document_properties_write_xls.php +++ b/samples/Basic/31_Document_properties_write_xls.php @@ -15,9 +15,9 @@ $helper->logRead($inputFileType, $inputFileName, $callStartTime); $helper->log('Adjust properties'); $spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document') - ->setSubject('Office 95 XLS Test Document') - ->setDescription('Test XLS document, generated using PhpSpreadsheet') - ->setKeywords('office 95 biff php'); + ->setSubject('Office 95 XLS Test Document') + ->setDescription('Test XLS document, generated using PhpSpreadsheet') + ->setKeywords('office 95 biff php'); // Save Excel 95 file $filename = $helper->getFilename(__FILE__, 'xls'); diff --git a/samples/Basic/37_Page_layout_view.php b/samples/Basic/37_Page_layout_view.php index 725f004c..d9bac80a 100644 --- a/samples/Basic/37_Page_layout_view.php +++ b/samples/Basic/37_Page_layout_view.php @@ -12,18 +12,18 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPOffice') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('Office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('PHPOffice') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('Office PhpSpreadsheet php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!'); // Set the page layout view as page layout $spreadsheet->getActiveSheet()->getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT); diff --git a/samples/Basic/38_Clone_worksheet.php b/samples/Basic/38_Clone_worksheet.php index dde310cb..83f2d9ce 100644 --- a/samples/Basic/38_Clone_worksheet.php +++ b/samples/Basic/38_Clone_worksheet.php @@ -11,25 +11,25 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); + ->setCellValue('A1', 'Hello') + ->setCellValue('B2', 'world!') + ->setCellValue('C1', 'Hello') + ->setCellValue('D2', 'world!'); // Miscellaneous glyphs, UTF-8 $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); + ->setCellValue('A4', 'Miscellaneous glyphs') + ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); $spreadsheet->getActiveSheet()->setCellValue('A8', "Hello\nWorld"); $spreadsheet->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); @@ -43,10 +43,10 @@ $spreadsheet->getActiveSheet()->setTitle('Simple'); $helper->log('Clone worksheet'); $clonedSheet = clone $spreadsheet->getActiveSheet(); $clonedSheet - ->setCellValue('A1', 'Goodbye') - ->setCellValue('A2', 'cruel') - ->setCellValue('C1', 'Goodbye') - ->setCellValue('C2', 'cruel'); + ->setCellValue('A1', 'Goodbye') + ->setCellValue('A2', 'cruel') + ->setCellValue('C1', 'Goodbye') + ->setCellValue('C2', 'cruel'); // Rename cloned worksheet $helper->log('Rename cloned worksheet'); diff --git a/samples/Basic/39_Dropdown.php b/samples/Basic/39_Dropdown.php index 79b6bbfb..e34d73e6 100644 --- a/samples/Basic/39_Dropdown.php +++ b/samples/Basic/39_Dropdown.php @@ -13,13 +13,13 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties() - ->setCreator('PHPOffice') - ->setLastModifiedBy('PHPOffice') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('Office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setCreator('PHPOffice') + ->setLastModifiedBy('PHPOffice') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('Office PhpSpreadsheet php') + ->setCategory('Test result file'); function transpose($value) { return [$value]; @@ -41,7 +41,7 @@ foreach ($continents as $key => $filename) { // Transpose $countries from a row to a column array $countries = array_map('transpose', $countries); $spreadsheet->getActiveSheet() - ->fromArray($countries, null, $column . '1'); + ->fromArray($countries, null, $column . '1'); $spreadsheet->addNamedRange( new NamedRange( $continent, @@ -50,19 +50,19 @@ foreach ($continents as $key => $filename) { ) ); $spreadsheet->getActiveSheet() - ->getColumnDimension($column) - ->setVisible(false); + ->getColumnDimension($column) + ->setVisible(false); $spreadsheet->getActiveSheet() - ->setCellValue($continentColumn . ($key + 1), $continent); + ->setCellValue($continentColumn . ($key + 1), $continent); ++$column; } // Hide the dropdown data $spreadsheet->getActiveSheet() - ->getColumnDimension($continentColumn) - ->setVisible(false); + ->getColumnDimension($continentColumn) + ->setVisible(false); $spreadsheet->addNamedRange( new NamedRange( @@ -74,53 +74,53 @@ $spreadsheet->addNamedRange( // Set selection cells $spreadsheet->getActiveSheet() - ->setCellValue('A1', 'Continent:'); + ->setCellValue('A1', 'Continent:'); $spreadsheet->getActiveSheet() - ->setCellValue('B1', 'Select continent'); + ->setCellValue('B1', 'Select continent'); $spreadsheet->getActiveSheet() - ->setCellValue('B3', '=' . $column . 1); + ->setCellValue('B3', '=' . $column . 1); $spreadsheet->getActiveSheet() - ->setCellValue('B3', 'Select country'); + ->setCellValue('B3', 'Select country'); $spreadsheet->getActiveSheet() - ->getStyle('A1:A3') - ->getFont()->setBold(true); + ->getStyle('A1:A3') + ->getFont()->setBold(true); // Set linked validators $validation = $spreadsheet->getActiveSheet() - ->getCell('B1') - ->getDataValidation(); + ->getCell('B1') + ->getDataValidation(); $validation->setType(DataValidation::TYPE_LIST) - ->setErrorStyle(DataValidation::STYLE_INFORMATION) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Continent is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a continent from the drop-down list.') - ->setFormula1('=Continents'); + ->setErrorStyle(DataValidation::STYLE_INFORMATION) + ->setAllowBlank(false) + ->setShowInputMessage(true) + ->setShowErrorMessage(true) + ->setShowDropDown(true) + ->setErrorTitle('Input error') + ->setError('Continent is not in the list.') + ->setPromptTitle('Pick from the list') + ->setPrompt('Please pick a continent from the drop-down list.') + ->setFormula1('=Continents'); $spreadsheet->getActiveSheet() - ->setCellValue('A3', 'Country:'); + ->setCellValue('A3', 'Country:'); $spreadsheet->getActiveSheet() - ->getStyle('A3') - ->getFont()->setBold(true); + ->getStyle('A3') + ->getFont()->setBold(true); $validation = $spreadsheet->getActiveSheet() - ->getCell('B3') - ->getDataValidation(); + ->getCell('B3') + ->getDataValidation(); $validation->setType(DataValidation::TYPE_LIST) - ->setErrorStyle(DataValidation::STYLE_INFORMATION) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Country is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a country from the drop-down list.') - ->setFormula1('=INDIRECT($B$1)'); + ->setErrorStyle(DataValidation::STYLE_INFORMATION) + ->setAllowBlank(false) + ->setShowInputMessage(true) + ->setShowErrorMessage(true) + ->setShowDropDown(true) + ->setErrorTitle('Input error') + ->setError('Country is not in the list.') + ->setPromptTitle('Pick from the list') + ->setPrompt('Please pick a country from the drop-down list.') + ->setFormula1('=INDIRECT($B$1)'); $spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(12); $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(30); diff --git a/samples/Basic/42_RichText.php b/samples/Basic/42_RichText.php index 722b0326..43b35a62 100644 --- a/samples/Basic/42_RichText.php +++ b/samples/Basic/42_RichText.php @@ -12,12 +12,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('PhpSpreadsheet Test Document') + ->setSubject('PhpSpreadsheet Test Document') + ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') + ->setKeywords('office PhpSpreadsheet php') + ->setCategory('Test result file'); // Add some data $helper->log('Add some data'); @@ -55,44 +55,44 @@ $wizard = new HtmlHelper(); $richText = $wizard->toRichTextObject($html1); $spreadsheet->getActiveSheet() - ->setCellValue('A1', $richText); + ->setCellValue('A1', $richText); $spreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setWidth(48); + ->getColumnDimension('A') + ->setWidth(48); $spreadsheet->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); + ->getRowDimension(1) + ->setRowHeight(-1); $spreadsheet->getActiveSheet()->getStyle('A1') - ->getAlignment() - ->setWrapText(true); + ->getAlignment() + ->setWrapText(true); $richText = $wizard->toRichTextObject($html2); $spreadsheet->getActiveSheet() - ->setCellValue('A2', $richText); + ->setCellValue('A2', $richText); $spreadsheet->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); + ->getRowDimension(1) + ->setRowHeight(-1); $spreadsheet->getActiveSheet() - ->getStyle('A2') - ->getAlignment() - ->setWrapText(true); + ->getStyle('A2') + ->getAlignment() + ->setWrapText(true); $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A3', $wizard->toRichTextObject($html3)); + ->setCellValue('A3', $wizard->toRichTextObject($html3)); $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', $wizard->toRichTextObject($html4)); + ->setCellValue('A4', $wizard->toRichTextObject($html4)); $spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A5', $wizard->toRichTextObject($html5)); + ->setCellValue('A5', $wizard->toRichTextObject($html5)); // Rename worksheet $helper->log('Rename worksheet'); $spreadsheet->getActiveSheet() - ->setTitle('Rich Text Examples'); + ->setTitle('Rich Text Examples'); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php b/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php index b9312602..7b3fc440 100644 --- a/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php +++ b/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php @@ -14,7 +14,9 @@ $sheetname = 'Data Sheet #3'; class MyReadFilter implements IReadFilter { private $startRow = 0; + private $endRow = 0; + private $columns = []; public function __construct($startRow, $endRow, $columns) diff --git a/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php b/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php index a7718aaa..892ab338 100644 --- a/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php +++ b/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php @@ -14,6 +14,7 @@ $inputFileName = __DIR__ . '/sampleData/example2.xls'; class ChunkReadFilter implements IReadFilter { private $startRow = 0; + private $endRow = 0; /** diff --git a/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php b/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php index c8f99af0..0a3e8f3c 100644 --- a/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php +++ b/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php @@ -14,6 +14,7 @@ $inputFileName = __DIR__ . '/sampleData/example2.xls'; class ChunkReadFilter implements IReadFilter { private $startRow = 0; + private $endRow = 0; /** diff --git a/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php b/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php index 9915a097..efe68582 100644 --- a/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php +++ b/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php @@ -15,6 +15,7 @@ $inputFileName = __DIR__ . '/sampleData/example2.csv'; class ChunkReadFilter implements IReadFilter { private $startRow = 0; + private $endRow = 0; /** diff --git a/samples/templates/largeSpreadsheet.php b/samples/templates/largeSpreadsheet.php index 2205bf6f..6502211e 100644 --- a/samples/templates/largeSpreadsheet.php +++ b/samples/templates/largeSpreadsheet.php @@ -9,12 +9,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Create a first sheet $helper->log('Add data'); @@ -33,8 +33,8 @@ $spreadsheet->getActiveSheet()->getColumnDimension('D')->setVisible(false); // Set outline levels $helper->log('Set outline levels'); $spreadsheet->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) - ->setVisible(false) - ->setCollapsed(true); + ->setVisible(false) + ->setCollapsed(true); // Freeze panes $helper->log('Freeze panes'); @@ -47,10 +47,10 @@ $spreadsheet->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEn // Add data for ($i = 2; $i <= 5000; ++$i) { $spreadsheet->getActiveSheet()->setCellValue('A' . $i, "FName $i") - ->setCellValue('B' . $i, "LName $i") - ->setCellValue('C' . $i, "PhoneNo $i") - ->setCellValue('D' . $i, "FaxNo $i") - ->setCellValue('E' . $i, true); + ->setCellValue('B' . $i, "LName $i") + ->setCellValue('C' . $i, "PhoneNo $i") + ->setCellValue('D' . $i, "FaxNo $i") + ->setCellValue('E' . $i, true); } return $spreadsheet; diff --git a/samples/templates/sampleSpreadsheet.php b/samples/templates/sampleSpreadsheet.php index add7e58a..c668f447 100644 --- a/samples/templates/sampleSpreadsheet.php +++ b/samples/templates/sampleSpreadsheet.php @@ -20,12 +20,12 @@ $spreadsheet = new Spreadsheet(); // Set document properties $helper->log('Set document properties'); $spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); + ->setLastModifiedBy('Maarten Balliauw') + ->setTitle('Office 2007 XLSX Test Document') + ->setSubject('Office 2007 XLSX Test Document') + ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') + ->setKeywords('office 2007 openxml php') + ->setCategory('Test result file'); // Create a first sheet, representing sales data $helper->log('Add some data'); diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 9a95592a..721acc33 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -171,6 +171,7 @@ class Calculation * @var string */ private static $localeArgumentSeparator = ','; + private static $localeFunctions = []; /** @@ -2355,6 +2356,7 @@ class Calculation } private static $functionReplaceFromExcel = null; + private static $functionReplaceToLocale = null; public function _translateFormulaToLocale($formula) @@ -2383,6 +2385,7 @@ class Calculation } private static $functionReplaceFromLocale = null; + private static $functionReplaceToExcel = null; public function _translateFormulaToEnglish($formula) @@ -2443,7 +2446,7 @@ class Calculation } // Return strings wrapped in quotes return '"' . $value . '"'; - // Convert numeric errors to NaN error + // Convert numeric errors to NaN error } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { return Functions::NAN(); } @@ -3678,7 +3681,7 @@ class Calculation } $stack->push('Value', $cellValue, $cellRef); - // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on + // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) { $functionName = $matches[1]; $argCount = $stack->pop(); @@ -3763,7 +3766,7 @@ class Calculation $this->debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant])); } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) { $stack->push('Value', $token); - // if the token is a named range, push the named range name onto the stack + // if the token is a named range, push the named range name onto the stack } elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) { $namedRange = $matches[6]; $this->debugLog->writeDebugLog('Evaluating Named Range ', $namedRange); diff --git a/src/PhpSpreadsheet/Calculation/Financial.php b/src/PhpSpreadsheet/Calculation/Financial.php index a6e4e982..24cdfb0b 100644 --- a/src/PhpSpreadsheet/Calculation/Financial.php +++ b/src/PhpSpreadsheet/Calculation/Financial.php @@ -1843,7 +1843,7 @@ class Financial * If you omit guess, it is assumed to be 10 percent. * * @return float - **/ + */ public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) { $nper = (int) Functions::flattenSingleValue($nper); diff --git a/src/PhpSpreadsheet/Calculation/FormulaParser.php b/src/PhpSpreadsheet/Calculation/FormulaParser.php index da2bc7c4..2b8e7204 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaParser.php +++ b/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -224,7 +224,7 @@ class FormulaParser // scientific notation check if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) { if (strlen($value) > 1) { - if (preg_match("/^[1-9]{1}(\.\d+)?E{1}$/", $this->formula[$index]) != 0) { + if (preg_match('/^[1-9]{1}(\\.\\d+)?E{1}$/', $this->formula[$index]) != 0) { $value .= $this->formula[$index]; ++$index; diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index bca48f60..98ca7fa8 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -533,7 +533,7 @@ class Functions // Range of cells is an error if (self::isCellValue($a)) { return 16; - // Test for Matrix + // Test for Matrix } elseif (self::isMatrixValue($a)) { return 64; } diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index 6f60bac8..e05315c0 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -73,7 +73,9 @@ class Statistical // Function cache for logBeta function private static $logBetaCacheP = 0.0; + private static $logBetaCacheQ = 0.0; + private static $logBetaCacheResult = 0.0; /** @@ -207,6 +209,7 @@ class Statistical // Function cache for logGamma private static $logGammaCacheResult = 0.0; + private static $logGammaCacheX = 0.0; private static function logGamma($x) @@ -431,14 +434,14 @@ class Statistical return exp(0 - $tmp + log(self::SQRT2PI * $summer / $x)); } - /*************************************************************************** + /* * inverse_ncdf.php * ------------------- * begin : Friday, January 16, 2004 * copyright : (C) 2004 Michael Nickerson * email : nickersonm@yahoo.com * - ***************************************************************************/ + */ private static function inverseNcdf($p) { // Inverse ncdf approximation by Peter J. Acklam, implementation adapted to diff --git a/src/PhpSpreadsheet/Cell/Cell.php b/src/PhpSpreadsheet/Cell/Cell.php index f8af7a2f..6f4e3bbf 100644 --- a/src/PhpSpreadsheet/Cell/Cell.php +++ b/src/PhpSpreadsheet/Cell/Cell.php @@ -234,6 +234,7 @@ class Cell break; default: throw new Exception('Invalid datatype: ' . $pDataType); + break; } @@ -587,7 +588,7 @@ class Cell * * @return int Result of comparison (always -1 or 1, never zero!) */ - public static function compareCells(Cell $a, Cell $b) + public static function compareCells(self $a, self $b) { if ($a->getRow() < $b->getRow()) { return -1; diff --git a/src/PhpSpreadsheet/Cell/Coordinate.php b/src/PhpSpreadsheet/Cell/Coordinate.php index 9a3c4b6c..b3b79a00 100644 --- a/src/PhpSpreadsheet/Cell/Coordinate.php +++ b/src/PhpSpreadsheet/Cell/Coordinate.php @@ -30,7 +30,7 @@ abstract class Coordinate */ public static function coordinateFromString($pCoordinateString) { - if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) { + if (preg_match('/^([$]?[A-Z]{1,3})([$]?\\d{1,7})$/', $pCoordinateString, $matches)) { return [$matches[1], $matches[2]]; } elseif (self::coordinateIsRange($pCoordinateString)) { throw new Exception('Cell coordinate string can not be a range of cells'); diff --git a/src/PhpSpreadsheet/Chart/GridLines.php b/src/PhpSpreadsheet/Chart/GridLines.php index 50ca4a23..6e9e39dc 100644 --- a/src/PhpSpreadsheet/Chart/GridLines.php +++ b/src/PhpSpreadsheet/Chart/GridLines.php @@ -197,9 +197,9 @@ class GridLines extends Properties public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) { $this - ->activateObject() - ->setGlowSize($size) - ->setGlowColor($color_value, $color_alpha, $color_type); + ->activateObject() + ->setGlowSize($size) + ->setGlowColor($color_value, $color_alpha, $color_type); } /** diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 1d635e33..b7610206 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -503,9 +503,11 @@ class Properties switch ($propertyType) { case 'empty': // Empty return ''; + break; case 'null': // Null return null; + break; case 'i1': // 1-Byte Signed Integer case 'i2': // 2-Byte Signed Integer @@ -513,6 +515,7 @@ class Properties case 'i8': // 8-Byte Signed Integer case 'int': // Integer return (int) $propertyValue; + break; case 'ui1': // 1-Byte Unsigned Integer case 'ui2': // 2-Byte Unsigned Integer @@ -520,23 +523,28 @@ class Properties case 'ui8': // 8-Byte Unsigned Integer case 'uint': // Unsigned Integer return abs((int) $propertyValue); + break; case 'r4': // 4-Byte Real Number case 'r8': // 8-Byte Real Number case 'decimal': // Decimal return (float) $propertyValue; + break; case 'lpstr': // LPSTR case 'lpwstr': // LPWSTR case 'bstr': // Basic String return $propertyValue; + break; case 'date': // Date and Time case 'filetime': // File Time return strtotime($propertyValue); + break; case 'bool': // Boolean return ($propertyValue == 'true') ? true : false; + break; case 'cy': // Currency case 'error': // Error Status Code @@ -552,6 +560,7 @@ class Properties case 'clsid': // Class ID case 'cf': // Clipboard Data return $propertyValue; + break; } @@ -572,11 +581,13 @@ class Properties case 'ui8': // 8-Byte Unsigned Integer case 'uint': // Unsigned Integer return self::PROPERTY_TYPE_INTEGER; + break; case 'r4': // 4-Byte Real Number case 'r8': // 8-Byte Real Number case 'decimal': // Decimal return self::PROPERTY_TYPE_FLOAT; + break; case 'empty': // Empty case 'null': // Null @@ -584,13 +595,16 @@ class Properties case 'lpwstr': // LPWSTR case 'bstr': // Basic String return self::PROPERTY_TYPE_STRING; + break; case 'date': // Date and Time case 'filetime': // File Time return self::PROPERTY_TYPE_DATE; + break; case 'bool': // Boolean return self::PROPERTY_TYPE_BOOLEAN; + break; case 'cy': // Currency case 'error': // Error Status Code @@ -606,6 +620,7 @@ class Properties case 'clsid': // Class ID case 'cf': // Clipboard Data return self::PROPERTY_TYPE_UNKNOWN; + break; } diff --git a/src/PhpSpreadsheet/Helper/Html.php b/src/PhpSpreadsheet/Helper/Html.php index 78b3a571..61c66a84 100644 --- a/src/PhpSpreadsheet/Helper/Html.php +++ b/src/PhpSpreadsheet/Helper/Html.php @@ -533,14 +533,21 @@ class Html ]; protected $face; + protected $size; + protected $color; protected $bold = false; + protected $italic = false; + protected $underline = false; + protected $superscript = false; + protected $subscript = false; + protected $strikethrough = false; protected $startTagCallbacks = [ diff --git a/src/PhpSpreadsheet/Reader/Html.php b/src/PhpSpreadsheet/Reader/Html.php index a35515c2..4b8081ea 100644 --- a/src/PhpSpreadsheet/Reader/Html.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -219,7 +219,9 @@ class Html extends BaseReader // Data Array used for testing only, should write to Spreadsheet object on completion of tests protected $dataArray = []; + protected $tableLevel = 0; + protected $nestedColumn = ['A']; protected function setTableStartColumn($column) diff --git a/src/PhpSpreadsheet/Reader/Ods.php b/src/PhpSpreadsheet/Reader/Ods.php index 5dd8219d..ec0716df 100644 --- a/src/PhpSpreadsheet/Reader/Ods.php +++ b/src/PhpSpreadsheet/Reader/Ods.php @@ -660,7 +660,7 @@ class Ods extends BaseReader $rID = $rowID + $rowAdjust; $cell = $spreadsheet->getActiveSheet() - ->getCell($columnID . $rID); + ->getCell($columnID . $rID); // Set value if ($hasCalculatedValue) { diff --git a/src/PhpSpreadsheet/Reader/Slk.php b/src/PhpSpreadsheet/Reader/Slk.php index 03225d9b..61e52334 100644 --- a/src/PhpSpreadsheet/Reader/Slk.php +++ b/src/PhpSpreadsheet/Reader/Slk.php @@ -286,7 +286,7 @@ class Slk extends BaseReader } } $this->formats['P' . $this->format++] = $formatArray; - // Read cell value data + // Read cell value data } elseif ($dataType == 'C') { $hasCalculatedValue = false; $cellData = $cellDataFormula = ''; diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 7eb84b5b..9b5aa27a 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -2963,7 +2963,7 @@ class Xls extends BaseReader * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" - **/ + */ private function readSst() { // offset within (spliced) record data @@ -5035,6 +5035,7 @@ class Xls extends BaseReader case 0x28: // TODO: Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007 return; + break; } } @@ -5726,6 +5727,7 @@ class Xls extends BaseReader break; default: throw new Exception('Unrecognized space type in tAttrSpace token'); + break; } // offset: 3; size: 1; number of inserted spaces/carriage returns @@ -5736,6 +5738,7 @@ class Xls extends BaseReader break; default: throw new Exception('Unrecognized attribute flag in tAttr token'); + break; } @@ -6586,6 +6589,7 @@ class Xls extends BaseReader break; default: throw new Exception('Unrecognized function in formula'); + break; } $data = ['function' => $function, 'args' => $args]; @@ -6955,6 +6959,7 @@ class Xls extends BaseReader break; default: throw new Exception('Unrecognized function in formula'); + break; } $data = ['function' => $function, 'args' => $args]; @@ -7088,6 +7093,7 @@ class Xls extends BaseReader // Unknown cases // don't know how to deal with default: throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); + break; } @@ -7501,10 +7507,12 @@ class Xls extends BaseReader } return $sheetRange; + break; default: // TODO: external sheet support throw new Exception('Xls reader only supports internal sheets in formulas'); + break; } } diff --git a/src/PhpSpreadsheet/Reader/Xls/MD5.php b/src/PhpSpreadsheet/Reader/Xls/MD5.php index f0c31773..6a10e591 100644 --- a/src/PhpSpreadsheet/Reader/Xls/MD5.php +++ b/src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -6,8 +6,11 @@ class MD5 { // Context private $a; + private $b; + private $c; + private $d; /** diff --git a/src/PhpSpreadsheet/Reader/Xls/RC4.php b/src/PhpSpreadsheet/Reader/Xls/RC4.php index 80382026..691aca7c 100644 --- a/src/PhpSpreadsheet/Reader/Xls/RC4.php +++ b/src/PhpSpreadsheet/Reader/Xls/RC4.php @@ -6,7 +6,9 @@ class RC4 { // Context protected $s = []; + protected $i = 0; + protected $j = 0; /** diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index 2735de2a..c423b840 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -773,7 +773,7 @@ class ReferenceHelper // Is it in another worksheet? Will not have to update anything. if (strpos($pCellRange, '!') !== false) { return $pCellRange; - // Is it a range or a single cell? + // Is it a range or a single cell? } elseif (!Coordinate::coordinateIsRange($pCellRange)) { // Single cell return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 2ed5f0ef..8abcef2e 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -509,6 +509,7 @@ class Font break; default: throw new PhpSpreadsheetException('Unknown font name "' . $name . '". Cannot map to TrueType font file'); + break; } diff --git a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php index b2d5bcc4..ba59e0e5 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php @@ -37,6 +37,7 @@ class EigenvalueDecomposition * @var array */ private $d = []; + private $e = []; /** @@ -66,6 +67,7 @@ class EigenvalueDecomposition * @var float */ private $cdivr; + private $cdivi; /** @@ -439,7 +441,7 @@ class EigenvalueDecomposition $this->e[$n] = 0.0; --$n; $iter = 0; - // Two roots found + // Two roots found } elseif ($l == $n - 1) { $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n]; $p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0; @@ -496,7 +498,7 @@ class EigenvalueDecomposition } $n = $n - 2; $iter = 0; - // No convergence yet + // No convergence yet } else { // Form shift $x = $this->H[$n][$n]; diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index 5794ccac..528a025f 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -101,6 +101,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } } else { @@ -192,6 +193,7 @@ class Matrix } return $R; + break; //A($i0...$iF; $j0...$jF) case 'integer,integer,integer,integer': @@ -214,6 +216,7 @@ class Matrix } return $R; + break; //$R = array of row indices; $C = array of column indices case 'array,array': @@ -236,6 +239,7 @@ class Matrix } return $R; + break; //A($i0...$iF); $CL = array of column indices case 'integer,integer,array': @@ -258,6 +262,7 @@ class Matrix } return $R; + break; //$RL = array of row indices case 'array,integer,integer': @@ -280,9 +285,11 @@ class Matrix } return $R; + break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } } else { @@ -494,6 +501,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -538,6 +546,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -596,6 +605,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -640,6 +650,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -699,6 +710,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -744,6 +756,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -803,6 +816,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -867,6 +881,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -912,6 +927,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -957,6 +973,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -1095,6 +1112,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); @@ -1153,6 +1171,7 @@ class Matrix break; default: throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + break; } $this->checkMatrixDimensions($M); diff --git a/src/PhpSpreadsheet/Shared/OLERead.php b/src/PhpSpreadsheet/Shared/OLERead.php index d65127ae..57554117 100644 --- a/src/PhpSpreadsheet/Shared/OLERead.php +++ b/src/PhpSpreadsheet/Shared/OLERead.php @@ -35,7 +35,9 @@ class OLERead const SIZE_POS = 0x78; public $wrkbook; + public $summaryInformation; + public $documentSummaryInformation; /** diff --git a/src/PhpSpreadsheet/Shared/Trend/BestFit.php b/src/PhpSpreadsheet/Shared/Trend/BestFit.php index ef4b1ff1..79c52c33 100644 --- a/src/PhpSpreadsheet/Shared/Trend/BestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/BestFit.php @@ -8,49 +8,49 @@ class BestFit * Indicator flag for a calculation error. * * @var bool - **/ + */ protected $error = false; /** * Algorithm type to use for best-fit. * * @var string - **/ + */ protected $bestFitType = 'undetermined'; /** * Number of entries in the sets of x- and y-value arrays. * * @var int - **/ + */ protected $valueCount = 0; /** * X-value dataseries of values. * * @var float[] - **/ + */ protected $xValues = []; /** * Y-value dataseries of values. * * @var float[] - **/ + */ protected $yValues = []; /** * Flag indicating whether values should be adjusted to Y=0. * * @var bool - **/ + */ protected $adjustToZero = false; /** * Y-value series of best-fit values. * * @var float[] - **/ + */ protected $yBestFitValues = []; protected $goodnessOfFit = 1; diff --git a/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php b/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php index 05693b3c..03723d84 100644 --- a/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php @@ -9,7 +9,7 @@ class ExponentialBestFit extends BestFit * (Name of this Trend class). * * @var string - **/ + */ protected $bestFitType = 'exponential'; /** @@ -18,7 +18,7 @@ class ExponentialBestFit extends BestFit * @param float $xValue X-Value * * @return float Y-Value - **/ + */ public function getValueOfYForX($xValue) { return $this->getIntersect() * pow($this->getSlope(), ($xValue - $this->xOffset)); @@ -30,7 +30,7 @@ class ExponentialBestFit extends BestFit * @param float $yValue Y-Value * * @return float X-Value - **/ + */ public function getValueOfXForY($yValue) { return log(($yValue + $this->yOffset) / $this->getIntersect()) / log($this->getSlope()); @@ -42,7 +42,7 @@ class ExponentialBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return string - **/ + */ public function getEquation($dp = 0) { $slope = $this->getSlope($dp); @@ -57,7 +57,7 @@ class ExponentialBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return float - **/ + */ public function getSlope($dp = 0) { if ($dp != 0) { @@ -73,7 +73,7 @@ class ExponentialBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return float - **/ + */ public function getIntersect($dp = 0) { if ($dp != 0) { diff --git a/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php b/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php index 9fb676d2..367e9d6e 100644 --- a/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php @@ -9,7 +9,7 @@ class LinearBestFit extends BestFit * (Name of this Trend class). * * @var string - **/ + */ protected $bestFitType = 'linear'; /** @@ -18,7 +18,7 @@ class LinearBestFit extends BestFit * @param float $xValue X-Value * * @return float Y-Value - **/ + */ public function getValueOfYForX($xValue) { return $this->getIntersect() + $this->getSlope() * $xValue; @@ -30,7 +30,7 @@ class LinearBestFit extends BestFit * @param float $yValue Y-Value * * @return float X-Value - **/ + */ public function getValueOfXForY($yValue) { return ($yValue - $this->getIntersect()) / $this->getSlope(); @@ -42,7 +42,7 @@ class LinearBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return string - **/ + */ public function getEquation($dp = 0) { $slope = $this->getSlope($dp); diff --git a/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php b/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php index b6e48ee9..9092cef8 100644 --- a/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php @@ -9,7 +9,7 @@ class LogarithmicBestFit extends BestFit * (Name of this Trend class). * * @var string - **/ + */ protected $bestFitType = 'logarithmic'; /** @@ -18,7 +18,7 @@ class LogarithmicBestFit extends BestFit * @param float $xValue X-Value * * @return float Y-Value - **/ + */ public function getValueOfYForX($xValue) { return $this->getIntersect() + $this->getSlope() * log($xValue - $this->xOffset); @@ -30,7 +30,7 @@ class LogarithmicBestFit extends BestFit * @param float $yValue Y-Value * * @return float X-Value - **/ + */ public function getValueOfXForY($yValue) { return exp(($yValue - $this->getIntersect()) / $this->getSlope()); @@ -42,7 +42,7 @@ class LogarithmicBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return string - **/ + */ public function getEquation($dp = 0) { $slope = $this->getSlope($dp); diff --git a/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php b/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php index 7c54e8bd..60739705 100644 --- a/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php @@ -11,21 +11,21 @@ class PolynomialBestFit extends BestFit * (Name of this Trend class). * * @var string - **/ + */ protected $bestFitType = 'polynomial'; /** * Polynomial order. * * @var int - **/ + */ protected $order = 0; /** * Return the order of this polynomial. * * @return int - **/ + */ public function getOrder() { return $this->order; @@ -37,7 +37,7 @@ class PolynomialBestFit extends BestFit * @param float $xValue X-Value * * @return float Y-Value - **/ + */ public function getValueOfYForX($xValue) { $retVal = $this->getIntersect(); @@ -57,7 +57,7 @@ class PolynomialBestFit extends BestFit * @param float $yValue Y-Value * * @return float X-Value - **/ + */ public function getValueOfXForY($yValue) { return ($yValue - $this->getIntersect()) / $this->getSlope(); @@ -69,7 +69,7 @@ class PolynomialBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return string - **/ + */ public function getEquation($dp = 0) { $slope = $this->getSlope($dp); @@ -94,7 +94,7 @@ class PolynomialBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return string - **/ + */ public function getSlope($dp = 0) { if ($dp != 0) { diff --git a/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php b/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php index a9d6ff57..e1b3b829 100644 --- a/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php @@ -9,7 +9,7 @@ class PowerBestFit extends BestFit * (Name of this Trend class). * * @var string - **/ + */ protected $bestFitType = 'power'; /** @@ -18,7 +18,7 @@ class PowerBestFit extends BestFit * @param float $xValue X-Value * * @return float Y-Value - **/ + */ public function getValueOfYForX($xValue) { return $this->getIntersect() * pow(($xValue - $this->xOffset), $this->getSlope()); @@ -30,7 +30,7 @@ class PowerBestFit extends BestFit * @param float $yValue Y-Value * * @return float X-Value - **/ + */ public function getValueOfXForY($yValue) { return pow((($yValue + $this->yOffset) / $this->getIntersect()), (1 / $this->getSlope())); @@ -42,7 +42,7 @@ class PowerBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return string - **/ + */ public function getEquation($dp = 0) { $slope = $this->getSlope($dp); @@ -57,7 +57,7 @@ class PowerBestFit extends BestFit * @param int $dp Number of places of decimal precision to display * * @return float - **/ + */ public function getIntersect($dp = 0) { if ($dp != 0) { diff --git a/src/PhpSpreadsheet/Shared/Trend/Trend.php b/src/PhpSpreadsheet/Shared/Trend/Trend.php index da61e6f1..1b7b3901 100644 --- a/src/PhpSpreadsheet/Shared/Trend/Trend.php +++ b/src/PhpSpreadsheet/Shared/Trend/Trend.php @@ -20,7 +20,7 @@ class Trend * Names of the best-fit Trend analysis methods. * * @var string[] - **/ + */ private static $trendTypes = [ self::TREND_LINEAR, self::TREND_LOGARITHMIC, @@ -32,7 +32,7 @@ class Trend * Names of the best-fit Trend polynomial orders. * * @var string[] - **/ + */ private static $trendTypePolynomialOrders = [ self::TREND_POLYNOMIAL_2, self::TREND_POLYNOMIAL_3, @@ -45,7 +45,7 @@ class Trend * Cached results for each method when trying to identify which provides the best fit. * * @var bestFit[] - **/ + */ private static $trendCache = []; public static function calculate($trendType = self::TREND_BEST_FIT, $yValues = [], $xValues = [], $const = true) diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index ad6be49d..659b3100 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -92,6 +92,7 @@ class Spreadsheet * @var string */ private $macrosCode; + /** * macrosCertificate : if macros are signed, contains binary data vbaProjectSignature.bin file, null if not signed. * @@ -281,6 +282,7 @@ class Spreadsheet switch ($what) { case 'all': return $this->ribbonBinObjects; + break; case 'names': case 'data': diff --git a/src/PhpSpreadsheet/Style/Border.php b/src/PhpSpreadsheet/Style/Border.php index 829b8fd0..ee78c801 100644 --- a/src/PhpSpreadsheet/Style/Border.php +++ b/src/PhpSpreadsheet/Style/Border.php @@ -82,6 +82,7 @@ class Border extends Supervisor case 'outline': case 'vertical': throw new PhpSpreadsheetException('Cannot get shared component for a pseudo-border.'); + break; case 'bottom': return $this->parent->getSharedComponent()->getBottom(); diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index f4731105..f99469b1 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -415,6 +415,7 @@ class NumberFormat extends Supervisor // fractional seconds - no php equivalent '.s' => '', ]; + /** * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock). * @@ -424,6 +425,7 @@ class NumberFormat extends Supervisor 'hh' => 'H', 'h' => 'G', ]; + /** * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock). * @@ -687,9 +689,9 @@ class NumberFormat extends Supervisor // Strip # $format = preg_replace('/\\#/', '0', $format); - $n = "/\[[^\]]+\]/"; + $n = '/\\[[^\\]]+\\]/'; $m = preg_replace($n, '', $format); - $number_regex = "/(0+)(\.?)(0*)/"; + $number_regex = '/(0+)(\\.?)(0*)/'; if (preg_match($number_regex, $m, $matches)) { $left = $matches[1]; $dec = $matches[2]; diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index fa8c1571..935ac88c 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -469,6 +469,7 @@ class AutoFilter * @var array */ private static $fromReplace = ['\*', '\?', '~~', '~.*', '~.?']; + private static $toReplace = ['.*', '.', '~', '\*', '\?']; /** diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index 858bce2f..bca06e24 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -223,7 +223,7 @@ class BaseDrawing implements IComparable // Set new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $this->setWorksheet($pValue); } else { - throw new PhpSpreadsheetException("A Worksheet has already been assigned. Drawings can only exist on one \PhpOffice\PhpSpreadsheet\Worksheet."); + throw new PhpSpreadsheetException('A Worksheet has already been assigned. Drawings can only exist on one \\PhpOffice\\PhpSpreadsheet\\Worksheet.'); } } diff --git a/src/PhpSpreadsheet/Writer/Ods/Content.php b/src/PhpSpreadsheet/Writer/Ods/Content.php index 40039eea..11de0fd3 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Content.php +++ b/src/PhpSpreadsheet/Writer/Ods/Content.php @@ -201,6 +201,7 @@ class Content extends WriterPart break; case DataType::TYPE_ERROR: throw new Exception('Writing of error not implemented yet.'); + break; case DataType::TYPE_FORMULA: $formulaValue = $cell->getValue(); @@ -223,6 +224,7 @@ class Content extends WriterPart break; case DataType::TYPE_INLINE: throw new Exception('Writing of inline not implemented yet.'); + break; case DataType::TYPE_NUMERIC: $objWriter->writeAttribute('office:value-type', 'float'); diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index 0b451acb..4bcdb928 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -493,31 +493,31 @@ class Parser return $this->convertString($token); } elseif (is_numeric($token)) { return $this->convertNumber($token); - // match references like A1 or $A$1 + // match references like A1 or $A$1 } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) { return $this->convertRef2d($token); - // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1 - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) { + // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1 + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?(\\d+)$/u', $token)) { return $this->convertRef3d($token); - // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1 - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) { + // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1 + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\\d+)$/u", $token)) { return $this->convertRef3d($token); - // match ranges like A1:B2 or $A$1:$B$2 + // match ranges like A1:B2 or $A$1:$B$2 } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) { return $this->convertRange2d($token); - // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) { + // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?(\\d+)\\:\$?([A-Ia-i]?[A-Za-z])?\$?(\\d+)$/u', $token)) { return $this->convertRange3d($token); - // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) { + // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\\d+)\\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\\d+)$/u", $token)) { return $this->convertRange3d($token); - // operators (including parentheses) + // operators (including parentheses) } elseif (isset($this->ptg[$token])) { return pack('C', $this->ptg[$token]); - // match error codes - } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') { + // match error codes + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) or $token == '#N/A') { return $this->convertError($token); - // commented so argument number can be processed correctly. See toReversePolish(). + // commented so argument number can be processed correctly. See toReversePolish(). /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token)) { return($this->convertFunction($token, $this->_func_args)); @@ -541,7 +541,7 @@ class Parser private function convertNumber($num) { // Integer in the range 0..2**16-1 - if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) { + if ((preg_match('/^\\d+$/', $num)) and ($num <= 65535)) { return pack('Cv', $this->ptg['ptgInt'], $num); } @@ -652,7 +652,7 @@ class Parser list($cell1, $cell2) = explode(':', $range); // Convert the cell references - if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) { + if (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\\d+)$/', $cell1)) { list($row1, $col1) = $this->cellToPackedRowcol($cell1); list($row2, $col2) = $this->cellToPackedRowcol($cell2); } else { // It's a rows range (like 26:27) @@ -1005,6 +1005,7 @@ class Parser case '&': case '%': return $token; + break; case '>': if ($this->lookAhead == '=') { // it's a GE token @@ -1012,6 +1013,7 @@ class Parser } return $token; + break; case '<': // it's a LE or a NE token @@ -1020,24 +1022,25 @@ class Parser } return $token; + break; default: // if it's a reference A1 or $A$1 or $A1 or A$1 if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?\d+$/', $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.') and ($this->lookAhead != '!')) { return $token; - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) { + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) { // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) return $token; - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) { + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) { // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) return $token; } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+:(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $token) && !preg_match('/\d/', $this->lookAhead)) { // if it's a range A1:A2 or $A$1:$A$2 return $token; - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead)) { + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?\\d+:\$?([A-Ia-i]?[A-Za-z])?\$?\\d+$/u', $token) and !preg_match('/\d/', $this->lookAhead)) { // If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 return $token; - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead)) { + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead)) { // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 return $token; } elseif (is_numeric($token) and (!is_numeric($token . $this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) { @@ -1046,10 +1049,10 @@ class Parser } elseif (preg_match('/"([^"]|""){0,255}"/', $token) and $this->lookAhead != '"' and (substr_count($token, '"') % 2 == 0)) { // If it's a string (of maximum 255 characters) return $token; - } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') { + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) or $token == '#N/A') { // If it's an error code return $token; - } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->lookAhead == '(')) { + } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $token) and ($this->lookAhead == '(')) { // if it's a function call return $token; } elseif (substr($token, -1) == ')') { @@ -1147,13 +1150,13 @@ class Parser $this->advance(); return $result; - // If it's an error code - } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->currentToken) or $this->currentToken == '#N/A') { + // If it's an error code + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $this->currentToken) or $this->currentToken == '#N/A') { $result = $this->createTree($this->currentToken, 'ptgErr', ''); $this->advance(); return $result; - // If it's a negative value + // If it's a negative value } elseif ($this->currentToken == '-') { // catch "-" Term $this->advance(); @@ -1161,7 +1164,7 @@ class Parser $result = $this->createTree('ptgUminus', $result2, ''); return $result; - // If it's a positive value + // If it's a positive value } elseif ($this->currentToken == '+') { // catch "+" Term $this->advance(); @@ -1259,13 +1262,13 @@ class Parser $this->advance(); return $result; - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?\d+$/u", $this->currentToken)) { + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $this->currentToken)) { // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) $result = $this->createTree($this->currentToken, '', ''); $this->advance(); return $result; - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?\d+$/u", $this->currentToken)) { + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $this->currentToken)) { // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) $result = $this->createTree($this->currentToken, '', ''); $this->advance(); @@ -1279,14 +1282,14 @@ class Parser $this->advance(); return $result; - } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+$/u", $this->currentToken)) { + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?\\d+:\$?([A-Ia-i]?[A-Za-z])?\$?\\d+$/u', $this->currentToken)) { // If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2) // must be an error? $result = $this->createTree($this->currentToken, '', ''); $this->advance(); return $result; - } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\d+$/u", $this->currentToken)) { + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+$/u", $this->currentToken)) { // If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2) // must be an error? $result = $this->createTree($this->currentToken, '', ''); @@ -1304,7 +1307,7 @@ class Parser $this->advance(); return $result; - } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->currentToken)) { + } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $this->currentToken)) { // if it's a function call $result = $this->func(); @@ -1420,9 +1423,9 @@ class Parser $polish .= $converted_tree; } // if it's a function convert it here (so we can set it's arguments) - if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and + if (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/", $tree['value']) and !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and - !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and + !preg_match('/^[A-Ia-i]?[A-Za-z](\\d+)\\.\\.[A-Ia-i]?[A-Za-z](\\d+)$/', $tree['value']) and !is_numeric($tree['value']) and !isset($this->ptg[$tree['value']])) { // left subtree for a function is always an array. diff --git a/src/PhpSpreadsheet/Writer/Xls/Workbook.php b/src/PhpSpreadsheet/Writer/Xls/Workbook.php index d8c33cff..b463ce4a 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xls/Workbook.php @@ -599,7 +599,7 @@ class Workbook extends BIFFwriter // store the DEFINEDNAME record $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true)); - // (exclusive) either repeatColumns or repeatRows + // (exclusive) either repeatColumns or repeatRows } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { // Columns to repeat if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { @@ -1066,7 +1066,7 @@ class Workbook extends BIFFwriter // and start new record data block where we start writing the string $recordData = ''; - // 2. space remaining is greater than or equal to minimum space needed + // 2. space remaining is greater than or equal to minimum space needed } else { // initialize effective remaining space, for Unicode strings this may need to be reduced by 1, see below $effective_space_remaining = $space_remaining; diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index bfd85ac1..c80ccd62 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -1074,7 +1074,7 @@ class Worksheet extends BIFFwriter // parameters accordingly. // Split the dir name and sheet name (if it exists) $dir_long = $url; - if (preg_match("/\#/", $url)) { + if (preg_match('/\\#/', $url)) { $link_type |= 0x08; } @@ -1082,11 +1082,11 @@ class Worksheet extends BIFFwriter $link_type = pack('V', $link_type); // Calculate the up-level dir count e.g.. (..\..\..\ == 3) - $up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless); + $up_count = preg_match_all("/\\.\\.\\\/", $dir_long, $useless); $up_count = pack('v', $up_count); // Store the short dos dir name (null terminated) - $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0"; + $dir_short = preg_replace("/\\.\\.\\\/", '', $dir_long) . "\0"; // Store the long dir name as a wchar string (non-null terminated) $dir_long = $dir_long . "\0"; diff --git a/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php b/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php index 9b56209e..0b4263bf 100644 --- a/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php +++ b/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php @@ -239,11 +239,10 @@ class CoordinateTest extends TestCase return require 'data/CellBuildRange.php'; } - /** - * @expectedException \TypeError - */ public function testBuildRangeInvalid() { + $this->expectException(\TypeError::class); + if (PHP_MAJOR_VERSION < 7) { $this->markTestSkipped('Cannot catch type hinting error with PHP 5.6'); } diff --git a/tests/PhpSpreadsheetTests/Collection/CellsTest.php b/tests/PhpSpreadsheetTests/Collection/CellsTest.php index 148c345d..be14aa5d 100644 --- a/tests/PhpSpreadsheetTests/Collection/CellsTest.php +++ b/tests/PhpSpreadsheetTests/Collection/CellsTest.php @@ -85,11 +85,10 @@ class CellsTest extends TestCase self::assertNotNull($collection->get('A2'), 'should be able to get back the cell even when another cell was deleted while this one was the current one'); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testThrowsWhenCellCannotBeRetrievedFromCache() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $collection = $this->getMockBuilder(Cells::class) ->setConstructorArgs([new Worksheet(), new Memory()]) ->setMethods(['has']) @@ -101,11 +100,10 @@ class CellsTest extends TestCase $collection->get('A2'); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testThrowsWhenCellCannotBeStoredInCache() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $cache = $this->createMock(Memory::class); $cell = $this->createMock(Cell::class); $cache->method('set') diff --git a/tests/PhpSpreadsheetTests/Custom/Complex.php b/tests/PhpSpreadsheetTests/Custom/Complex.php index 155ca428..d83af1ba 100644 --- a/tests/PhpSpreadsheetTests/Custom/Complex.php +++ b/tests/PhpSpreadsheetTests/Custom/Complex.php @@ -7,7 +7,9 @@ use PhpOffice\PhpSpreadsheet\Exception; class Complex { private $realPart = 0; + private $imaginaryPart = 0; + private $suffix; public static function _parseComplex($complexNumber) diff --git a/tests/PhpSpreadsheetTests/IOFactoryTest.php b/tests/PhpSpreadsheetTests/IOFactoryTest.php index 198b6ca8..4c9c52d0 100644 --- a/tests/PhpSpreadsheetTests/IOFactoryTest.php +++ b/tests/PhpSpreadsheetTests/IOFactoryTest.php @@ -117,35 +117,31 @@ class IOFactoryTest extends TestCase ]; } - /** - * @expectedException \InvalidArgumentException - */ public function testIdentifyNonExistingFileThrowException() { + $this->expectException(\InvalidArgumentException::class); + IOFactory::identify('/non/existing/file'); } - /** - * @expectedException \InvalidArgumentException - */ public function testIdentifyExistingDirectoryThrowExceptions() { + $this->expectException(\InvalidArgumentException::class); + IOFactory::identify('.'); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Writer\Exception - */ public function testRegisterInvalidWriter() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Writer\Exception::class); + IOFactory::registerWriter('foo', 'bar'); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception - */ public function testRegisterInvalidReader() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class); + IOFactory::registerReader('foo', 'bar'); } } diff --git a/tests/PhpSpreadsheetTests/Reader/XmlTest.php b/tests/PhpSpreadsheetTests/Reader/XmlTest.php index 066c6889..763e177f 100644 --- a/tests/PhpSpreadsheetTests/Reader/XmlTest.php +++ b/tests/PhpSpreadsheetTests/Reader/XmlTest.php @@ -11,12 +11,13 @@ class XmlTest extends TestCase { /** * @dataProvider providerInvalidXML - * @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception * * @param mixed $filename */ public function testInvalidXML($filename) { + $this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class); + $reader = $this->getMockForAbstractClass(BaseReader::class); $expectedResult = 'FAILURE: Should throw an Exception rather than return a value'; $result = $reader->securityScanFile($filename); @@ -35,12 +36,13 @@ class XmlTest extends TestCase /** * @dataProvider providerInvalidSimpleXML - * @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception * * @param $filename */ public function testInvalidSimpleXML($filename) { + $this->expectException(\PhpOffice\PhpSpreadsheet\Reader\Exception::class); + $xmlReader = new Xml(); $xmlReader->trySimpleXMLLoadString($filename); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php index 18098979..b1da9b3a 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/Column/RuleTest.php @@ -8,6 +8,7 @@ use PHPUnit\Framework\TestCase; class RuleTest extends TestCase { private $testAutoFilterRuleObject; + private $mockAutoFilterColumnObject; public function setUp() diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php index d575f331..9ce636d8 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php @@ -8,7 +8,9 @@ use PHPUnit\Framework\TestCase; class ColumnTest extends TestCase { private $testInitialColumn = 'H'; + private $testAutoFilterColumnObject; + private $mockAutoFilterObject; public function setUp() @@ -70,11 +72,10 @@ class ColumnTest extends TestCase self::assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSetInvalidFilterTypeThrowsException() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $expectedResult = 'Unfiltered'; $this->testAutoFilterColumnObject->setFilterType($expectedResult); @@ -95,11 +96,10 @@ class ColumnTest extends TestCase self::assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSetInvalidJoinThrowsException() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $expectedResult = 'Neither'; $this->testAutoFilterColumnObject->setJoin($expectedResult); diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php index 14229ec2..6766aac8 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php @@ -11,11 +11,14 @@ use PHPUnit\Framework\TestCase; class AutoFilterTest extends TestCase { private $testInitialRange = 'H2:O256'; + /** * @var AutoFilter */ private $testAutoFilterObject; + private $mockWorksheetObject; + private $cellCollection; public function setUp() @@ -95,11 +98,10 @@ class AutoFilterTest extends TestCase self::assertEquals($expectedResult, $result); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSetRangeInvalidRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $expectedResult = 'A1'; $this->testAutoFilterObject->setRange($expectedResult); @@ -129,11 +131,10 @@ class AutoFilterTest extends TestCase } } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testGetInvalidColumnOffset() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $invalidColumn = 'G'; $this->testAutoFilterObject->getColumnOffset($invalidColumn); @@ -156,11 +157,10 @@ class AutoFilterTest extends TestCase self::assertInstanceOf(Column::class, $result[$expectedResult]); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSetInvalidColumnWithString() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $invalidColumn = 'A'; $this->testAutoFilterObject->setColumn($invalidColumn); @@ -184,20 +184,18 @@ class AutoFilterTest extends TestCase self::assertInstanceOf(Column::class, $result[$expectedResult]); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSetInvalidColumnWithObject() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $invalidColumn = 'E'; $this->testAutoFilterObject->setColumn($invalidColumn); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSetColumnWithInvalidDataType() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $invalidColumn = 123.456; $this->testAutoFilterObject->setColumn($invalidColumn); } @@ -262,11 +260,10 @@ class AutoFilterTest extends TestCase self::assertInstanceOf(Column::class, $result); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testGetColumnWithoutRangeSet() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + // Clear the range $this->testAutoFilterObject->setRange(''); $this->testAutoFilterObject->getColumn('A'); diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php index 4f4e7ee9..46880e2e 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnCellIteratorTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; class ColumnCellIteratorTest extends TestCase { public $mockWorksheet; + public $mockCell; public function setUp() @@ -67,20 +68,18 @@ class ColumnCellIteratorTest extends TestCase } } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSeekOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator->seek(1); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testPrevOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator->prev(); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php index d4d1f46e..7285961d 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnIteratorTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; class ColumnIteratorTest extends TestCase { public $mockWorksheet; + public $mockColumn; public function setUp() @@ -66,20 +67,18 @@ class ColumnIteratorTest extends TestCase } } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSeekOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator->seek('A'); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testPrevOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator->prev(); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php index 327cb8f1..b1e7b474 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/ColumnTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; class ColumnTest extends TestCase { public $mockWorksheet; + public $mockColumn; public function setUp() diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php index 28ea2478..9346d0a1 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowCellIteratorTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; class RowCellIteratorTest extends TestCase { public $mockWorksheet; + public $mockCell; public function setUp() @@ -69,20 +70,18 @@ class RowCellIteratorTest extends TestCase } } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSeekOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator->seek(1); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testPrevOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator->prev(); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php index 12d3ac6e..63e26b34 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowIteratorTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; class RowIteratorTest extends TestCase { public $mockWorksheet; + public $mockRow; public function setUp() @@ -64,20 +65,18 @@ class RowIteratorTest extends TestCase } } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testSeekOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new RowIterator($this->mockWorksheet, 2, 4); $iterator->seek(1); } - /** - * @expectedException \PhpOffice\PhpSpreadsheet\Exception - */ public function testPrevOutOfRange() { + $this->expectException(\PhpOffice\PhpSpreadsheet\Exception::class); + $iterator = new RowIterator($this->mockWorksheet, 2, 4); $iterator->prev(); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/RowTest.php b/tests/PhpSpreadsheetTests/Worksheet/RowTest.php index e8cd59c4..0b2822c3 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/RowTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/RowTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; class RowTest extends TestCase { public $mockWorksheet; + public $mockRow; public function setUp()