diff --git a/.gitignore b/.gitignore index 13c9e9b5..011328ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ -/build/PHPExcel.phar /tests/codeCoverage /analysis /vendor/ -/composer.lock /phpunit.xml +/.php_cs.cache ## IDE support *.buildpath diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 2278ffb0..00000000 --- a/.php_cs +++ /dev/null @@ -1,109 +0,0 @@ -exclude('vendor') - ->in('samples') - ->in('src') - ->in('tests'); - -return Symfony\CS\Config\Config::create() - ->level(Symfony\CS\FixerInterface::NONE_LEVEL) - ->fixers([ - // 'align_double_arrow', // Waste of time - // 'align_equals', // Waste of time - 'array_element_no_space_before_comma', - 'array_element_white_space_after_comma', - 'blankline_after_open_tag', - 'braces', - // 'concat_without_spaces', // This make it less readable - 'concat_with_spaces', - 'double_arrow_multiline_whitespaces', - 'duplicate_semicolon', - // 'echo_to_print', // We prefer echo - 'elseif', - // 'empty_return', // even if technically useless, we prefer to be explicit with our intent to return null - 'encoding', - 'eof_ending', - 'ereg_to_preg', - 'extra_empty_lines', - 'function_call_space', - 'function_declaration', - 'function_typehint_space', - // 'header_comment', // We don't use common header in all our files - 'include', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'list_commas', - // 'logical_not_operators_with_spaces', // No we prefer to keep "!" without spaces - // 'logical_not_operators_with_successor_space', // idem - // 'long_array_syntax', // We opted in for the short syntax - 'lowercase_constants', - 'lowercase_keywords', - 'method_argument_space', - 'multiline_array_trailing_comma', - 'multiline_spaces_before_semicolon', - 'multiple_use', - 'namespace_no_leading_whitespace', - 'newline_after_open_tag', - 'new_with_braces', - 'no_blank_lines_after_class_opening', - // 'no_blank_lines_before_namespace', // we want 1 blank line before namespace - 'no_empty_lines_after_phpdocs', - 'object_operator', - 'operators_spaces', - 'ordered_use', - 'parenthesis', - 'php4_constructor', - 'php_closing_tag', - 'phpdoc_indent', - 'phpdoc_inline_tag', - 'phpdoc_no_access', - 'phpdoc_no_empty_return', - 'phpdoc_no_package', - 'phpdoc_order', - // 'phpdoc_params', // Waste of time - 'phpdoc_scalar', - // 'phpdoc_separation', // Nope, annotations are easy to read enough, no need to split them with blank lines - // 'phpdoc_short_description', // We usually don't generate documentation so punctuation is not important - 'phpdoc_to_comment', - 'phpdoc_trim', - 'phpdoc_types', - 'phpdoc_type_to_var', - // 'phpdoc_var_to_type', // This is not supported by phpDoc2 anymore - 'phpdoc_var_without_name', - 'php_unit_construct', - // 'php_unit_strict', // We sometime actually need assertEquals - 'pre_increment', - 'print_to_echo', - 'psr0', - 'remove_leading_slash_use', - 'remove_lines_between_uses', - 'return', - 'self_accessor', - 'short_array_syntax', - 'short_bool_cast', - 'short_echo_tag', - 'short_tag', - 'single_array_no_trailing_comma', - 'single_blank_line_before_namespace', - 'single_line_after_imports', - 'single_quote', - 'spaces_before_semicolon', - 'spaces_cast', - 'standardize_not_equal', - // 'strict', // No, too dangerous to change that - // 'strict_param', // No, too dangerous to change that - // 'ternary_spaces', // That would be nice, but NetBeans does not cooperate :-( - 'trailing_spaces', - 'trim_array_spaces', - 'unalign_double_arrow', - 'unalign_equals', - 'unary_operators_spaces', - 'unneeded_control_parentheses', - 'unused_use', - 'visibility', - 'whitespacy_lines', - ]) - ->finder($finder); diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000..a8a78a9a --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,140 @@ +exclude('vendor') + ->in('samples') + ->in('src') + ->in('tests'); + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setRules([ + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => true, + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_return' => true, + 'braces' => true, + 'cast_spaces' => true, + 'class_definition' => true, + 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE + '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, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => true, + 'full_opening_tag' => true, + 'function_declaration' => 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, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => 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, + '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_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_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, + 'no_php4_constructor' => 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_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => 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, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => false, // We prefer to keep some freedom + 'ordered_imports' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_strict' => false, // We sometime actually need assertEquals 'phpdoc_align' => false, // Waste of time + '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_order' => 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' => true, + 'phpdoc_var_without_name' => true, + '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_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, + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'whitespace_after_comma_in_array' => true, + ]); diff --git a/composer.json b/composer.json index ad281332..95e570f8 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "squizlabs/php_codesniffer": "2.*", "phpunit/phpunit": "4.6.*", "mikey179/vfsStream": "1.5.*", - "friendsofphp/php-cs-fixer": "^1.11" + "friendsofphp/php-cs-fixer": "^2.0" }, "suggest": { "ext-zip": "Required to handle .xlsx .ods or .gnumeric files", diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..f409d70e --- /dev/null +++ b/composer.lock @@ -0,0 +1,1751 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "7244392042ac04174b9b0d5cf51129d0", + "content-hash": "230c3d270e3bfe7e52ffe59b6e65eaa7", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "f3baf72eb2f58bf275b372540f5b47d25aed910f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/f3baf72eb2f58bf275b372540f5b47d25aed910f", + "reference": "f3baf72eb2f58bf275b372540f5b47d25aed910f", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^5.3.6 || >=7.0 <7.2", + "sebastian/diff": "^1.1", + "symfony/console": "^2.3 || ^3.0", + "symfony/event-dispatcher": "^2.1 || ^3.0", + "symfony/filesystem": "^2.4 || ^3.0", + "symfony/finder": "^2.2 || ^3.0", + "symfony/polyfill-php54": "^1.0", + "symfony/process": "^2.3 || ^3.0", + "symfony/stopwatch": "^2.5 || ^3.0" + }, + "conflict": { + "hhvm": "<3.9" + }, + "require-dev": { + "gecko-packages/gecko-php-unit": "^2.0", + "phpunit/phpunit": "^4.5|^5", + "satooshi/php-coveralls": "^1.0" + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dariusz RumiƄski", + "email": "dariusz.ruminski@gmail.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2016-12-01 06:18:06" + }, + { + "name": "mikey179/vfsStream", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/4dc0d2f622412f561f5b242b19b98068bbbc883a", + "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/", + "time": "2015-03-29 11:19:49" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-06-10 09:48:41" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-06-10 07:14:17" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-06-07 08:13:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.6.10", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "7b5fe98b28302a8b25693b2298bca74463336975" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975", + "reference": "7b5fe98b28302a8b25693b2298bca74463336975", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "~1.3,>=1.3.1", + "phpunit/php-code-coverage": "~2.0,>=2.0.11", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.2", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.6.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2015-06-03 05:03:30" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-05-17 03:18:57" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17 09:04:28" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.6.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4edb770cb853def6e60c93abb088ad5ac2010c83", + "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2016-07-13 23:29:13" + }, + { + "name": "symfony/console", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/f9e638e8149e9e41b570ff092f8007c477ef0ce5", + "reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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 Console Component", + "homepage": "https://symfony.com", + "time": "2016-07-26 08:04:17" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5", + "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "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 EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2016-07-19 10:45:57" + }, + { + "name": "symfony/filesystem", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "bb29adceb552d202b6416ede373529338136e84f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb29adceb552d202b6416ede373529338136e84f", + "reference": "bb29adceb552d202b6416ede373529338136e84f", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "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 Filesystem Component", + "homepage": "https://symfony.com", + "time": "2016-07-20 05:44:26" + }, + { + "name": "symfony/finder", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "8201978de88a9fa0923e18601bb17f1df9c721e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/8201978de88a9fa0923e18601bb17f1df9c721e7", + "reference": "8201978de88a9fa0923e18601bb17f1df9c721e7", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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 Finder Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:41:56" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "dff51f72b0706335131b00a7f49606168c582594" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", + "reference": "dff51f72b0706335131b00a7f49606168c582594", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-05-18 14:26:46" + }, + { + "name": "symfony/polyfill-php54", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php54.git", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php54\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14 01:06:16" + }, + { + "name": "symfony/process", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/04c2dfaae4ec56a5c677b0c69fac34637d815758", + "reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "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 Process Component", + "homepage": "https://symfony.com", + "time": "2016-07-28 11:13:48" + }, + { + "name": "symfony/stopwatch", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/bb42806b12c5f89db4ebf64af6741afe6d8457e1", + "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "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 Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:41:56" + }, + { + "name": "symfony/yaml", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "1819adf2066880c7967df7180f4f662b6f0567ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/1819adf2066880c7967df7180f4f662b6f0567ac", + "reference": "1819adf2066880c7967df7180f4f662b6f0567ac", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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 Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-07-17 14:02:08" + }, + { + "name": "webmozart/assert", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-08-09 15:02:57" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.5|^7.0", + "ext-mbstring": "*", + "ext-iconv": "*", + "ext-xml": "*", + "ext-xmlwriter": "*" + }, + "platform-dev": [] +} diff --git a/src/Autoloader.php b/src/Autoloader.php index 262d2e68..98af41d7 100644 --- a/src/Autoloader.php +++ b/src/Autoloader.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Autoloader for PhpSpreadsheet classes + * Autoloader for PhpSpreadsheet classes. * * Copyright (c) 2006 - 2016 PhpSpreadsheet * @@ -22,13 +22,14 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Autoloader { /** - * Register the Autoloader with SPL + * Register the Autoloader with SPL. */ public static function register() { @@ -41,7 +42,7 @@ class Autoloader } /** - * Autoload a class identified by name + * Autoload a class identified by name. * * @param string $className Name of the object to load */ diff --git a/src/Bootstrap.php b/src/Bootstrap.php index f4dfb928..e517dbda 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -1,7 +1,7 @@ currentObjectID, '%[A-Z]%d', $column, $row); - return (integer) $row; + return (int) $row; } /** - * Get highest worksheet column + * Get highest worksheet column. * * @param string $row Return the highest column for the specified row, * or the highest column of any row if no row number is passed + * * @return string Highest column name */ public function getHighestColumn($row = null) @@ -268,10 +275,11 @@ abstract class CacheBase } /** - * Get highest worksheet row + * Get highest worksheet row. * * @param string $column Return the highest row for the specified column, * or the highest row of any column if no column letter is passed + * * @return int Highest row number */ public function getHighestRow($column = null) @@ -295,7 +303,7 @@ abstract class CacheBase } /** - * Generate a unique ID for cache referencing + * Generate a unique ID for cache referencing. * * @return string Unique Reference */ @@ -311,7 +319,7 @@ abstract class CacheBase } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to */ @@ -327,7 +335,7 @@ abstract class CacheBase } /** - * Remove a row, deleting all cells in that row + * Remove a row, deleting all cells in that row. * * @param string $row Row number to remove */ @@ -342,7 +350,7 @@ abstract class CacheBase } /** - * Remove a column, deleting all cells in that column + * Remove a column, deleting all cells in that column. * * @param string $column Column ID to remove */ @@ -358,7 +366,7 @@ abstract class CacheBase /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorage/DiscISAM.php b/src/PhpSpreadsheet/CachedObjectStorage/DiscISAM.php index 51d6d3b0..9bda9662 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/DiscISAM.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/DiscISAM.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class DiscISAM extends CacheBase implements ICache { /** - * Name of the file for this cache + * Name of the file for this cache. * * @var string */ private $fileName = null; /** - * File handle for this cache file + * File handle for this cache file. * * @var resource */ private $fileHandle = null; /** - * Directory/Folder where the cache file is located + * Directory/Folder where the cache file is located. * * @var string */ @@ -48,7 +49,7 @@ class DiscISAM extends CacheBase implements ICache /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -69,11 +70,13 @@ class DiscISAM extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -90,10 +93,12 @@ class DiscISAM extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -121,7 +126,7 @@ class DiscISAM extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -135,7 +140,7 @@ class DiscISAM extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to */ @@ -153,7 +158,7 @@ class DiscISAM extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -171,7 +176,7 @@ class DiscISAM extends CacheBase implements ICache } /** - * Initialise this new cell collection + * Initialise this new cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments @@ -191,7 +196,7 @@ class DiscISAM extends CacheBase implements ICache } /** - * Destroy this cell collection + * Destroy this cell collection. */ public function __destruct() { diff --git a/src/PhpSpreadsheet/CachedObjectStorage/ICache.php b/src/PhpSpreadsheet/CachedObjectStorage/ICache.php index 37f23643..a39b9335 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/ICache.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/ICache.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,43 +20,51 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ interface ICache { /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell); /** - * Add or Update a cell in cache + * Add or Update a cell in cache. * * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function updateCacheData(\PhpOffice\PhpSpreadsheet\Cell $cell); /** - * Fetch a cell from cache identified by coordinate address + * Fetch a cell from cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to retrieve + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord); /** - * Delete a cell in cache identified by coordinate address + * Delete a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to delete + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function deleteCacheData($pCoord); @@ -65,26 +73,27 @@ interface ICache * Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check + * * @return bool */ public function isDataSet($pCoord); /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ public function getCellList(); /** - * Get the list of all cell addresses currently held in cache sorted by column and row + * Get the list of all cell addresses currently held in cache sorted by column and row. * * @return string[] */ public function getSortedCellList(); /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to */ @@ -92,7 +101,7 @@ interface ICache /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorage/Igbinary.php b/src/PhpSpreadsheet/CachedObjectStorage/Igbinary.php index cfde6d03..dcd34d9b 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/Igbinary.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/Igbinary.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -27,7 +28,7 @@ class Igbinary extends CacheBase implements ICache { /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -40,14 +41,18 @@ class Igbinary extends CacheBase implements ICache $this->currentCellIsDirty = false; } $this->currentObjectID = $this->currentObject = null; - } // function _storeData() + } + + // function _storeData() /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -64,10 +69,12 @@ class Igbinary extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -91,10 +98,12 @@ class Igbinary extends CacheBase implements ICache // Return requested entry return $this->currentObject; - } // function getCacheData() + } + + // function getCacheData() /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -108,7 +117,7 @@ class Igbinary extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -120,11 +129,13 @@ class Igbinary extends CacheBase implements ICache // detach ourself from the worksheet, so that it can then delete this object successfully $this->parent = null; - } // function unsetWorksheetCells() + } + + // function unsetWorksheetCells() /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorage/Memcache.php b/src/PhpSpreadsheet/CachedObjectStorage/Memcache.php index b5e49737..b3323bb4 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/Memcache.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/Memcache.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Memcache extends CacheBase implements ICache { /** - * Prefix used to uniquely identify cache data for this worksheet + * Prefix used to uniquely identify cache data for this worksheet. * * @var string */ private $cachePrefix = null; /** - * Cache timeout + * Cache timeout. * * @var int */ private $cacheTime = 600; /** - * Memcache interface + * Memcache interface. * * @var resource */ @@ -48,7 +49,7 @@ class Memcache extends CacheBase implements ICache /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -70,11 +71,13 @@ class Memcache extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -95,7 +98,9 @@ class Memcache extends CacheBase implements ICache * Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function isDataSet($pCoord) @@ -120,10 +125,12 @@ class Memcache extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -157,7 +164,7 @@ class Memcache extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -171,9 +178,10 @@ class Memcache extends CacheBase implements ICache } /** - * Delete a cell in cache identified by coordinate address + * Delete a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to delete + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function deleteCacheData($pCoord) @@ -186,9 +194,10 @@ class Memcache extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent) @@ -216,7 +225,7 @@ class Memcache extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -235,10 +244,11 @@ class Memcache extends CacheBase implements ICache } /** - * Initialise this new cell collection + * Initialise this new cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection * @param mixed[] $arguments Additional initialisation arguments + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments) @@ -263,10 +273,11 @@ class Memcache extends CacheBase implements ICache } /** - * Memcache error handler + * Memcache error handler. * * @param string $host Memcache server * @param int $port Memcache port + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function failureCallback($host, $port) @@ -275,7 +286,7 @@ class Memcache extends CacheBase implements ICache } /** - * Destroy this cell collection + * Destroy this cell collection. */ public function __destruct() { @@ -287,7 +298,7 @@ class Memcache extends CacheBase implements ICache /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorage/Memory.php b/src/PhpSpreadsheet/CachedObjectStorage/Memory.php index ac6b8622..3b776de0 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/Memory.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/Memory.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,24 +20,27 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Memory extends CacheBase implements ICache { /** - * Dummy method callable from CacheBase, but unused by Memory cache + * Dummy method callable from CacheBase, but unused by Memory cache. */ protected function storeData() { } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -51,10 +54,12 @@ class Memory extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -74,7 +79,7 @@ class Memory extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to */ @@ -92,7 +97,7 @@ class Memory extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { diff --git a/src/PhpSpreadsheet/CachedObjectStorage/MemoryGZip.php b/src/PhpSpreadsheet/CachedObjectStorage/MemoryGZip.php index 910da211..7266c2e3 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/MemoryGZip.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/MemoryGZip.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -27,7 +28,7 @@ class MemoryGZip extends CacheBase implements ICache { /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -43,11 +44,13 @@ class MemoryGZip extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -64,10 +67,12 @@ class MemoryGZip extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -94,7 +99,7 @@ class MemoryGZip extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -108,7 +113,7 @@ class MemoryGZip extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { diff --git a/src/PhpSpreadsheet/CachedObjectStorage/MemorySerialized.php b/src/PhpSpreadsheet/CachedObjectStorage/MemorySerialized.php index a348be4f..55048389 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/MemorySerialized.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/MemorySerialized.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -27,7 +28,7 @@ class MemorySerialized extends CacheBase implements ICache { /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -43,11 +44,13 @@ class MemorySerialized extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -64,10 +67,12 @@ class MemorySerialized extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -94,7 +99,7 @@ class MemorySerialized extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -108,7 +113,7 @@ class MemorySerialized extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { diff --git a/src/PhpSpreadsheet/CachedObjectStorage/PHPTemp.php b/src/PhpSpreadsheet/CachedObjectStorage/PHPTemp.php index 47242d60..7624e279 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/PHPTemp.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/PHPTemp.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class PHPTemp extends CacheBase implements ICache { /** - * Name of the file for this cache + * Name of the file for this cache. * * @var string */ private $fileHandle = null; /** - * Memory limit to use before reverting to file cache + * Memory limit to use before reverting to file cache. * * @var int */ @@ -41,7 +42,7 @@ class PHPTemp extends CacheBase implements ICache /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -62,11 +63,13 @@ class PHPTemp extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -83,10 +86,12 @@ class PHPTemp extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -114,7 +119,7 @@ class PHPTemp extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -128,7 +133,7 @@ class PHPTemp extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to */ @@ -146,7 +151,7 @@ class PHPTemp extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -164,7 +169,7 @@ class PHPTemp extends CacheBase implements ICache } /** - * Initialise this new cell collection + * Initialise this new cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection * @param mixed[] $arguments Additional initialisation arguments @@ -180,7 +185,7 @@ class PHPTemp extends CacheBase implements ICache } /** - * Destroy this cell collection + * Destroy this cell collection. */ public function __destruct() { diff --git a/src/PhpSpreadsheet/CachedObjectStorage/SQLite.php b/src/PhpSpreadsheet/CachedObjectStorage/SQLite.php index fdc9ab71..0f66ac82 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/SQLite.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/SQLite.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class SQLite extends CacheBase implements ICache { /** - * Database table name + * Database table name. * * @var string */ private $TableName = null; /** - * Database handle + * Database handle. * * @var resource */ @@ -41,7 +42,7 @@ class SQLite extends CacheBase implements ICache /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -59,11 +60,13 @@ class SQLite extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -80,10 +83,12 @@ class SQLite extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -118,7 +123,9 @@ class SQLite extends CacheBase implements ICache * Is a value set for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function isDataSet($pCoord) @@ -141,9 +148,10 @@ class SQLite extends CacheBase implements ICache } /** - * Delete a cell in cache identified by coordinate address + * Delete a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to delete + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function deleteCacheData($pCoord) @@ -163,11 +171,13 @@ class SQLite extends CacheBase implements ICache } /** - * Move a cell object from one address to another + * Move a cell object from one address to another. * * @param string $fromAddress Current address of the cell to move * @param string $toAddress Destination address of the cell to move + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function moveCell($fromAddress, $toAddress) @@ -192,9 +202,10 @@ class SQLite extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return string[] */ public function getCellList() @@ -218,9 +229,10 @@ class SQLite extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent) @@ -241,7 +253,7 @@ class SQLite extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -257,9 +269,10 @@ class SQLite extends CacheBase implements ICache } /** - * Initialise this new cell collection + * Initialise this new cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent) @@ -280,7 +293,7 @@ class SQLite extends CacheBase implements ICache } /** - * Destroy this cell collection + * Destroy this cell collection. */ public function __destruct() { @@ -292,7 +305,7 @@ class SQLite extends CacheBase implements ICache /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php b/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php index f140b932..f18516f8 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,48 +20,49 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class SQLite3 extends CacheBase implements ICache { /** - * Database table name + * Database table name. * * @var string */ private $TableName = null; /** - * Database handle + * Database handle. * * @var resource */ private $DBHandle = null; /** - * Prepared statement for a SQLite3 select query + * Prepared statement for a SQLite3 select query. * * @var SQLite3Stmt */ private $selectQuery; /** - * Prepared statement for a SQLite3 insert query + * Prepared statement for a SQLite3 insert query. * * @var SQLite3Stmt */ private $insertQuery; /** - * Prepared statement for a SQLite3 update query + * Prepared statement for a SQLite3 update query. * * @var SQLite3Stmt */ private $updateQuery; /** - * Prepared statement for a SQLite3 delete query + * Prepared statement for a SQLite3 delete query. * * @var SQLite3Stmt */ @@ -69,7 +70,7 @@ class SQLite3 extends CacheBase implements ICache /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -90,11 +91,13 @@ class SQLite3 extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -111,11 +114,13 @@ class SQLite3 extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -151,7 +156,9 @@ class SQLite3 extends CacheBase implements ICache * Is a value set for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function isDataSet($pCoord) @@ -172,9 +179,10 @@ class SQLite3 extends CacheBase implements ICache } /** - * Delete a cell in cache identified by coordinate address + * Delete a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to delete + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function deleteCacheData($pCoord) @@ -195,11 +203,13 @@ class SQLite3 extends CacheBase implements ICache } /** - * Move a cell object from one address to another + * Move a cell object from one address to another. * * @param string $fromAddress Current address of the cell to move * @param string $toAddress Destination address of the cell to move + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function moveCell($fromAddress, $toAddress) @@ -225,9 +235,10 @@ class SQLite3 extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return string[] */ public function getCellList() @@ -251,9 +262,10 @@ class SQLite3 extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent) @@ -274,7 +286,7 @@ class SQLite3 extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -290,9 +302,10 @@ class SQLite3 extends CacheBase implements ICache } /** - * Initialise this new cell collection + * Initialise this new cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent) @@ -318,7 +331,7 @@ class SQLite3 extends CacheBase implements ICache } /** - * Destroy this cell collection + * Destroy this cell collection. */ public function __destruct() { @@ -331,7 +344,7 @@ class SQLite3 extends CacheBase implements ICache /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php b/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php index 40a26a52..bec52f05 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/Wincache.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Wincache extends CacheBase implements ICache { /** - * Prefix used to uniquely identify cache data for this worksheet + * Prefix used to uniquely identify cache data for this worksheet. * * @var string */ private $cachePrefix = null; /** - * Cache timeout + * Cache timeout. * * @var int */ @@ -41,7 +42,7 @@ class Wincache extends CacheBase implements ICache /** * Store cell data in cache for the current cell object if it's "dirty", - * and the 'nullify' the current cell object + * and the 'nullify' the current cell object. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -69,11 +70,13 @@ class Wincache extends CacheBase implements ICache } /** - * Add or Update a cell in cache identified by coordinate address + * Add or Update a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to update * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell */ public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell) @@ -94,7 +97,9 @@ class Wincache extends CacheBase implements ICache * Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function isDataSet($pCoord) @@ -119,10 +124,12 @@ class Wincache extends CacheBase implements ICache } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoord Coordinate of the cell + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) @@ -158,7 +165,7 @@ class Wincache extends CacheBase implements ICache } /** - * Get a list of all cell addresses currently held in cache + * Get a list of all cell addresses currently held in cache. * * @return string[] */ @@ -172,9 +179,10 @@ class Wincache extends CacheBase implements ICache } /** - * Delete a cell in cache identified by coordinate address + * Delete a cell in cache identified by coordinate address. * * @param string $pCoord Coordinate address of the cell to delete + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function deleteCacheData($pCoord) @@ -187,9 +195,10 @@ class Wincache extends CacheBase implements ICache } /** - * Clone the cell collection + * Clone the cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent) @@ -218,7 +227,7 @@ class Wincache extends CacheBase implements ICache } /** - * Clear the cell collection and disconnect from our parent + * Clear the cell collection and disconnect from our parent. */ public function unsetWorksheetCells() { @@ -237,7 +246,7 @@ class Wincache extends CacheBase implements ICache } /** - * Initialise this new cell collection + * Initialise this new cell collection. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection * @param mixed[] $arguments Additional initialisation arguments @@ -256,7 +265,7 @@ class Wincache extends CacheBase implements ICache } /** - * Destroy this cell collection + * Destroy this cell collection. */ public function __destruct() { @@ -268,7 +277,7 @@ class Wincache extends CacheBase implements ICache /** * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build. * * @return bool */ diff --git a/src/PhpSpreadsheet/CachedObjectStorageFactory.php b/src/PhpSpreadsheet/CachedObjectStorageFactory.php index 8dc37576..a8c1e4b5 100644 --- a/src/PhpSpreadsheet/CachedObjectStorageFactory.php +++ b/src/PhpSpreadsheet/CachedObjectStorageFactory.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -38,21 +39,21 @@ class CachedObjectStorageFactory const CACHE_TO_SQLITE3 = 'SQLite3'; /** - * Name of the method used for cell cacheing + * Name of the method used for cell cacheing. * * @var string */ private static $cacheStorageMethod; /** - * Name of the class used for cell cacheing + * Name of the class used for cell cacheing. * * @var string */ private static $cacheStorageClass; /** - * List of all possible cache storage methods + * List of all possible cache storage methods. * * @var string[] */ @@ -71,7 +72,7 @@ class CachedObjectStorageFactory ]; /** - * Default arguments for each cache storage method + * Default arguments for each cache storage method. * * @var array of mixed array */ @@ -102,14 +103,14 @@ class CachedObjectStorageFactory ]; /** - * Arguments for the active cache storage method + * Arguments for the active cache storage method. * * @var mixed[] */ private static $storageMethodParameters = []; /** - * Return the current cache storage method + * Return the current cache storage method. * * @return string|null **/ @@ -119,7 +120,7 @@ class CachedObjectStorageFactory } /** - * Return the current cache storage class + * Return the current cache storage class. * * @return string **/ @@ -129,7 +130,7 @@ class CachedObjectStorageFactory } /** - * Return the list of all possible cache storage methods + * Return the list of all possible cache storage methods. * * @return string[] **/ @@ -139,7 +140,7 @@ class CachedObjectStorageFactory } /** - * Return the list of all available cache storage methods + * Return the list of all available cache storage methods. * * @return string[] **/ @@ -157,11 +158,12 @@ class CachedObjectStorageFactory } /** - * Identify the cache storage method to use + * Identify the cache storage method to use. * * @param string $method Name of the method to use for cell cacheing * @param mixed[] $arguments Additional arguments to pass to the cell caching class * when instantiating + * * @return bool **/ public static function initialize($method = self::CACHE_IN_MEMORY, $arguments = []) @@ -191,9 +193,10 @@ class CachedObjectStorageFactory } /** - * Initialise the cache storage + * Initialise the cache storage. * * @param Worksheet $parent Enable cell caching for this worksheet + * * @return CachedObjectStorage\ICache **/ public static function getInstance(Worksheet $parent) @@ -217,7 +220,7 @@ class CachedObjectStorageFactory } /** - * Clear the cache storage + * Clear the cache storage. **/ public static function finalize() { diff --git a/src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php b/src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php index 1d0eddf3..fad3e6b4 100644 --- a/src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php +++ b/src/PhpSpreadsheet/CalcEngine/CyclicReferenceStack.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CalcEngine; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\CalcEngine; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class CyclicReferenceStack { /** - * The call stack for calculated cells + * The call stack for calculated cells. * * @var mixed[] */ private $stack = []; /** - * Return the number of entries on the stack + * Return the number of entries on the stack. * * @return int */ @@ -43,7 +44,7 @@ class CyclicReferenceStack } /** - * Push a new entry onto the stack + * Push a new entry onto the stack. * * @param mixed $value */ @@ -53,7 +54,7 @@ class CyclicReferenceStack } /** - * Pop the last entry from the stack + * Pop the last entry from the stack. * * @return mixed */ @@ -63,7 +64,7 @@ class CyclicReferenceStack } /** - * Test to see if a specified entry exists on the stack + * Test to see if a specified entry exists on the stack. * * @param mixed $value The value to test */ @@ -73,7 +74,7 @@ class CyclicReferenceStack } /** - * Clear the stack + * Clear the stack. */ public function clear() { @@ -81,7 +82,7 @@ class CyclicReferenceStack } /** - * Return an array of all entries on the stack + * Return an array of all entries on the stack. * * @return mixed[] */ diff --git a/src/PhpSpreadsheet/CalcEngine/Logger.php b/src/PhpSpreadsheet/CalcEngine/Logger.php index 865a6868..b81fd9ff 100644 --- a/src/PhpSpreadsheet/CalcEngine/Logger.php +++ b/src/PhpSpreadsheet/CalcEngine/Logger.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\CalcEngine; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\CalcEngine; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -28,7 +29,7 @@ class Logger /** * Flag to determine whether a debug log should be generated by the calculation engine * If true, then a debug log will be generated - * If false, then a debug log will not be generated + * If false, then a debug log will not be generated. * * @var bool */ @@ -38,28 +39,28 @@ class Logger * Flag to determine whether a debug log should be echoed by the calculation engine * If true, then a debug log will be echoed * If false, then a debug log will not be echoed - * A debug log can only be echoed if it is generated + * A debug log can only be echoed if it is generated. * * @var bool */ private $echoDebugLog = false; /** - * The debug log generated by the calculation engine + * The debug log generated by the calculation engine. * * @var string[] */ private $debugLog = []; /** - * The calculation engine cell reference stack + * The calculation engine cell reference stack. * * @var CyclicReferenceStack */ private $cellStack; /** - * Instantiate a Calculation engine logger + * Instantiate a Calculation engine logger. * * @param CyclicReferenceStack $stack */ @@ -69,7 +70,7 @@ class Logger } /** - * Enable/Disable Calculation engine logging + * Enable/Disable Calculation engine logging. * * @param bool $pValue */ @@ -79,7 +80,7 @@ class Logger } /** - * Return whether calculation engine logging is enabled or disabled + * Return whether calculation engine logging is enabled or disabled. * * @return bool */ @@ -89,7 +90,7 @@ class Logger } /** - * Enable/Disable echoing of debug log information + * Enable/Disable echoing of debug log information. * * @param bool $pValue */ @@ -99,7 +100,7 @@ class Logger } /** - * Return whether echoing of debug log information is enabled or disabled + * Return whether echoing of debug log information is enabled or disabled. * * @return bool */ @@ -109,7 +110,7 @@ class Logger } /** - * Write an entry to the calculation engine debug log + * Write an entry to the calculation engine debug log. */ public function writeDebugLog() { @@ -130,7 +131,7 @@ class Logger } /** - * Clear the calculation engine debug log + * Clear the calculation engine debug log. */ public function clearLog() { @@ -138,7 +139,7 @@ class Logger } /** - * Return the calculation engine debug log + * Return the calculation engine debug log. * * @return string[] */ diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index 146a7348..9fcb0e41 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -20,7 +20,7 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) { } /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,13 +37,14 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) { * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Calculation { /** Constants */ -/** Regular Expressions */ + /** Regular Expressions */ // Numeric operand const CALCULATION_REGEXP_NUMBER = '[-+]?\d*\.?\d+(e[-+]?\d+)?'; // String operand @@ -67,35 +68,35 @@ class Calculation private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE; /** - * Instance of this class + * Instance of this class. * * @var \PhpOffice\PhpSpreadsheet\Calculation */ private static $instance; /** - * Instance of the spreadsheet this Calculation Engine is using + * Instance of the spreadsheet this Calculation Engine is using. * * @var PhpSpreadsheet */ private $spreadsheet; /** - * List of instances of the calculation engine that we've instantiated for individual spreadsheets + * List of instances of the calculation engine that we've instantiated for individual spreadsheets. * * @var \PhpOffice\PhpSpreadsheet\Calculation[] */ private static $spreadsheetSets; /** - * Calculation cache + * Calculation cache. * * @var array */ private $calculationCache = []; /** - * Calculation cache enabled + * Calculation cache enabled. * * @var bool */ @@ -103,7 +104,7 @@ class Calculation /** * List of operators that can be used within formulae - * The true/false value indicates whether it is a binary operator or a unary operator + * The true/false value indicates whether it is a binary operator or a unary operator. * * @var array */ @@ -115,7 +116,7 @@ class Calculation ]; /** - * List of binary operators (those that expect two operands) + * List of binary operators (those that expect two operands). * * @var array */ @@ -127,7 +128,7 @@ class Calculation ]; /** - * The debug log generated by the calculation engine + * The debug log generated by the calculation engine. * * @var CalcEngine\Logger */ @@ -136,21 +137,21 @@ class Calculation /** * Flag to determine how formula errors should be handled * If true, then a user error will be triggered - * If false, then an exception will be thrown + * If false, then an exception will be thrown. * * @var bool */ public $suppressFormulaErrors = false; /** - * Error message for any error that was raised/thrown by the calculation engine + * Error message for any error that was raised/thrown by the calculation engine. * * @var string */ public $formulaError = null; /** - * An array of the nested cell references accessed by the calculation engine, used for the debug log + * An array of the nested cell references accessed by the calculation engine, used for the debug log. * * @var array of string */ @@ -161,7 +162,7 @@ class Calculation /** * Current iteration counter for cyclic formulae * If the value is 0 (or less) then cyclic formulae will throw an exception, - * otherwise they will iterate to the limit defined here before returning a result + * otherwise they will iterate to the limit defined here before returning a result. * * @var int */ @@ -170,21 +171,21 @@ class Calculation private $cyclicFormulaCell = ''; /** - * Number of iterations for cyclic formulae + * Number of iterations for cyclic formulae. * * @var int */ public $cyclicFormulaCount = 1; /** - * Epsilon Precision used for comparisons in calculations + * Epsilon Precision used for comparisons in calculations. * * @var float */ private $delta = 0.1e-12; /** - * The current locale setting + * The current locale setting. * * @var string */ @@ -192,7 +193,7 @@ class Calculation /** * List of available locale settings - * Note that this is read for the locale subdirectory only when requested + * Note that this is read for the locale subdirectory only when requested. * * @var string[] */ @@ -201,7 +202,7 @@ class Calculation ]; /** - * Locale-specific argument separator for function arguments + * Locale-specific argument separator for function arguments. * * @var string */ @@ -209,7 +210,7 @@ class Calculation private static $localeFunctions = []; /** - * Locale-specific translations for Excel constants (True, False and Null) + * Locale-specific translations for Excel constants (True, False and Null). * * @var string[] */ @@ -221,7 +222,7 @@ class Calculation /** * Excel constant string translations to their PHP equivalents - * Constant conversion from text name/value to actual (datatyped) value + * Constant conversion from text name/value to actual (datatyped) value. * * @var string[] */ @@ -2045,10 +2046,11 @@ class Calculation } /** - * Get an instance of this class + * Get an instance of this class. * * @param Spreadsheet $spreadsheet Injected spreadsheet for working with a PhpSpreadsheet Spreadsheet object, * or NULL to create a standalone claculation engine + * * @return Calculation */ public static function getInstance(Spreadsheet $spreadsheet = null) @@ -2068,7 +2070,7 @@ class Calculation } /** - * Unset an instance of this class + * Unset an instance of this class. * * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset */ @@ -2079,7 +2081,7 @@ class Calculation /** * Flush the calculation cache for any existing instance of this class - * but only if a \PhpOffice\PhpSpreadsheet\Calculation instance exists + * but only if a \PhpOffice\PhpSpreadsheet\Calculation instance exists. */ public function flushInstance() { @@ -2087,7 +2089,7 @@ class Calculation } /** - * Get the debuglog for this claculation engine instance + * Get the debuglog for this claculation engine instance. * * @return CalcEngine\Logger */ @@ -2107,7 +2109,7 @@ class Calculation } /** - * Return the locale-specific translation of TRUE + * Return the locale-specific translation of TRUE. * * @return string locale-specific translation of TRUE */ @@ -2117,7 +2119,7 @@ class Calculation } /** - * Return the locale-specific translation of FALSE + * Return the locale-specific translation of FALSE. * * @return string locale-specific translation of FALSE */ @@ -2127,9 +2129,10 @@ class Calculation } /** - * Set the Array Return Type (Array or Value of first element in the array) + * Set the Array Return Type (Array or Value of first element in the array). * * @param string $returnType Array return type + * * @return bool Success or failure */ public static function setArrayReturnType($returnType) @@ -2146,7 +2149,7 @@ class Calculation } /** - * Return the Array Return Type (Array or Value of first element in the array) + * Return the Array Return Type (Array or Value of first element in the array). * * @return string $returnType Array return type */ @@ -2166,7 +2169,7 @@ class Calculation } /** - * Enable/disable calculation cache + * Enable/disable calculation cache. * * @param bool $pValue */ @@ -2177,7 +2180,7 @@ class Calculation } /** - * Enable calculation cache + * Enable calculation cache. */ public function enableCalculationCache() { @@ -2185,7 +2188,7 @@ class Calculation } /** - * Disable calculation cache + * Disable calculation cache. */ public function disableCalculationCache() { @@ -2193,7 +2196,7 @@ class Calculation } /** - * Clear calculation cache + * Clear calculation cache. */ public function clearCalculationCache() { @@ -2201,7 +2204,7 @@ class Calculation } /** - * Clear calculation cache for a specified worksheet + * Clear calculation cache for a specified worksheet. * * @param string $worksheetName */ @@ -2213,7 +2216,7 @@ class Calculation } /** - * Rename calculation cache for a specified worksheet + * Rename calculation cache for a specified worksheet. * * @param string $fromWorksheetName * @param string $toWorksheetName @@ -2227,7 +2230,7 @@ class Calculation } /** - * Get the currently defined locale code + * Get the currently defined locale code. * * @return string */ @@ -2237,9 +2240,10 @@ class Calculation } /** - * Set the locale code + * Set the locale code. * * @param string $locale The locale to use for formula translation + * * @return bool */ public function setLocale($locale = 'en_us') @@ -2347,6 +2351,9 @@ class Calculation /** * @param string $fromSeparator * @param string $toSeparator + * @param mixed $from + * @param mixed $to + * @param mixed $formula */ private static function translateFormula($from, $to, $formula, $fromSeparator, $toSeparator) { @@ -2452,9 +2459,10 @@ class Calculation } /** - * Wrap string values in quotes + * Wrap string values in quotes. * * @param mixed $value + * * @return mixed */ public static function wrapResult($value) @@ -2476,15 +2484,16 @@ class Calculation } /** - * Remove quotes used as a wrapper to identify string values + * Remove quotes used as a wrapper to identify string values. * * @param mixed $value + * * @return mixed */ public static function unwrapResult($value) { if (is_string($value)) { - if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) { + if ((isset($value[0])) && ($value[0] == '"') && (substr($value, -1) == '"')) { return substr($value, 1, -1); } // Convert numeric errors to NAN error @@ -2497,10 +2506,12 @@ class Calculation /** * Calculate cell value (using formula from a cell ID) - * Retained for backward compatibility + * Retained for backward compatibility. * * @param Cell $pCell Cell to calculate + * * @throws Calculation\Exception + * * @return mixed */ public function calculate(Cell $pCell = null) @@ -2513,11 +2524,13 @@ class Calculation } /** - * Calculate the value of a cell formula + * Calculate the value of a cell formula. * * @param Cell $pCell Cell to calculate * @param bool $resetLog Flag indicating whether the debug log should be reset or not + * * @throws Calculation\Exception + * * @return mixed */ public function calculateCellValue(Cell $pCell = null, $resetLog = true) @@ -2588,10 +2601,12 @@ class Calculation } /** - * Validate and parse a formula string + * Validate and parse a formula string. * * @param string $formula Formula to parse + * * @throws Calculation\Exception + * * @return array */ public function parseFormula($formula) @@ -2599,11 +2614,11 @@ class Calculation // Basic validation that this is indeed a formula // We return an empty array if not $formula = trim($formula); - if ((!isset($formula{0})) || ($formula{0} != '=')) { + if ((!isset($formula[0])) || ($formula[0] != '=')) { return []; } $formula = ltrim(substr($formula, 1)); - if (!isset($formula{0})) { + if (!isset($formula[0])) { return []; } @@ -2612,12 +2627,14 @@ class Calculation } /** - * Calculate the value of a formula + * Calculate the value of a formula. * * @param string $formula Formula to parse * @param string $cellID Address of the cell to calculate * @param Cell $pCell Cell to calculate + * * @throws Calculation\Exception + * * @return mixed */ public function calculateFormula($formula, $cellID = null, Cell $pCell = null) @@ -2670,6 +2687,7 @@ class Calculation /** * @param string $cellReference + * @param mixed $cellValue */ public function saveValueToCache($cellReference, $cellValue) { @@ -2679,12 +2697,14 @@ class Calculation } /** - * Parse a cell formula and calculate its value + * Parse a cell formula and calculate its value. * * @param string $formula The formula to parse and calculate * @param string $cellID The ID (e.g. A3) of the cell that we are calculating * @param Cell $pCell Cell to calculate + * * @throws Calculation\Exception + * * @return mixed */ public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null) @@ -2694,11 +2714,11 @@ class Calculation // Basic validation that this is indeed a formula // We simply return the cell value if not $formula = trim($formula); - if ($formula{0} != '=') { + if ($formula[0] != '=') { return self::wrapResult($formula); } $formula = ltrim(substr($formula, 1)); - if (!isset($formula{0})) { + if (!isset($formula[0])) { return self::wrapResult($formula); } @@ -2710,7 +2730,7 @@ class Calculation return $cellValue; } - if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { + if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { if ($this->cyclicFormulaCount <= 0) { $this->cyclicFormulaCell = ''; @@ -2745,7 +2765,7 @@ class Calculation } /** - * Ensure that paired matrix operands are both matrices and of the same size + * Ensure that paired matrix operands are both matrices and of the same size. * * @param mixed &$operand1 First matrix operand * @param mixed &$operand2 Second matrix operand @@ -2788,9 +2808,10 @@ class Calculation } /** - * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0 + * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0. * * @param mixed &$matrix matrix operand + * * @return int[] An array comprising the number of rows, and number of columns */ private static function getMatrixDimensions(&$matrix) @@ -2811,7 +2832,7 @@ class Calculation } /** - * Ensure that paired matrix operands are both matrices of the same size + * Ensure that paired matrix operands are both matrices of the same size. * * @param mixed &$matrix1 First matrix operand * @param mixed &$matrix2 Second matrix operand @@ -2854,7 +2875,7 @@ class Calculation } /** - * Ensure that paired matrix operands are both matrices of the same size + * Ensure that paired matrix operands are both matrices of the same size. * * @param mixed &$matrix1 First matrix operand * @param mixed &$matrix2 Second matrix operand @@ -2901,9 +2922,10 @@ class Calculation } /** - * Format details of an operand for display in the log (based on operand type) + * Format details of an operand for display in the log (based on operand type). * * @param mixed $value First matrix operand + * * @return mixed */ private function showValue($value) @@ -2938,9 +2960,10 @@ class Calculation } /** - * Format type and details of an operand for display in the log (based on operand type) + * Format type and details of an operand for display in the log (based on operand type). * * @param mixed $value First matrix operand + * * @return string|null */ private function showTypeDetails($value) @@ -2964,11 +2987,10 @@ class Calculation } else { if ($value == '') { return 'an empty string'; - } elseif ($value{0} == '#') { + } elseif ($value[0] == '#') { return 'a ' . $value . ' error'; - } else { - $typeString = 'a string'; } + $typeString = 'a string'; } return $typeString . ' with a value of ' . $this->showValue($value); @@ -3011,15 +3033,15 @@ class Calculation if ($openCount < $closeCount) { if ($openCount > 0) { return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '}'"); - } else { - return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered"); } + + return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered"); } elseif ($openCount > $closeCount) { if ($closeCount > 0) { return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '{'"); - } else { - return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered"); } + + return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered"); } } @@ -3093,9 +3115,9 @@ class Calculation // The guts of the lexical parser // Loop through the formula extracting each operator and operand in turn while (true) { - $opCharacter = $formula{$index}; // Get the first character of the value at the current index position - if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index + 1}]))) { - $opCharacter .= $formula{++$index}; + $opCharacter = $formula[$index]; // Get the first character of the value at the current index position + if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula[$index + 1]]))) { + $opCharacter .= $formula[++$index]; } // Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand @@ -3126,9 +3148,8 @@ class Calculation while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( if ($o2 === null) { return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); - } else { - $output[] = $o2; } + $output[] = $o2; } $d = $stack->last(2); if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? @@ -3192,9 +3213,8 @@ class Calculation while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( if ($o2 === null) { return $this->raiseFormulaError('Formula Error: Unexpected ,'); - } else { - $output[] = $o2; // pop the argument expression stuff and push onto the output } + $output[] = $o2; // pop the argument expression stuff and push onto the output } // If we've a comma when we're expecting an operand, then what we actually have is a null operand; // so push a null onto the stack @@ -3278,7 +3298,7 @@ class Calculation if ($rangeWS2 != '') { $rangeWS2 .= '!'; } - if ((is_integer($startRowColRef)) && (ctype_digit($val)) && + if ((is_int($startRowColRef)) && (ctype_digit($val)) && ($startRowColRef <= 1048576) && ($val <= 1048576)) { // Row range $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 @@ -3301,7 +3321,7 @@ class Calculation if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) { $val = (float) $val; } else { - $val = (integer) $val; + $val = (int) $val; } } elseif (isset(self::$excelConstants[trim(strtoupper($val))])) { $excelConstant = trim(strtoupper($val)); @@ -3337,16 +3357,15 @@ class Calculation // Only valid for the % unary operator if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) { return $this->raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands"); - } else { - break; } + break; } // Ignore white space - while (($formula{$index} == "\n") || ($formula{$index} == "\r")) { + while (($formula[$index] == "\n") || ($formula[$index] == "\r")) { ++$index; } - if ($formula{$index} == ' ') { - while ($formula{$index} == ' ') { + if ($formula[$index] == ' ') { + while ($formula[$index] == ' ') { ++$index; } // If we're expecting an operator, but only have a space between the previous and next operands (and both are @@ -3395,6 +3414,7 @@ class Calculation /** * @param string $cellID + * @param mixed $tokens */ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null) { @@ -3734,7 +3754,7 @@ class Calculation $excelConstant = strtoupper($token); $stack->push('Constant Value', self::$excelConstants[$excelConstant]); $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} == '#')) { + } 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 } elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) { @@ -3775,13 +3795,13 @@ class Calculation if (is_string($operand)) { // We only need special validations for the operand if it is a string // Start by stripping off the quotation marks we use to identify true excel string values internally - if ($operand > '' && $operand{0} == '"') { + if ($operand > '' && $operand[0] == '"') { $operand = self::unwrapResult($operand); } // If the string is a numeric value, we treat it as a numeric, so no further testing if (!is_numeric($operand)) { // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations - if ($operand > '' && $operand{0} == '#') { + if ($operand > '' && $operand[0] == '#') { $stack->push('Value', $operand); $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand)); @@ -3839,10 +3859,10 @@ class Calculation } // Simple validate the two operands if they are string values - if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') { + if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') { $operand1 = self::unwrapResult($operand1); } - if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') { + if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') { $operand2 = self::unwrapResult($operand2); } @@ -3923,9 +3943,11 @@ class Calculation } /** - * Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters + * Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters. + * * @param string $str1 First string value for the comparison * @param string $str2 Second string value for the comparison + * * @return int */ private function strcmpLowercaseFirst($str1, $str2) @@ -3938,6 +3960,10 @@ class Calculation /** * @param string $matrixFunction + * @param mixed $cellID + * @param mixed $operand1 + * @param mixed $operand2 + * @param mixed $operation */ private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack) { @@ -3994,9 +4020,9 @@ class Calculation $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!')); return false; - } else { - $result = $operand1 / $operand2; } + $result = $operand1 / $operand2; + break; // Power case '^': @@ -4026,12 +4052,14 @@ class Calculation } /** - * Extract range values + * Extract range values. * * @param string &$pRange String based range representation * @param Worksheet $pSheet Worksheet * @param bool $resetLog Flag indicating whether calculation log should be reset or not + * * @throws Calculation\Exception + * * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. */ public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) @@ -4077,12 +4105,14 @@ class Calculation } /** - * Extract range values + * Extract range values. * * @param string &$pRange String based range representation * @param Worksheet $pSheet Worksheet * @param bool $resetLog Flag indicating whether calculation log should be reset or not + * * @throws Calculation\Exception + * * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. */ public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) @@ -4146,6 +4176,7 @@ class Calculation * Is a specific function implemented? * * @param string $pFunction Function Name + * * @return bool */ public function isImplemented($pFunction = '') @@ -4153,13 +4184,13 @@ class Calculation $pFunction = strtoupper($pFunction); if (isset(self::$phpSpreadsheetFunctions[$pFunction])) { return self::$phpSpreadsheetFunctions[$pFunction]['functionCall'] !== '\\PhpOffice\\PhpSpreadsheet\\Calculation\\Functions::DUMMY'; - } else { - return false; } + + return false; } /** - * Get a list of all implemented functions as an array of function objects + * Get a list of all implemented functions as an array of function objects. * * @return array of Calculation\Category */ @@ -4169,7 +4200,7 @@ class Calculation } /** - * Get a list of implemented Excel function names + * Get a list of implemented Excel function names. * * @return array */ diff --git a/src/PhpSpreadsheet/Calculation/Category.php b/src/PhpSpreadsheet/Calculation/Category.php index 75a977f2..ae876516 100644 --- a/src/PhpSpreadsheet/Calculation/Category.php +++ b/src/PhpSpreadsheet/Calculation/Category.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ diff --git a/src/PhpSpreadsheet/Calculation/Database.php b/src/PhpSpreadsheet/Calculation/Database.php index ea50c98c..90c97f25 100644 --- a/src/PhpSpreadsheet/Calculation/Database.php +++ b/src/PhpSpreadsheet/Calculation/Database.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Database { /** - * fieldExtract + * fieldExtract. * * Extracts the column ID to use for the data field. * @@ -39,6 +40,7 @@ class Database * "Age" or "Yield," or a number (without quotation marks) that * represents the position of the column within the list: 1 for * the first column, 2 for the second column, and so on. + * * @return string|null */ private static function fieldExtract($database, $field) @@ -57,7 +59,7 @@ class Database } /** - * filter + * filter. * * Parses the selection criteria, extracts the database rows that match those criteria, and * returns that subset of rows. @@ -71,6 +73,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return array of mixed */ private static function filter($database, $criteria) @@ -142,7 +145,7 @@ class Database } /** - * DAVERAGE + * DAVERAGE. * * Averages the values in a column of a list or database that match conditions you specify. * @@ -150,6 +153,7 @@ class Database * DAVERAGE(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -164,6 +168,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DAVERAGE($database, $field, $criteria) @@ -180,7 +185,7 @@ class Database } /** - * DCOUNT + * DCOUNT. * * Counts the cells that contain numbers in a column of a list or database that match conditions * that you specify. @@ -192,6 +197,7 @@ class Database * DAVERAGE(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -206,6 +212,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return int * * @TODO The field argument is optional. If field is omitted, DCOUNT counts all records in the @@ -225,7 +232,7 @@ class Database } /** - * DCOUNTA + * DCOUNTA. * * Counts the nonblank cells in a column of a list or database that match conditions that you specify. * @@ -233,6 +240,7 @@ class Database * DCOUNTA(database,[field],criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -247,6 +255,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return int * * @TODO The field argument is optional. If field is omitted, DCOUNTA counts all records in the @@ -274,7 +283,7 @@ class Database } /** - * DGET + * DGET. * * Extracts a single value from a column of a list or database that matches conditions that you * specify. @@ -283,6 +292,7 @@ class Database * DGET(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -297,6 +307,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return mixed */ public static function DGET($database, $field, $criteria) @@ -316,7 +327,7 @@ class Database } /** - * DMAX + * DMAX. * * Returns the largest number in a column of a list or database that matches conditions you that * specify. @@ -325,6 +336,7 @@ class Database * DMAX(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -339,6 +351,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DMAX($database, $field, $criteria) @@ -355,7 +368,7 @@ class Database } /** - * DMIN + * DMIN. * * Returns the smallest number in a column of a list or database that matches conditions you that * specify. @@ -364,6 +377,7 @@ class Database * DMIN(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -378,6 +392,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DMIN($database, $field, $criteria) @@ -394,7 +409,7 @@ class Database } /** - * DPRODUCT + * DPRODUCT. * * Multiplies the values in a column of a list or database that match conditions that you specify. * @@ -402,6 +417,7 @@ class Database * DPRODUCT(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -416,6 +432,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DPRODUCT($database, $field, $criteria) @@ -432,7 +449,7 @@ class Database } /** - * DSTDEV + * DSTDEV. * * Estimates the standard deviation of a population based on a sample by using the numbers in a * column of a list or database that match conditions that you specify. @@ -441,6 +458,7 @@ class Database * DSTDEV(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -455,6 +473,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DSTDEV($database, $field, $criteria) @@ -471,7 +490,7 @@ class Database } /** - * DSTDEVP + * DSTDEVP. * * Calculates the standard deviation of a population based on the entire population by using the * numbers in a column of a list or database that match conditions that you specify. @@ -480,6 +499,7 @@ class Database * DSTDEVP(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -494,6 +514,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DSTDEVP($database, $field, $criteria) @@ -510,7 +531,7 @@ class Database } /** - * DSUM + * DSUM. * * Adds the numbers in a column of a list or database that match conditions that you specify. * @@ -518,6 +539,7 @@ class Database * DSUM(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -532,6 +554,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DSUM($database, $field, $criteria) @@ -548,7 +571,7 @@ class Database } /** - * DVAR + * DVAR. * * Estimates the variance of a population based on a sample by using the numbers in a column * of a list or database that match conditions that you specify. @@ -557,6 +580,7 @@ class Database * DVAR(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -571,6 +595,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DVAR($database, $field, $criteria) @@ -587,7 +612,7 @@ class Database } /** - * DVARP + * DVARP. * * Calculates the variance of a population based on the entire population by using the numbers * in a column of a list or database that match conditions that you specify. @@ -596,6 +621,7 @@ class Database * DVARP(database,field,criteria) * * @category Database Functions + * * @param mixed[] $database The range of cells that makes up the list or database. * A database is a list of related data in which rows of related * information are records, and columns of data are fields. The @@ -610,6 +636,7 @@ class Database * includes at least one column label and at least one cell below * the column label in which you specify a condition for the * column. + * * @return float */ public static function DVARP($database, $field, $criteria) diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index 16164814..23f0d9e2 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,17 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class DateTime { /** - * Identify if a year is a leap year or not + * Identify if a year is a leap year or not. * * @param int $year The year to test + * * @return bool TRUE if the year is a leap year, otherwise FALSE */ public static function isLeapYear($year) @@ -37,7 +39,7 @@ class DateTime } /** - * Return the number of days between two dates based on a 360 day calendar + * Return the number of days between two dates based on a 360 day calendar. * * @param int $startDay Day of month of the start date * @param int $startMonth Month of the start date @@ -46,6 +48,7 @@ class DateTime * @param int $endMonth Month of the start date * @param int $endYear Year of the start date * @param bool $methodUS Whether to use the US method or the European method of calculation + * * @return int Number of days between the start date and the end date */ private static function dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) @@ -73,9 +76,10 @@ class DateTime } /** - * getDateValue + * getDateValue. * * @param string $dateValue + * * @return mixed Excel date/time serial value, or string if error */ public static function getDateValue($dateValue) @@ -99,9 +103,10 @@ class DateTime } /** - * getTimeValue + * getTimeValue. * * @param string $timeValue + * * @return mixed Excel date/time serial value, or string if error */ private static function getTimeValue($timeValue) @@ -142,7 +147,7 @@ class DateTime } /** - * DATETIMENOW + * DATETIMENOW. * * Returns the current date and time. * The NOW function is useful when you need to display the current date and time on a worksheet or @@ -156,6 +161,7 @@ class DateTime * NOW() * * @category Date/Time Functions + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -169,7 +175,7 @@ class DateTime $retValue = (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time()); break; case Functions::RETURNDATE_PHP_NUMERIC: - $retValue = (integer) time(); + $retValue = (int) time(); break; case Functions::RETURNDATE_PHP_OBJECT: $retValue = new \DateTime(); @@ -181,7 +187,7 @@ class DateTime } /** - * DATENOW + * DATENOW. * * Returns the current date. * The NOW function is useful when you need to display the current date and time on a worksheet or @@ -195,6 +201,7 @@ class DateTime * TODAY() * * @category Date/Time Functions + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -209,7 +216,7 @@ class DateTime $retValue = (float) $excelDateTime; break; case Functions::RETURNDATE_PHP_NUMERIC: - $retValue = (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime); + $retValue = (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime); break; case Functions::RETURNDATE_PHP_OBJECT: $retValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateTime); @@ -221,7 +228,7 @@ class DateTime } /** - * DATE + * DATE. * * The DATE function returns a value that represents a particular date. * @@ -236,6 +243,7 @@ class DateTime * as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language. * * @category Date/Time Functions + * * @param int $year The value of the year argument can include one to four digits. * Excel interprets the year argument according to the configured * date system: 1900 or 1904. @@ -266,6 +274,7 @@ class DateTime * days, plus one, from the first day of the month specified. For * example, DATE(2008,1,-15) returns the serial number representing * December 16, 2007. + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -291,9 +300,9 @@ class DateTime (!is_numeric($day))) { return Functions::VALUE(); } - $year = (integer) $year; - $month = (integer) $month; - $day = (integer) $day; + $year = (int) $year; + $month = (int) $month; + $day = (int) $day; $baseYear = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar(); // Validate parameters @@ -330,14 +339,14 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue); + return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue); case Functions::RETURNDATE_PHP_OBJECT: return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateValue); } } /** - * TIME + * TIME. * * The TIME function returns a value that represents a particular time. * @@ -348,6 +357,7 @@ class DateTime * TIME(hour,minute,second) * * @category Date/Time Functions + * * @param int $hour A number from 0 (zero) to 32767 representing the hour. * Any value greater than 23 will be divided by 24 and the remainder * will be treated as the hour value. For example, TIME(27,0,0) = @@ -359,6 +369,7 @@ class DateTime * Any value greater than 59 will be converted to hours, minutes, * and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 * or 12:33:20 AM + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -381,9 +392,9 @@ class DateTime if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) { return Functions::VALUE(); } - $hour = (integer) $hour; - $minute = (integer) $minute; - $second = (integer) $second; + $hour = (int) $hour; + $minute = (int) $minute; + $second = (int) $second; if ($second < 0) { $minute += floor($second / 60); @@ -423,7 +434,7 @@ class DateTime return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 + return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 case Functions::RETURNDATE_PHP_OBJECT: $dayAdjust = 0; if ($hour < 0) { @@ -446,7 +457,7 @@ class DateTime } /** - * DATEVALUE + * DATEVALUE. * * Returns a value that represents a particular date. * Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp @@ -459,6 +470,7 @@ class DateTime * DATEVALUE(dateValue) * * @category Date/Time Functions + * * @param string $dateValue Text that represents a date in a Microsoft Excel date format. * For example, "1/30/2008" or "30-Jan-2008" are text strings within * quotation marks that represent dates. Using the default date @@ -467,6 +479,7 @@ class DateTime * system in Excel for the Macintosh, date_text must represent a date * from January 1, 1904, to December 31, 9999. DATEVALUE returns the * #VALUE! error value if date_text is out of this range. + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -485,12 +498,11 @@ class DateTime if ((is_numeric($t)) && ($t > 31)) { if ($yearFound) { return Functions::VALUE(); - } else { - if ($t < 100) { - $t += 1900; - } - $yearFound = true; } + if ($t < 100) { + $t += 1900; + } + $yearFound = true; } } if ((count($t1) == 1) && (strpos($t, ':') != false)) { @@ -571,7 +583,7 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue); + return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue); case Functions::RETURNDATE_PHP_OBJECT: return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); } @@ -581,7 +593,7 @@ class DateTime } /** - * TIMEVALUE + * TIMEVALUE. * * Returns a value that represents a particular time. * Use TIMEVALUE to convert a time represented by a text string to an Excel or PHP date/time stamp @@ -594,10 +606,12 @@ class DateTime * TIMEVALUE(timeValue) * * @category Date/Time Functions + * * @param string $timeValue A text string that represents a time in any one of the Microsoft * Excel time formats; for example, "6:45 PM" and "18:45" text strings * within quotation marks that represent time. * Date information in time_text is ignored. + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -631,7 +645,7 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) $phpDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600; + return (int) $phpDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600; case Functions::RETURNDATE_PHP_OBJECT: return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); } @@ -641,13 +655,14 @@ class DateTime } /** - * DATEDIF + * DATEDIF. * * @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object * or a standard date string * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object * or a standard date string * @param string $unit + * * @return int Interval between the dates */ public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') @@ -684,17 +699,17 @@ class DateTime $retVal = Functions::NAN(); switch ($unit) { case 'D': - $retVal = intval($difference); + $retVal = (int) $difference; break; case 'M': - $retVal = intval($endMonths - $startMonths) + (intval($endYears - $startYears) * 12); + $retVal = (int) ($endMonths - $startMonths) + ((int) ($endYears - $startYears) * 12); // We're only interested in full months if ($endDays < $startDays) { --$retVal; } break; case 'Y': - $retVal = intval($endYears - $startYears); + $retVal = (int) ($endYears - $startYears); // We're only interested in full months if ($endMonths < $startMonths) { --$retVal; @@ -716,7 +731,7 @@ class DateTime } break; case 'YM': - $retVal = intval($endMonths - $startMonths); + $retVal = (int) ($endMonths - $startMonths); if ($retVal < 0) { $retVal += 12; } @@ -726,7 +741,7 @@ class DateTime } break; case 'YD': - $retVal = intval($difference); + $retVal = (int) $difference; if ($endYears > $startYears) { $isLeapStartYear = $PHPStartDateObject->format('L'); $wasLeapEndYear = $PHPEndDateObject->format('L'); @@ -757,7 +772,7 @@ class DateTime } /** - * DAYS360 + * DAYS360. * * Returns the number of days between two dates based on a 360-day year (twelve 30-day months), * which is used in some accounting calculations. Use this function to help compute payments if @@ -767,6 +782,7 @@ class DateTime * DAYS360(startDate,endDate[,method]) * * @category Date/Time Functions + * * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), @@ -782,6 +798,7 @@ class DateTime * TRUE: European method. Starting dates and ending dates that * occur on the 31st of a month become equal to the 30th of the * same month. + * * @return int Number of days between start date and end date */ public static function DAYS360($startDate = 0, $endDate = 0, $method = false) @@ -815,7 +832,7 @@ class DateTime } /** - * YEARFRAC + * YEARFRAC. * * Calculates the fraction of the year represented by the number of whole days between two dates * (the start_date and the end_date). @@ -826,6 +843,7 @@ class DateTime * YEARFRAC(startDate,endDate[,method]) * * @category Date/Time Functions + * * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), @@ -836,6 +854,7 @@ class DateTime * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * * @return float fraction of the year */ public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) @@ -913,7 +932,7 @@ class DateTime } /** - * NETWORKDAYS + * NETWORKDAYS. * * Returns the number of whole working days between start_date and end_date. Working days * exclude weekends and any dates identified in holidays. @@ -924,10 +943,12 @@ class DateTime * NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]]) * * @category Date/Time Functions + * * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * * @return int Interval between the dates */ public static function NETWORKDAYS($startDate, $endDate) @@ -993,7 +1014,7 @@ class DateTime } /** - * WORKDAY + * WORKDAY. * * Returns the date that is the indicated number of working days before or after a date (the * starting date). Working days exclude weekends and any dates identified as holidays. @@ -1004,11 +1025,13 @@ class DateTime * WORKDAY(startDate,endDays[,holidays[,holiday[,...]]]) * * @category Date/Time Functions + * * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * @param int $endDays The number of nonweekend and nonholiday days before or after * startDate. A positive value for days yields a future date; a * negative value yields a past date. + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -1043,7 +1066,7 @@ class DateTime } // Add endDays - $endDate = (float) $startDate + (intval($endDays / 5) * 7) + ($endDays % 5); + $endDate = (float) $startDate + ((int) ($endDays / 5) * 7) + ($endDays % 5); // Adjust the calculated end date if it falls over a weekend $endDoW = self::WEEKDAY($endDate, 3); @@ -1097,14 +1120,14 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) $endDate; case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($endDate); + return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($endDate); case Functions::RETURNDATE_PHP_OBJECT: return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate); } } /** - * DAYOFMONTH + * DAYOFMONTH. * * Returns the day of the month, for a specified date. The day is given as an integer * ranging from 1 to 31. @@ -1114,6 +1137,7 @@ class DateTime * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * * @return int Day of the month */ public static function DAYOFMONTH($dateValue = 1) @@ -1137,7 +1161,7 @@ class DateTime } /** - * WEEKDAY + * WEEKDAY. * * Returns the day of the week for a specified date. The day is given as an integer * ranging from 0 to 7 (dependent on the requested style). @@ -1151,6 +1175,7 @@ class DateTime * 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). * 2 Numbers 1 (Monday) through 7 (Sunday). * 3 Numbers 0 (Monday) through 6 (Sunday). + * * @return int Day of the week value */ public static function WEEKDAY($dateValue = 1, $style = 1) @@ -1209,7 +1234,7 @@ class DateTime } /** - * WEEKNUM + * WEEKNUM. * * Returns the week of the year for a specified date. * The WEEKNUM function considers the week containing January 1 to be the first week of the year. @@ -1226,6 +1251,7 @@ class DateTime * @param int $method Week begins on Sunday or Monday * 1 or omitted Week begins on Sunday. * 2 Week begins on Monday. + * * @return int Week Number */ public static function WEEKNUM($dateValue = 1, $method = 1) @@ -1265,7 +1291,7 @@ class DateTime } /** - * MONTHOFYEAR + * MONTHOFYEAR. * * Returns the month of a date represented by a serial number. * The month is given as an integer, ranging from 1 (January) to 12 (December). @@ -1275,6 +1301,7 @@ class DateTime * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * * @return int Month of the year */ public static function MONTHOFYEAR($dateValue = 1) @@ -1297,7 +1324,7 @@ class DateTime } /** - * YEAR + * YEAR. * * Returns the year corresponding to a date. * The year is returned as an integer in the range 1900-9999. @@ -1307,6 +1334,7 @@ class DateTime * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * * @return int Year */ public static function YEAR($dateValue = 1) @@ -1328,7 +1356,7 @@ class DateTime } /** - * HOUROFDAY + * HOUROFDAY. * * Returns the hour of a time value. * The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). @@ -1338,6 +1366,7 @@ class DateTime * * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string + * * @return int Hour */ public static function HOUROFDAY($timeValue = 0) @@ -1368,7 +1397,7 @@ class DateTime } /** - * MINUTE + * MINUTE. * * Returns the minutes of a time value. * The minute is given as an integer, ranging from 0 to 59. @@ -1378,6 +1407,7 @@ class DateTime * * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string + * * @return int Minute */ public static function MINUTE($timeValue = 0) @@ -1408,7 +1438,7 @@ class DateTime } /** - * SECOND + * SECOND. * * Returns the seconds of a time value. * The second is given as an integer in the range 0 (zero) to 59. @@ -1418,6 +1448,7 @@ class DateTime * * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string + * * @return int Second */ public static function SECOND($timeValue = 0) @@ -1448,7 +1479,7 @@ class DateTime } /** - * EDATE + * EDATE. * * Returns the serial number that represents the date that is the indicated number of months * before or after a specified date (the start_date). @@ -1463,6 +1494,7 @@ class DateTime * @param int $adjustmentMonths The number of months before or after start_date. * A positive value for months yields a future date; * a negative value yields a past date. + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -1487,14 +1519,14 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject); case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject)); + return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject)); case Functions::RETURNDATE_PHP_OBJECT: return $PHPDateObject; } } /** - * EOMONTH + * EOMONTH. * * Returns the date value for the last day of the month that is the indicated number of months * before or after start_date. @@ -1508,6 +1540,7 @@ class DateTime * @param int $adjustmentMonths The number of months before or after start_date. * A positive value for months yields a future date; * a negative value yields a past date. + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -1535,7 +1568,7 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject); case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject)); + return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject)); case Functions::RETURNDATE_PHP_OBJECT: return $PHPDateObject; } diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index ff598ab4..04fa6a1f 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -6,7 +6,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; define('EULER', 2.71828182845904523536); /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,13 +23,14 @@ define('EULER', 2.71828182845904523536); * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Engineering { /** - * Details of the Units of measure that can be used in CONVERTUOM() + * Details of the Units of measure that can be used in CONVERTUOM(). * * @var mixed[] */ @@ -100,7 +101,7 @@ class Engineering ]; /** - * Details of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM() + * Details of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). * * @var mixed[] */ @@ -128,7 +129,7 @@ class Engineering ]; /** - * Details of the Units of measure conversion factors, organised by group + * Details of the Units of measure conversion factors, organised by group. * * @var mixed[] */ @@ -733,11 +734,12 @@ class Engineering ]; /** - * parseComplex + * parseComplex. * * Parses a complex number into its real and imaginary parts, and an I or J suffix * * @param string $complexNumber The complex number + * * @return string[] Indexed on "real", "imaginary" and "suffix" */ public static function parseComplex($complexNumber) @@ -756,7 +758,7 @@ class Engineering // Split the input into its Real and Imaginary components $leadingSign = 0; if (strlen($workString) > 0) { - $leadingSign = (($workString{0} == '+') || ($workString{0} == '-')) ? 1 : 0; + $leadingSign = (($workString[0] == '+') || ($workString[0] == '-')) ? 1 : 0; } $power = ''; $realNumber = strtok($workString, '+-'); @@ -789,23 +791,24 @@ class Engineering } /** - * Cleans the leading characters in a complex number string + * Cleans the leading characters in a complex number string. * * @param string $complexNumber The complex number to clean + * * @return string The "cleaned" complex number */ private static function cleanComplex($complexNumber) { - if ($complexNumber{0} == '+') { + if ($complexNumber[0] == '+') { $complexNumber = substr($complexNumber, 1); } - if ($complexNumber{0} == '0') { + if ($complexNumber[0] == '0') { $complexNumber = substr($complexNumber, 1); } - if ($complexNumber{0} == '.') { + if ($complexNumber[0] == '.') { $complexNumber = '0' . $complexNumber; } - if ($complexNumber{0} == '+') { + if ($complexNumber[0] == '+') { $complexNumber = substr($complexNumber, 1); } @@ -813,10 +816,11 @@ class Engineering } /** - * Formats a number base string value with leading zeroes + * Formats a number base string value with leading zeroes. * * @param string $xVal The "number" to pad * @param int $places The length that we want to pad this value + * * @return string The padded "number" */ private static function nbrConversionFormat($xVal, $places) @@ -832,16 +836,16 @@ class Engineering } if (strlen($xVal) <= $places) { return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10); - } else { - return Functions::NAN(); } + + return Functions::NAN(); } return substr($xVal, -10); } /** - * BESSELI + * BESSELI. * * Returns the modified Bessel function In(x), which is equivalent to the Bessel function evaluated * for purely imaginary arguments @@ -850,12 +854,14 @@ class Engineering * BESSELI(x,ord) * * @category Engineering Functions + * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELI returns the #VALUE! error value. * @param int $ord The order of the Bessel function. * If ord is not an integer, it is truncated. * If $ord is nonnumeric, BESSELI returns the #VALUE! error value. * If $ord < 0, BESSELI returns the #NUM! error value. + * * @return float */ public static function BESSELI($x, $ord) @@ -895,7 +901,7 @@ class Engineering } /** - * BESSELJ + * BESSELJ. * * Returns the Bessel function * @@ -903,11 +909,13 @@ class Engineering * BESSELJ(x,ord) * * @category Engineering Functions + * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELJ returns the #VALUE! error value. * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. * If $ord is nonnumeric, BESSELJ returns the #VALUE! error value. * If $ord < 0, BESSELJ returns the #NUM! error value. + * * @return float */ public static function BESSELJ($x, $ord) @@ -985,7 +993,7 @@ class Engineering } /** - * BESSELK + * BESSELK. * * Returns the modified Bessel function Kn(x), which is equivalent to the Bessel functions evaluated * for purely imaginary arguments. @@ -994,11 +1002,13 @@ class Engineering * BESSELK(x,ord) * * @category Engineering Functions + * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELK returns the #VALUE! error value. * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. * If $ord < 0, BESSELK returns the #NUM! error value. + * * @return float */ public static function BESSELK($x, $ord) @@ -1071,7 +1081,7 @@ class Engineering } /** - * BESSELY + * BESSELY. * * Returns the Bessel function, which is also called the Weber function or the Neumann function. * @@ -1079,6 +1089,7 @@ class Engineering * BESSELY(x,ord) * * @category Engineering Functions + * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELK returns the #VALUE! error value. * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. @@ -1122,7 +1133,7 @@ class Engineering } /** - * BINTODEC + * BINTODEC. * * Return a binary value as decimal. * @@ -1130,12 +1141,14 @@ class Engineering * BIN2DEC(x) * * @category Engineering Functions + * * @param string $x The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant * bit of number is the sign bit. The remaining 9 bits are magnitude bits. * Negative numbers are represented using two's-complement notation. * If number is not a valid binary number, or if number contains more than * 10 characters (10 bits), BIN2DEC returns the #NUM! error value. + * * @return string */ public static function BINTODEC($x) @@ -1169,7 +1182,7 @@ class Engineering } /** - * BINTOHEX + * BINTOHEX. * * Return a binary value as hex. * @@ -1177,6 +1190,7 @@ class Engineering * BIN2HEX(x[,places]) * * @category Engineering Functions + * * @param string $x The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant * bit of number is the sign bit. The remaining 9 bits are magnitude bits. @@ -1189,6 +1203,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, BIN2HEX returns the #VALUE! error value. * If places is negative, BIN2HEX returns the #NUM! error value. + * * @return string */ public static function BINTOHEX($x, $places = null) @@ -1223,7 +1238,7 @@ class Engineering } /** - * BINTOOCT + * BINTOOCT. * * Return a binary value as octal. * @@ -1231,6 +1246,7 @@ class Engineering * BIN2OCT(x[,places]) * * @category Engineering Functions + * * @param string $x The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant * bit of number is the sign bit. The remaining 9 bits are magnitude bits. @@ -1243,6 +1259,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, BIN2OCT returns the #VALUE! error value. * If places is negative, BIN2OCT returns the #NUM! error value. + * * @return string */ public static function BINTOOCT($x, $places = null) @@ -1276,7 +1293,7 @@ class Engineering } /** - * DECTOBIN + * DECTOBIN. * * Return a decimal value as binary. * @@ -1284,6 +1301,7 @@ class Engineering * DEC2BIN(x[,places]) * * @category Engineering Functions + * * @param string $x The decimal integer you want to convert. If number is negative, * valid place values are ignored and DEC2BIN returns a 10-character * (10-bit) binary number in which the most significant bit is the sign @@ -1300,6 +1318,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, DEC2BIN returns the #VALUE! error value. * If places is zero or negative, DEC2BIN returns the #NUM! error value. + * * @return string */ public static function DECTOBIN($x, $places = null) @@ -1335,7 +1354,7 @@ class Engineering } /** - * DECTOHEX + * DECTOHEX. * * Return a decimal value as hex. * @@ -1343,6 +1362,7 @@ class Engineering * DEC2HEX(x[,places]) * * @category Engineering Functions + * * @param string $x The decimal integer you want to convert. If number is negative, * places is ignored and DEC2HEX returns a 10-character (40-bit) * hexadecimal number in which the most significant bit is the sign @@ -1359,6 +1379,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, DEC2HEX returns the #VALUE! error value. * If places is zero or negative, DEC2HEX returns the #NUM! error value. + * * @return string */ public static function DECTOHEX($x, $places = null) @@ -1388,7 +1409,7 @@ class Engineering } /** - * DECTOOCT + * DECTOOCT. * * Return an decimal value as octal. * @@ -1396,6 +1417,7 @@ class Engineering * DEC2OCT(x[,places]) * * @category Engineering Functions + * * @param string $x The decimal integer you want to convert. If number is negative, * places is ignored and DEC2OCT returns a 10-character (30-bit) * octal number in which the most significant bit is the sign bit. @@ -1412,6 +1434,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, DEC2OCT returns the #VALUE! error value. * If places is zero or negative, DEC2OCT returns the #NUM! error value. + * * @return string */ public static function DECTOOCT($x, $places = null) @@ -1442,7 +1465,7 @@ class Engineering } /** - * HEXTOBIN + * HEXTOBIN. * * Return a hex value as binary. * @@ -1450,6 +1473,7 @@ class Engineering * HEX2BIN(x[,places]) * * @category Engineering Functions + * * @param string $x the hexadecimal number you want to convert. * Number cannot contain more than 10 characters. * The most significant bit of number is the sign bit (40th bit from the right). @@ -1466,6 +1490,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, HEX2BIN returns the #VALUE! error value. * If places is negative, HEX2BIN returns the #NUM! error value. + * * @return string */ public static function HEXTOBIN($x, $places = null) @@ -1485,7 +1510,7 @@ class Engineering } /** - * HEXTODEC + * HEXTODEC. * * Return a hex value as decimal. * @@ -1493,6 +1518,7 @@ class Engineering * HEX2DEC(x) * * @category Engineering Functions + * * @param string $x The hexadecimal number you want to convert. This number cannot * contain more than 10 characters (40 bits). The most significant * bit of number is the sign bit. The remaining 39 bits are magnitude @@ -1500,6 +1526,7 @@ class Engineering * notation. * If number is not a valid hexadecimal number, HEX2DEC returns the * #NUM! error value. + * * @return string */ public static function HEXTODEC($x) @@ -1534,7 +1561,7 @@ class Engineering } /** - * HEXTOOCT + * HEXTOOCT. * * Return a hex value as octal. * @@ -1542,6 +1569,7 @@ class Engineering * HEX2OCT(x[,places]) * * @category Engineering Functions + * * @param string $x The hexadecimal number you want to convert. Number cannot * contain more than 10 characters. The most significant bit of * number is the sign bit. The remaining 39 bits are magnitude @@ -1562,6 +1590,7 @@ class Engineering * If places is nonnumeric, HEX2OCT returns the #VALUE! error * value. * If places is negative, HEX2OCT returns the #NUM! error value. + * * @return string */ public static function HEXTOOCT($x, $places = null) @@ -1586,7 +1615,7 @@ class Engineering } /** - * OCTTOBIN + * OCTTOBIN. * * Return an octal value as binary. * @@ -1594,6 +1623,7 @@ class Engineering * OCT2BIN(x[,places]) * * @category Engineering Functions + * * @param string $x The octal number you want to convert. Number may not * contain more than 10 characters. The most significant * bit of number is the sign bit. The remaining 29 bits @@ -1616,6 +1646,7 @@ class Engineering * error value. * If places is negative, OCT2BIN returns the #NUM! error * value. + * * @return string */ public static function OCTTOBIN($x, $places = null) @@ -1635,7 +1666,7 @@ class Engineering } /** - * OCTTODEC + * OCTTODEC. * * Return an octal value as decimal. * @@ -1643,6 +1674,7 @@ class Engineering * OCT2DEC(x) * * @category Engineering Functions + * * @param string $x The octal number you want to convert. Number may not contain * more than 10 octal characters (30 bits). The most significant * bit of number is the sign bit. The remaining 29 bits are @@ -1650,6 +1682,7 @@ class Engineering * two's-complement notation. * If number is not a valid octal number, OCT2DEC returns the * #NUM! error value. + * * @return string */ public static function OCTTODEC($x) @@ -1679,7 +1712,7 @@ class Engineering } /** - * OCTTOHEX + * OCTTOHEX. * * Return an octal value as hex. * @@ -1687,6 +1720,7 @@ class Engineering * OCT2HEX(x[,places]) * * @category Engineering Functions + * * @param string $x The octal number you want to convert. Number may not contain * more than 10 octal characters (30 bits). The most significant * bit of number is the sign bit. The remaining 29 bits are @@ -1704,6 +1738,7 @@ class Engineering * If places is not an integer, it is truncated. * If places is nonnumeric, OCT2HEX returns the #VALUE! error value. * If places is negative, OCT2HEX returns the #NUM! error value. + * * @return string */ public static function OCTTOHEX($x, $places = null) @@ -1724,7 +1759,7 @@ class Engineering } /** - * COMPLEX + * COMPLEX. * * Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj. * @@ -1732,10 +1767,12 @@ class Engineering * COMPLEX(realNumber,imaginary[,places]) * * @category Engineering Functions - * @param float $realNumber The real coefficient of the complex number. - * @param float $imaginary The imaginary coefficient of the complex number. + * + * @param float $realNumber the real coefficient of the complex number + * @param float $imaginary the imaginary coefficient of the complex number * @param string $suffix The suffix for the imaginary component of the complex number. * If omitted, the suffix is assumed to be "i". + * * @return string */ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i') @@ -1781,7 +1818,7 @@ class Engineering } /** - * IMAGINARY + * IMAGINARY. * * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format. * @@ -1789,8 +1826,10 @@ class Engineering * IMAGINARY(complexNumber) * * @category Engineering Functions - * @param string $complexNumber The complex number for which you want the imaginary - * coefficient. + * + * @param string $complexNumber the complex number for which you want the imaginary + * coefficient + * * @return float */ public static function IMAGINARY($complexNumber) @@ -1803,7 +1842,7 @@ class Engineering } /** - * IMREAL + * IMREAL. * * Returns the real coefficient of a complex number in x + yi or x + yj text format. * @@ -1811,7 +1850,9 @@ class Engineering * IMREAL(complexNumber) * * @category Engineering Functions - * @param string $complexNumber The complex number for which you want the real coefficient. + * + * @param string $complexNumber the complex number for which you want the real coefficient + * * @return float */ public static function IMREAL($complexNumber) @@ -1824,14 +1865,15 @@ class Engineering } /** - * IMABS + * IMABS. * * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format. * * Excel Function: * IMABS(complexNumber) * - * @param string $complexNumber The complex number for which you want the absolute value. + * @param string $complexNumber the complex number for which you want the absolute value + * * @return float */ public static function IMABS($complexNumber) @@ -1847,7 +1889,7 @@ class Engineering } /** - * IMARGUMENT + * IMARGUMENT. * * Returns the argument theta of a complex number, i.e. the angle in radians from the real * axis to the representation of the number in polar coordinates. @@ -1855,7 +1897,8 @@ class Engineering * Excel Function: * IMARGUMENT(complexNumber) * - * @param string $complexNumber The complex number for which you want the argument theta. + * @param string $complexNumber the complex number for which you want the argument theta + * * @return float */ public static function IMARGUMENT($complexNumber) @@ -1867,27 +1910,28 @@ class Engineering return Functions::DIV0(); } elseif ($parsedComplex['imaginary'] < 0.0) { return M_PI / -2; - } else { - return M_PI / 2; } + + return M_PI / 2; } elseif ($parsedComplex['real'] > 0.0) { return atan($parsedComplex['imaginary'] / $parsedComplex['real']); } elseif ($parsedComplex['imaginary'] < 0.0) { return 0 - (M_PI - atan(abs($parsedComplex['imaginary']) / abs($parsedComplex['real']))); - } else { - return M_PI - atan($parsedComplex['imaginary'] / abs($parsedComplex['real'])); } + + return M_PI - atan($parsedComplex['imaginary'] / abs($parsedComplex['real'])); } /** - * IMCONJUGATE + * IMCONJUGATE. * * Returns the complex conjugate of a complex number in x + yi or x + yj text format. * * Excel Function: * IMCONJUGATE(complexNumber) * - * @param string $complexNumber The complex number for which you want the conjugate. + * @param string $complexNumber the complex number for which you want the conjugate + * * @return string */ public static function IMCONJUGATE($complexNumber) @@ -1898,26 +1942,27 @@ class Engineering if ($parsedComplex['imaginary'] == 0.0) { return $parsedComplex['real']; - } else { - return self::cleanComplex( + } + + return self::cleanComplex( self::COMPLEX( $parsedComplex['real'], 0 - $parsedComplex['imaginary'], $parsedComplex['suffix'] ) ); - } } /** - * IMCOS + * IMCOS. * * Returns the cosine of a complex number in x + yi or x + yj text format. * * Excel Function: * IMCOS(complexNumber) * - * @param string $complexNumber The complex number for which you want the cosine. + * @param string $complexNumber the complex number for which you want the cosine + * * @return string|float */ public static function IMCOS($complexNumber) @@ -1928,26 +1973,27 @@ class Engineering if ($parsedComplex['imaginary'] == 0.0) { return cos($parsedComplex['real']); - } else { - return self::IMCONJUGATE( + } + + return self::IMCONJUGATE( self::COMPLEX( cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']), sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']), $parsedComplex['suffix'] ) ); - } } /** - * IMSIN + * IMSIN. * * Returns the sine of a complex number in x + yi or x + yj text format. * * Excel Function: * IMSIN(complexNumber) * - * @param string $complexNumber The complex number for which you want the sine. + * @param string $complexNumber the complex number for which you want the sine + * * @return string|float */ public static function IMSIN($complexNumber) @@ -1958,24 +2004,25 @@ class Engineering if ($parsedComplex['imaginary'] == 0.0) { return sin($parsedComplex['real']); - } else { - return self::COMPLEX( + } + + return self::COMPLEX( sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']), cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']), $parsedComplex['suffix'] ); - } } /** - * IMSQRT + * IMSQRT. * * Returns the square root of a complex number in x + yi or x + yj text format. * * Excel Function: * IMSQRT(complexNumber) * - * @param string $complexNumber The complex number for which you want the square root. + * @param string $complexNumber the complex number for which you want the square root + * * @return string */ public static function IMSQRT($complexNumber) @@ -1995,20 +2042,21 @@ class Engineering if ($parsedComplex['suffix'] == '') { return self::COMPLEX($d1 * $r, $d2 * $r); - } else { - return self::COMPLEX($d1 * $r, $d2 * $r, $parsedComplex['suffix']); } + + return self::COMPLEX($d1 * $r, $d2 * $r, $parsedComplex['suffix']); } /** - * IMLN + * IMLN. * * Returns the natural logarithm of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLN(complexNumber) * - * @param string $complexNumber The complex number for which you want the natural logarithm. + * @param string $complexNumber the complex number for which you want the natural logarithm + * * @return string */ public static function IMLN($complexNumber) @@ -2026,20 +2074,21 @@ class Engineering if ($parsedComplex['suffix'] == '') { return self::COMPLEX($logR, $t); - } else { - return self::COMPLEX($logR, $t, $parsedComplex['suffix']); } + + return self::COMPLEX($logR, $t, $parsedComplex['suffix']); } /** - * IMLOG10 + * IMLOG10. * * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLOG10(complexNumber) * - * @param string $complexNumber The complex number for which you want the common logarithm. + * @param string $complexNumber the complex number for which you want the common logarithm + * * @return string */ public static function IMLOG10($complexNumber) @@ -2058,14 +2107,15 @@ class Engineering } /** - * IMLOG2 + * IMLOG2. * * Returns the base-2 logarithm of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLOG2(complexNumber) * - * @param string $complexNumber The complex number for which you want the base-2 logarithm. + * @param string $complexNumber the complex number for which you want the base-2 logarithm + * * @return string */ public static function IMLOG2($complexNumber) @@ -2084,14 +2134,15 @@ class Engineering } /** - * IMEXP + * IMEXP. * * Returns the exponential of a complex number in x + yi or x + yj text format. * * Excel Function: * IMEXP(complexNumber) * - * @param string $complexNumber The complex number for which you want the exponential. + * @param string $complexNumber the complex number for which you want the exponential + * * @return string */ public static function IMEXP($complexNumber) @@ -2110,21 +2161,22 @@ class Engineering if ($parsedComplex['suffix'] == '') { return self::COMPLEX($eX, $eY); - } else { - return self::COMPLEX($eX, $eY, $parsedComplex['suffix']); } + + return self::COMPLEX($eX, $eY, $parsedComplex['suffix']); } /** - * IMPOWER + * IMPOWER. * * Returns a complex number in x + yi or x + yj text format raised to a power. * * Excel Function: * IMPOWER(complexNumber,realNumber) * - * @param string $complexNumber The complex number you want to raise to a power. - * @param float $realNumber The power to which you want to raise the complex number. + * @param string $complexNumber the complex number you want to raise to a power + * @param float $realNumber the power to which you want to raise the complex number + * * @return string */ public static function IMPOWER($complexNumber, $realNumber) @@ -2145,21 +2197,22 @@ class Engineering return 1; } elseif ($parsedComplex['imaginary'] == 0.0) { return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']); - } else { - return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']); } + + return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']); } /** - * IMDIV + * IMDIV. * * Returns the quotient of two complex numbers in x + yi or x + yj text format. * * Excel Function: * IMDIV(complexDividend,complexDivisor) * - * @param string $complexDividend The complex numerator or dividend. - * @param string $complexDivisor The complex denominator or divisor. + * @param string $complexDividend the complex numerator or dividend + * @param string $complexDivisor the complex denominator or divisor + * * @return string */ public static function IMDIV($complexDividend, $complexDivisor) @@ -2190,21 +2243,22 @@ class Engineering return self::cleanComplex($r . '+' . $i . $parsedComplexDivisor['suffix']); } elseif ($i < 0.0) { return self::cleanComplex($r . $i . $parsedComplexDivisor['suffix']); - } else { - return $r; } + + return $r; } /** - * IMSUB + * IMSUB. * * Returns the difference of two complex numbers in x + yi or x + yj text format. * * Excel Function: * IMSUB(complexNumber1,complexNumber2) * - * @param string $complexNumber1 The complex number from which to subtract complexNumber2. - * @param string $complexNumber2 The complex number to subtract from complexNumber1. + * @param string $complexNumber1 the complex number from which to subtract complexNumber2 + * @param string $complexNumber2 the complex number to subtract from complexNumber1 + * * @return string */ public static function IMSUB($complexNumber1, $complexNumber2) @@ -2230,7 +2284,7 @@ class Engineering } /** - * IMSUM + * IMSUM. * * Returns the sum of two or more complex numbers in x + yi or x + yj text format. * @@ -2238,6 +2292,7 @@ class Engineering * IMSUM(complexNumber[,complexNumber[,...]]) * * @param string $complexNumber,... Series of complex numbers to add + * * @return string */ public static function IMSUM() @@ -2269,7 +2324,7 @@ class Engineering } /** - * IMPRODUCT + * IMPRODUCT. * * Returns the product of two or more complex numbers in x + yi or x + yj text format. * @@ -2277,6 +2332,7 @@ class Engineering * IMPRODUCT(complexNumber[,complexNumber[,...]]) * * @param string $complexNumber,... Series of complex numbers to multiply + * * @return string */ public static function IMPRODUCT() @@ -2308,7 +2364,7 @@ class Engineering } /** - * DELTA + * DELTA. * * Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. * Use this function to filter a set of values. For example, by summing several DELTA @@ -2318,8 +2374,9 @@ class Engineering * Excel Function: * DELTA(a[,b]) * - * @param float $a The first number. + * @param float $a the first number * @param float $b The second number. If omitted, b is assumed to be zero. + * * @return int */ public static function DELTA($a, $b = 0) @@ -2331,7 +2388,7 @@ class Engineering } /** - * GESTEP + * GESTEP. * * Excel Function: * GESTEP(number[,step]) @@ -2340,9 +2397,10 @@ class Engineering * Use this function to filter a set of values. For example, by summing several GESTEP * functions you calculate the count of values that exceed a threshold. * - * @param float $number The value to test against step. + * @param float $number the value to test against step * @param float $step The threshold value. * If you omit a value for step, GESTEP uses zero. + * * @return int */ public static function GESTEP($number, $step = 0) @@ -2382,7 +2440,7 @@ class Engineering } /** - * ERF + * ERF. * * Returns the error function integrated between the lower and upper bound arguments. * @@ -2397,6 +2455,7 @@ class Engineering * @param float $lower lower bound for integrating ERF * @param float $upper upper bound for integrating ERF. * If omitted, ERF integrates between zero and lower_limit + * * @return float */ public static function ERF($lower, $upper = null) @@ -2450,7 +2509,7 @@ class Engineering } /** - * ERFC + * ERFC. * * Returns the complementary ERF function integrated between x and infinity * @@ -2463,6 +2522,7 @@ class Engineering * ERFC(x) * * @param float $x The lower bound for integrating ERFC + * * @return float */ public static function ERFC($x) @@ -2478,7 +2538,7 @@ class Engineering /** * getConversionGroups - * Returns a list of the different conversion groups for UOM conversions + * Returns a list of the different conversion groups for UOM conversions. * * @return array */ @@ -2494,9 +2554,10 @@ class Engineering /** * getConversionGroupUnits - * Returns an array of units of measure, for a specified conversion group, or for all groups + * Returns an array of units of measure, for a specified conversion group, or for all groups. * * @param string $group The group whose units of measure you want to retrieve + * * @return array */ public static function getConversionGroupUnits($group = null) @@ -2512,9 +2573,10 @@ class Engineering } /** - * getConversionGroupUnitDetails + * getConversionGroupUnitDetails. * * @param string $group The group whose units of measure you want to retrieve + * * @return array */ public static function getConversionGroupUnitDetails($group = null) @@ -2534,7 +2596,7 @@ class Engineering /** * getConversionMultipliers - * Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM() + * Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). * * @return array of mixed */ @@ -2544,7 +2606,7 @@ class Engineering } /** - * CONVERTUOM + * CONVERTUOM. * * Converts a number from one measurement system to another. * For example, CONVERT can translate a table of distances in miles to a table of distances @@ -2553,9 +2615,9 @@ class Engineering * Excel Function: * CONVERT(value,fromUOM,toUOM) * - * @param float $value The value in fromUOM to convert. - * @param string $fromUOM The units for value. - * @param string $toUOM The units for the result. + * @param float $value the value in fromUOM to convert + * @param string $fromUOM the units for value + * @param string $toUOM the units for the result * * @return float */ @@ -2615,15 +2677,14 @@ class Engineering } elseif ($unitGroup1 == 'Temperature') { if (($fromUOM == 'F') || ($fromUOM == 'fah')) { if (($toUOM == 'F') || ($toUOM == 'fah')) { - return $value; - } else { - $value = (($value - 32) / 1.8); - if (($toUOM == 'K') || ($toUOM == 'kel')) { - $value += 273.15; - } - return $value; } + $value = (($value - 32) / 1.8); + if (($toUOM == 'K') || ($toUOM == 'kel')) { + $value += 273.15; + } + + return $value; } elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) && (($toUOM == 'K') || ($toUOM == 'kel')) ) { diff --git a/src/PhpSpreadsheet/Calculation/Exception.php b/src/PhpSpreadsheet/Calculation/Exception.php index 61ab2d4a..8674eb1e 100644 --- a/src/PhpSpreadsheet/Calculation/Exception.php +++ b/src/PhpSpreadsheet/Calculation/Exception.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Exception extends \PhpOffice\PhpSpreadsheet\Exception { /** - * Error handler callback + * Error handler callback. * * @param mixed $code * @param mixed $string diff --git a/src/PhpSpreadsheet/Calculation/ExceptionHandler.php b/src/PhpSpreadsheet/Calculation/ExceptionHandler.php index 0d606b47..918ae0eb 100644 --- a/src/PhpSpreadsheet/Calculation/ExceptionHandler.php +++ b/src/PhpSpreadsheet/Calculation/ExceptionHandler.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class ExceptionHandler { /** - * Register errorhandler + * Register errorhandler. */ public function __construct() { @@ -34,7 +35,7 @@ class ExceptionHandler } /** - * Unregister errorhandler + * Unregister errorhandler. */ public function __destruct() { diff --git a/src/PhpSpreadsheet/Calculation/Financial.php b/src/PhpSpreadsheet/Calculation/Financial.php index 850dd467..5f2ac445 100644 --- a/src/PhpSpreadsheet/Calculation/Financial.php +++ b/src/PhpSpreadsheet/Calculation/Financial.php @@ -9,7 +9,7 @@ define('FINANCIAL_MAX_ITERATIONS', 128); define('FINANCIAL_PRECISION', 1.0e-08); /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,17 +26,19 @@ define('FINANCIAL_PRECISION', 1.0e-08); * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Financial { /** - * isLastDayOfMonth + * isLastDayOfMonth. * * Returns a boolean TRUE/FALSE indicating if this date is the last date of the month * * @param DateTime $testDate The date for testing + * * @return bool */ private static function isLastDayOfMonth($testDate) @@ -45,11 +47,12 @@ class Financial } /** - * isFirstDayOfMonth + * isFirstDayOfMonth. * * Returns a boolean TRUE/FALSE indicating if this date is the first date of the month * * @param DateTime $testDate The date for testing + * * @return bool */ private static function isFirstDayOfMonth($testDate) @@ -92,7 +95,7 @@ class Financial } /** - * daysPerYear + * daysPerYear. * * Returns the number of days in a specified year, as defined by the "basis" value * @@ -103,6 +106,7 @@ class Financial * 2 360 * 3 365 * 4 European 360 + * * @return int */ private static function daysPerYear($year, $basis = 0) @@ -140,7 +144,7 @@ class Financial } /** - * ACCRINT + * ACCRINT. * * Returns the accrued interest for a security that pays periodic interest. * @@ -148,12 +152,13 @@ class Financial * ACCRINT(issue,firstinterest,settlement,rate,par,frequency[,basis]) * * @category Financial Functions - * @param mixed $issue The security's issue date. - * @param mixed $firstinterest The security's first interest date. + * + * @param mixed $issue the security's issue date + * @param mixed $firstinterest the security's first interest date * @param mixed $settlement The security's settlement date. * The security settlement date is the date after the issue date * when the security is traded to the buyer. - * @param float $rate The security's annual coupon rate. + * @param float $rate the security's annual coupon rate * @param float $par The security's par value. * If you omit par, ACCRINT uses $1,000. * @param int $frequency the number of coupon payments per year. @@ -171,6 +176,7 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * * @return float */ public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0) @@ -203,7 +209,7 @@ class Financial } /** - * ACCRINTM + * ACCRINTM. * * Returns the accrued interest for a security that pays interest at maturity. * @@ -211,9 +217,10 @@ class Financial * ACCRINTM(issue,settlement,rate[,par[,basis]]) * * @category Financial Functions - * @param mixed issue The security's issue date. - * @param mixed settlement The security's settlement (or maturity) date. - * @param float rate The security's annual coupon rate. + * + * @param mixed issue The security's issue date + * @param mixed settlement The security's settlement (or maturity) date + * @param float rate The security's annual coupon rate * @param float par The security's par value. * If you omit par, ACCRINT uses $1,000. * @param int basis The type of day count to use. @@ -222,6 +229,12 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $issue + * @param mixed $settlement + * @param mixed $rate + * @param mixed $par + * @param mixed $basis + * * @return float */ public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0) @@ -252,7 +265,7 @@ class Financial } /** - * AMORDEGRC + * AMORDEGRC. * * Returns the depreciation for each accounting period. * This function is provided for the French accounting system. If an asset is purchased in @@ -267,18 +280,27 @@ class Financial * AMORDEGRC(cost,purchased,firstPeriod,salvage,period,rate[,basis]) * * @category Financial Functions - * @param float cost The cost of the asset. - * @param mixed purchased Date of the purchase of the asset. - * @param mixed firstPeriod Date of the end of the first period. - * @param mixed salvage The salvage value at the end of the life of the asset. - * @param float period The period. - * @param float rate Rate of depreciation. + * + * @param float cost The cost of the asset + * @param mixed purchased Date of the purchase of the asset + * @param mixed firstPeriod Date of the end of the first period + * @param mixed salvage The salvage value at the end of the life of the asset + * @param float period The period + * @param float rate Rate of depreciation * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $cost + * @param mixed $purchased + * @param mixed $firstPeriod + * @param mixed $salvage + * @param mixed $period + * @param mixed $rate + * @param mixed $basis + * * @return float */ public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) @@ -333,7 +355,7 @@ class Financial } /** - * AMORLINC + * AMORLINC. * * Returns the depreciation for each accounting period. * This function is provided for the French accounting system. If an asset is purchased in @@ -343,18 +365,27 @@ class Financial * AMORLINC(cost,purchased,firstPeriod,salvage,period,rate[,basis]) * * @category Financial Functions - * @param float cost The cost of the asset. - * @param mixed purchased Date of the purchase of the asset. - * @param mixed firstPeriod Date of the end of the first period. - * @param mixed salvage The salvage value at the end of the life of the asset. - * @param float period The period. - * @param float rate Rate of depreciation. + * + * @param float cost The cost of the asset + * @param mixed purchased Date of the purchase of the asset + * @param mixed firstPeriod Date of the end of the first period + * @param mixed salvage The salvage value at the end of the life of the asset + * @param float period The period + * @param float rate Rate of depreciation * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $cost + * @param mixed $purchased + * @param mixed $firstPeriod + * @param mixed $salvage + * @param mixed $period + * @param mixed $rate + * @param mixed $basis + * * @return float */ public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) @@ -378,7 +409,7 @@ class Financial } $f0Rate = $yearFrac * $rate * $cost; - $nNumOfFullPeriods = intval(($cost - $salvage - $f0Rate) / $fOneRate); + $nNumOfFullPeriods = (int) (($cost - $salvage - $f0Rate) / $fOneRate); if ($period == 0) { return $f0Rate; @@ -386,13 +417,13 @@ class Financial return $fOneRate; } elseif ($period == ($nNumOfFullPeriods + 1)) { return $fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate; - } else { - return 0.0; } + + return 0.0; } /** - * COUPDAYBS + * COUPDAYBS. * * Returns the number of days from the beginning of the coupon period to the settlement date. * @@ -400,6 +431,7 @@ class Financial * COUPDAYBS(settlement,maturity,frequency[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. @@ -420,6 +452,11 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $frequency + * @param mixed $basis + * * @return float */ public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0) @@ -449,7 +486,7 @@ class Financial } /** - * COUPDAYS + * COUPDAYS. * * Returns the number of days in the coupon period that contains the settlement date. * @@ -457,6 +494,7 @@ class Financial * COUPDAYS(settlement,maturity,frequency[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. @@ -478,6 +516,10 @@ class Financial * 3 Actual/365 * 4 European 30/360 * @param int $frequency + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $basis + * * @return float */ public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0) @@ -524,7 +566,7 @@ class Financial } /** - * COUPDAYSNC + * COUPDAYSNC. * * Returns the number of days from the settlement date to the next coupon date. * @@ -532,6 +574,7 @@ class Financial * COUPDAYSNC(settlement,maturity,frequency[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. @@ -552,6 +595,11 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $frequency + * @param mixed $basis + * * @return float */ public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0) @@ -581,7 +629,7 @@ class Financial } /** - * COUPNCD + * COUPNCD. * * Returns the next coupon date after the settlement date. * @@ -589,6 +637,7 @@ class Financial * COUPNCD(settlement,maturity,frequency[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. @@ -609,6 +658,11 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $frequency + * @param mixed $basis + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -636,7 +690,7 @@ class Financial } /** - * COUPNUM + * COUPNUM. * * Returns the number of coupons payable between the settlement date and maturity date, * rounded up to the nearest whole coupon. @@ -645,6 +699,7 @@ class Financial * COUPNUM(settlement,maturity,frequency[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. @@ -665,6 +720,11 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $frequency + * @param mixed $basis + * * @return int */ public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0) @@ -707,7 +767,7 @@ class Financial } /** - * COUPPCD + * COUPPCD. * * Returns the previous coupon date before the settlement date. * @@ -715,6 +775,7 @@ class Financial * COUPPCD(settlement,maturity,frequency[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. @@ -735,6 +796,11 @@ class Financial * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $frequency + * @param mixed $basis + * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ @@ -762,7 +828,7 @@ class Financial } /** - * CUMIPMT + * CUMIPMT. * * Returns the cumulative interest paid on a loan between the start and end periods. * @@ -770,15 +836,17 @@ class Financial * CUMIPMT(rate,nper,pv,start,end[,type]) * * @category Financial Functions + * * @param float $rate The Interest rate * @param int $nper The total number of payment periods * @param float $pv Present Value * @param int $start The first period in the calculation. * Payment periods are numbered beginning with 1. - * @param int $end The last period in the calculation. + * @param int $end the last period in the calculation * @param int $type A number 0 or 1 and indicates when payments are due: * 0 or omitted At the end of the period. * 1 At the beginning of the period. + * * @return float */ public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0) @@ -808,7 +876,7 @@ class Financial } /** - * CUMPRINC + * CUMPRINC. * * Returns the cumulative principal paid on a loan between the start and end periods. * @@ -816,15 +884,17 @@ class Financial * CUMPRINC(rate,nper,pv,start,end[,type]) * * @category Financial Functions + * * @param float $rate The Interest rate * @param int $nper The total number of payment periods * @param float $pv Present Value * @param int $start The first period in the calculation. * Payment periods are numbered beginning with 1. - * @param int $end The last period in the calculation. + * @param int $end the last period in the calculation * @param int $type A number 0 or 1 and indicates when payments are due: * 0 or omitted At the end of the period. * 1 At the beginning of the period. + * * @return float */ public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0) @@ -854,7 +924,7 @@ class Financial } /** - * DB + * DB. * * Returns the depreciation of an asset for a specified period using the * fixed-declining balance method. @@ -867,7 +937,8 @@ class Financial * DB(cost,salvage,life,period[,month]) * * @category Financial Functions - * @param float cost Initial cost of the asset. + * + * @param float cost Initial cost of the asset * @param float salvage Value at the end of the depreciation. * (Sometimes called the salvage value of the asset) * @param int life Number of periods over which the asset is depreciated. @@ -876,6 +947,12 @@ class Financial * depreciation. Period must use the same units as life. * @param int month Number of months in the first year. If month is omitted, * it defaults to 12. + * @param mixed $cost + * @param mixed $salvage + * @param mixed $life + * @param mixed $period + * @param mixed $month + * * @return float */ public static function DB($cost, $salvage, $life, $period, $month = 12) @@ -925,7 +1002,7 @@ class Financial } /** - * DDB + * DDB. * * Returns the depreciation of an asset for a specified period using the * double-declining balance method or some other method you specify. @@ -934,7 +1011,8 @@ class Financial * DDB(cost,salvage,life,period[,factor]) * * @category Financial Functions - * @param float cost Initial cost of the asset. + * + * @param float cost Initial cost of the asset * @param float salvage Value at the end of the depreciation. * (Sometimes called the salvage value of the asset) * @param int life Number of periods over which the asset is depreciated. @@ -944,6 +1022,12 @@ class Financial * @param float factor The rate at which the balance declines. * If factor is omitted, it is assumed to be 2 (the * double-declining balance method). + * @param mixed $cost + * @param mixed $salvage + * @param mixed $life + * @param mixed $period + * @param mixed $factor + * * @return float */ public static function DDB($cost, $salvage, $life, $period, $factor = 2.0) @@ -985,7 +1069,7 @@ class Financial } /** - * DISC + * DISC. * * Returns the discount rate for a security. * @@ -993,19 +1077,26 @@ class Financial * DISC(settlement,maturity,price,redemption[,basis]) * * @category Financial Functions + * * @param mixed settlement The security's settlement date. * The security settlement date is the date after the issue * date when the security is traded to the buyer. * @param mixed maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param int price The security's price per $100 face value. - * @param int redemption The security's redemption value per $100 face value. + * @param int price The security's price per $100 face value + * @param int redemption The security's redemption value per $100 face value * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $price + * @param mixed $redemption + * @param mixed $basis + * * @return float */ public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0) @@ -1037,7 +1128,7 @@ class Financial } /** - * DOLLARDE + * DOLLARDE. * * Converts a dollar price expressed as an integer part and a fraction * part into a dollar price expressed as a decimal number. @@ -1047,8 +1138,10 @@ class Financial * DOLLARDE(fractional_dollar,fraction) * * @category Financial Functions + * * @param float $fractional_dollar Fractional Dollar * @param int $fraction Fraction + * * @return float */ public static function DOLLARDE($fractional_dollar = null, $fraction = 0) @@ -1073,7 +1166,7 @@ class Financial } /** - * DOLLARFR + * DOLLARFR. * * Converts a dollar price expressed as a decimal number into a dollar price * expressed as a fraction. @@ -1083,8 +1176,10 @@ class Financial * DOLLARFR(decimal_dollar,fraction) * * @category Financial Functions + * * @param float $decimal_dollar Decimal Dollar * @param int $fraction Fraction + * * @return float */ public static function DOLLARFR($decimal_dollar = null, $fraction = 0) @@ -1109,7 +1204,7 @@ class Financial } /** - * EFFECT + * EFFECT. * * Returns the effective interest rate given the nominal rate and the number of * compounding payments per year. @@ -1118,8 +1213,10 @@ class Financial * EFFECT(nominal_rate,npery) * * @category Financial Functions + * * @param float $nominal_rate Nominal interest rate * @param int $npery Number of compounding payments per year + * * @return float */ public static function EFFECT($nominal_rate = 0, $npery = 0) @@ -1136,7 +1233,7 @@ class Financial } /** - * FV + * FV. * * Returns the Future Value of a cash flow with constant payments and interest rate (annuities). * @@ -1144,16 +1241,18 @@ class Financial * FV(rate,nper,pmt[,pv[,type]]) * * @category Financial Functions + * * @param float $rate The interest rate per period * @param int $nper Total number of payment periods in an annuity * @param float $pmt The payment made each period: it cannot change over the * life of the annuity. Typically, pmt contains principal * and interest but no other fees or taxes. - * @param float $pv Present Value, or the lump-sum amount that a series of - * future payments is worth right now. + * @param float $pv present Value, or the lump-sum amount that a series of + * future payments is worth right now * @param int $type A number 0 or 1 and indicates when payments are due: * 0 or omitted At the end of the period. * 1 At the beginning of the period. + * * @return float */ public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0) @@ -1178,7 +1277,7 @@ class Financial } /** - * FVSCHEDULE + * FVSCHEDULE. * * Returns the future value of an initial principal after applying a series of compound interest rates. * Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate. @@ -1186,8 +1285,9 @@ class Financial * Excel Function: * FVSCHEDULE(principal,schedule) * - * @param float $principal The present value. - * @param float[] $schedule An array of interest rates to apply. + * @param float $principal the present value + * @param float[] $schedule an array of interest rates to apply + * * @return float */ public static function FVSCHEDULE($principal, $schedule) @@ -1203,7 +1303,7 @@ class Financial } /** - * INTRATE + * INTRATE. * * Returns the interest rate for a fully invested security. * @@ -1214,14 +1314,15 @@ class Financial * The security settlement date is the date after the issue date when the security is traded to the buyer. * @param mixed $maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param int $investment The amount invested in the security. - * @param int $redemption The amount to be received at maturity. + * @param int $investment the amount invested in the security + * @param int $redemption the amount to be received at maturity * @param int $basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * * @return float */ public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0) @@ -1253,7 +1354,7 @@ class Financial } /** - * IPMT + * IPMT. * * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. * @@ -1266,6 +1367,7 @@ class Financial * @param float $pv Present Value * @param float $fv Future Value * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * * @return float */ public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) @@ -1292,7 +1394,7 @@ class Financial } /** - * IRR + * IRR. * * Returns the internal rate of return for a series of cash flows represented by the numbers in values. * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur @@ -1308,6 +1410,7 @@ class Financial * Values must contain at least one positive value and one negative value to * calculate the internal rate of return. * @param float $guess A number that you guess is close to the result of IRR + * * @return float */ public static function IRR($values, $guess = 0.1) @@ -1362,7 +1465,7 @@ class Financial } /** - * ISPMT + * ISPMT. * * Returns the interest payment for an investment based on an interest rate and a constant payment schedule. * @@ -1404,7 +1507,7 @@ class Financial } /** - * MIRR + * MIRR. * * Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both * the cost of the investment and the interest received on reinvestment of cash. @@ -1417,6 +1520,7 @@ class Financial * Payments are negative value, income is positive values. * @param float $finance_rate The interest rate you pay on the money used in the cash flows * @param float $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them + * * @return float */ public static function MIRR($values, $finance_rate, $reinvestment_rate) @@ -1452,12 +1556,13 @@ class Financial } /** - * NOMINAL + * NOMINAL. * * Returns the nominal interest rate given the effective rate and the number of compounding payments per year. * * @param float $effect_rate Effective interest rate * @param int $npery Number of compounding payments per year + * * @return float */ public static function NOMINAL($effect_rate = 0, $npery = 0) @@ -1475,7 +1580,7 @@ class Financial } /** - * NPER + * NPER. * * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate. * @@ -1484,6 +1589,7 @@ class Financial * @param float $pv Present Value * @param float $fv Future Value * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * * @return float */ public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) @@ -1515,7 +1621,7 @@ class Financial } /** - * NPV + * NPV. * * Returns the Net Present Value of a cash flow series given a discount rate. * @@ -1543,7 +1649,7 @@ class Financial } /** - * PMT + * PMT. * * Returns the constant payment (annuity) for a cash flow with a constant interest rate. * @@ -1552,6 +1658,7 @@ class Financial * @param float $pv Present Value * @param float $fv Future Value * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * * @return float */ public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0) @@ -1576,7 +1683,7 @@ class Financial } /** - * PPMT + * PPMT. * * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. * @@ -1586,6 +1693,7 @@ class Financial * @param float $pv Present Value * @param float $fv Future Value * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * * @return float */ public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) @@ -1653,7 +1761,7 @@ class Financial } /** - * PRICEDISC + * PRICEDISC. * * Returns the price per $100 face value of a discounted security. * @@ -1661,14 +1769,20 @@ class Financial * The security settlement date is the date after the issue date when the security is traded to the buyer. * @param mixed maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param int discount The security's discount rate. - * @param int redemption The security's redemption value per $100 face value. + * @param int discount The security's discount rate + * @param int redemption The security's redemption value per $100 face value * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $discount + * @param mixed $redemption + * @param mixed $basis + * * @return float */ public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0) @@ -1697,7 +1811,7 @@ class Financial } /** - * PRICEMAT + * PRICEMAT. * * Returns the price per $100 face value of a security that pays interest at maturity. * @@ -1705,15 +1819,22 @@ class Financial * The security's settlement date is the date after the issue date when the security is traded to the buyer. * @param mixed maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param mixed issue The security's issue date. - * @param int rate The security's interest rate at date of issue. - * @param int yield The security's annual yield. + * @param mixed issue The security's issue date + * @param int rate The security's interest rate at date of issue + * @param int yield The security's annual yield * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $issue + * @param mixed $rate + * @param mixed $yield + * @param mixed $basis + * * @return float */ public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0) @@ -1762,7 +1883,7 @@ class Financial } /** - * PV + * PV. * * Returns the Present Value of a cash flow with constant payments and interest rate (annuities). * @@ -1771,6 +1892,7 @@ class Financial * @param float $pmt Periodic payment (annuity) * @param float $fv Future Value * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * * @return float */ public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0) @@ -1795,7 +1917,7 @@ class Financial } /** - * RATE + * RATE. * * Returns the interest rate per period of an annuity. * RATE is calculated by iteration and can have zero or more solutions. @@ -1806,13 +1928,14 @@ class Financial * RATE(nper,pmt,pv[,fv[,type[,guess]]]) * * @category Financial Functions - * @param float nper The total number of payment periods in an annuity. + * + * @param float nper The total number of payment periods in an annuity * @param float pmt The payment made each period and cannot change over the life * of the annuity. * Typically, pmt includes principal and interest but no other * fees or taxes. * @param float pv The present value - the total amount that a series of future - * payments is worth now. + * payments is worth now * @param float fv The future value, or a cash balance you want to attain after * the last payment is made. If fv is omitted, it is assumed * to be 0 (the future value of a loan, for example, is 0). @@ -1821,6 +1944,13 @@ class Financial * 1 At the beginning of the period. * @param float guess Your guess for what the rate will be. * If you omit guess, it is assumed to be 10 percent. + * @param mixed $nper + * @param mixed $pmt + * @param mixed $pv + * @param mixed $fv + * @param mixed $type + * @param mixed $guess + * * @return float **/ public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) @@ -1868,7 +1998,7 @@ class Financial } /** - * RECEIVED + * RECEIVED. * * Returns the price per $100 face value of a discounted security. * @@ -1876,14 +2006,20 @@ class Financial * The security settlement date is the date after the issue date when the security is traded to the buyer. * @param mixed maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param int investment The amount invested in the security. - * @param int discount The security's discount rate. + * @param int investment The amount invested in the security + * @param int discount The security's discount rate * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $investment + * @param mixed $discount + * @param mixed $basis + * * @return float */ public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0) @@ -1912,13 +2048,17 @@ class Financial } /** - * SLN + * SLN. * * Returns the straight-line depreciation of an asset for one period * * @param cost Initial cost of the asset * @param salvage Value at the end of the depreciation * @param life Number of periods over which the asset is depreciated + * @param mixed $cost + * @param mixed $salvage + * @param mixed $life + * * @return float */ public static function SLN($cost, $salvage, $life) @@ -1940,7 +2080,7 @@ class Financial } /** - * SYD + * SYD. * * Returns the sum-of-years' digits depreciation of an asset for a specified period. * @@ -1948,6 +2088,11 @@ class Financial * @param salvage Value at the end of the depreciation * @param life Number of periods over which the asset is depreciated * @param period Period + * @param mixed $cost + * @param mixed $salvage + * @param mixed $life + * @param mixed $period + * * @return float */ public static function SYD($cost, $salvage, $life, $period) @@ -1970,7 +2115,7 @@ class Financial } /** - * TBILLEQ + * TBILLEQ. * * Returns the bond-equivalent yield for a Treasury bill. * @@ -1978,7 +2123,11 @@ class Financial * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. * @param mixed maturity The Treasury bill's maturity date. * The maturity date is the date when the Treasury bill expires. - * @param int discount The Treasury bill's discount rate. + * @param int discount The Treasury bill's discount rate + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $discount + * * @return float */ public static function TBILLEQ($settlement, $maturity, $discount) @@ -2008,7 +2157,7 @@ class Financial } /** - * TBILLPRICE + * TBILLPRICE. * * Returns the yield for a Treasury bill. * @@ -2016,7 +2165,11 @@ class Financial * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. * @param mixed maturity The Treasury bill's maturity date. * The maturity date is the date when the Treasury bill expires. - * @param int discount The Treasury bill's discount rate. + * @param int discount The Treasury bill's discount rate + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $discount + * * @return float */ public static function TBILLPRICE($settlement, $maturity, $discount) @@ -2062,7 +2215,7 @@ class Financial } /** - * TBILLYIELD + * TBILLYIELD. * * Returns the yield for a Treasury bill. * @@ -2070,7 +2223,11 @@ class Financial * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. * @param mixed maturity The Treasury bill's maturity date. * The maturity date is the date when the Treasury bill expires. - * @param int price The Treasury bill's price per $100 face value. + * @param int price The Treasury bill's price per $100 face value + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $price + * * @return float */ public static function TBILLYIELD($settlement, $maturity, $price) @@ -2161,7 +2318,7 @@ class Financial } /** - * XNPV + * XNPV. * * Returns the net present value for a schedule of cash flows that is not necessarily periodic. * To calculate the net present value for a series of cash flows that is periodic, use the NPV function. @@ -2169,7 +2326,7 @@ class Financial * Excel Function: * =XNPV(rate,values,dates) * - * @param float $rate The discount rate to apply to the cash flows. + * @param float $rate the discount rate to apply to the cash flows * @param array of float $values A series of cash flows that corresponds to a schedule of payments in dates. * The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment. * If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year. @@ -2177,6 +2334,7 @@ class Financial * @param array of mixed $dates A schedule of payment dates that corresponds to the cash flow payments. * The first payment date indicates the beginning of the schedule of payments. * All other dates must be later than this date, but they may occur in any order. + * * @return float */ public static function XNPV($rate, $values, $dates) @@ -2210,7 +2368,7 @@ class Financial } /** - * YIELDDISC + * YIELDDISC. * * Returns the annual yield of a security that pays interest at maturity. * @@ -2218,14 +2376,20 @@ class Financial * The security's settlement date is the date after the issue date when the security is traded to the buyer. * @param mixed maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param int price The security's price per $100 face value. - * @param int redemption The security's redemption value per $100 face value. + * @param int price The security's price per $100 face value + * @param int redemption The security's redemption value per $100 face value * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $price + * @param mixed $redemption + * @param mixed $basis + * * @return float */ public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0) @@ -2259,7 +2423,7 @@ class Financial } /** - * YIELDMAT + * YIELDMAT. * * Returns the annual yield of a security that pays interest at maturity. * @@ -2267,15 +2431,22 @@ class Financial * The security's settlement date is the date after the issue date when the security is traded to the buyer. * @param mixed maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param mixed issue The security's issue date. - * @param int rate The security's interest rate at date of issue. - * @param int price The security's price per $100 face value. + * @param mixed issue The security's issue date + * @param int rate The security's interest rate at date of issue + * @param int price The security's price per $100 face value * @param int basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * @param mixed $settlement + * @param mixed $maturity + * @param mixed $issue + * @param mixed $rate + * @param mixed $price + * @param mixed $basis + * * @return float */ public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0) diff --git a/src/PhpSpreadsheet/Calculation/FormulaParser.php b/src/PhpSpreadsheet/Calculation/FormulaParser.php index 6381f0d2..6c214e5b 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaParser.php +++ b/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -66,23 +67,24 @@ class FormulaParser const OPERATORS_POSTFIX = '%'; /** - * Formula + * Formula. * * @var string */ private $formula; /** - * Tokens + * Tokens. * * @var FormulaToken[] */ private $tokens = []; /** - * Create a new FormulaParser + * Create a new FormulaParser. * * @param string $pFormula Formula to parse + * * @throws Exception */ public function __construct($pFormula = '') @@ -99,7 +101,7 @@ class FormulaParser } /** - * Get Formula + * Get Formula. * * @return string */ @@ -109,23 +111,24 @@ class FormulaParser } /** - * Get Token + * Get Token. * * @param int $pId Token id + * * @throws Exception + * * @return string */ public function getToken($pId = 0) { if (isset($this->tokens[$pId])) { return $this->tokens[$pId]; - } else { - throw new Exception("Token with id $pId does not exist."); } + throw new Exception("Token with id $pId does not exist."); } /** - * Get Token count + * Get Token count. * * @return int */ @@ -135,7 +138,7 @@ class FormulaParser } /** - * Get Tokens + * Get Tokens. * * @return FormulaToken[] */ @@ -145,7 +148,7 @@ class FormulaParser } /** - * Parse to tokens + * Parse to tokens. */ private function parseToTokens() { @@ -154,7 +157,7 @@ class FormulaParser // Check if the formula has a valid starting = $formulaLength = strlen($this->formula); - if ($formulaLength < 2 || $this->formula{0} != '=') { + if ($formulaLength < 2 || $this->formula[0] != '=') { return; } @@ -176,8 +179,8 @@ class FormulaParser // embeds are doubled // end marks token if ($inString) { - if ($this->formula{$index} == self::QUOTE_DOUBLE) { - if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_DOUBLE)) { + if ($this->formula[$index] == self::QUOTE_DOUBLE) { + if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == self::QUOTE_DOUBLE)) { $value .= self::QUOTE_DOUBLE; ++$index; } else { @@ -186,7 +189,7 @@ class FormulaParser $value = ''; } } else { - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; } ++$index; continue; @@ -196,15 +199,15 @@ class FormulaParser // embeds are double // end does not mark a token if ($inPath) { - if ($this->formula{$index} == self::QUOTE_SINGLE) { - if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == self::QUOTE_SINGLE)) { + if ($this->formula[$index] == self::QUOTE_SINGLE) { + if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == self::QUOTE_SINGLE)) { $value .= self::QUOTE_SINGLE; ++$index; } else { $inPath = false; } } else { - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; } ++$index; continue; @@ -214,10 +217,10 @@ class FormulaParser // no embeds (changed to "()" by Excel) // end does not mark a token if ($inRange) { - if ($this->formula{$index} == self::BRACKET_CLOSE) { + if ($this->formula[$index] == self::BRACKET_CLOSE) { $inRange = false; } - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; ++$index; continue; } @@ -225,7 +228,7 @@ class FormulaParser // error values // end marks a token, determined from absolute list of values if ($inError) { - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; ++$index; if (in_array($value, $ERRORS)) { $inError = false; @@ -236,10 +239,10 @@ class FormulaParser } // scientific notation check - if (strpos(self::OPERATORS_SN, $this->formula{$index}) !== false) { + if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) { if (strlen($value) > 1) { - if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) { - $value .= $this->formula{$index}; + if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula[$index]) != 0) { + $value .= $this->formula[$index]; ++$index; continue; } @@ -249,7 +252,7 @@ class FormulaParser // independent character evaluation (order not important) // establish state-dependent character evaluations - if ($this->formula{$index} == self::QUOTE_DOUBLE) { + if ($this->formula[$index] == self::QUOTE_DOUBLE) { if (strlen($value > 0)) { // unexpected $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); @@ -260,7 +263,7 @@ class FormulaParser continue; } - if ($this->formula{$index} == self::QUOTE_SINGLE) { + if ($this->formula[$index] == self::QUOTE_SINGLE) { if (strlen($value) > 0) { // unexpected $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); @@ -271,14 +274,14 @@ class FormulaParser continue; } - if ($this->formula{$index} == self::BRACKET_OPEN) { + if ($this->formula[$index] == self::BRACKET_OPEN) { $inRange = true; $value .= self::BRACKET_OPEN; ++$index; continue; } - if ($this->formula{$index} == self::ERROR_START) { + if ($this->formula[$index] == self::ERROR_START) { if (strlen($value) > 0) { // unexpected $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); @@ -291,7 +294,7 @@ class FormulaParser } // mark start and end of arrays and array rows - if ($this->formula{$index} == self::BRACE_OPEN) { + if ($this->formula[$index] == self::BRACE_OPEN) { if (strlen($value) > 0) { // unexpected $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); @@ -310,7 +313,7 @@ class FormulaParser continue; } - if ($this->formula{$index} == self::SEMICOLON) { + if ($this->formula[$index] == self::SEMICOLON) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; @@ -332,7 +335,7 @@ class FormulaParser continue; } - if ($this->formula{$index} == self::BRACE_CLOSE) { + if ($this->formula[$index] == self::BRACE_CLOSE) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; @@ -353,14 +356,14 @@ class FormulaParser } // trim white-space - if ($this->formula{$index} == self::WHITESPACE) { + if ($this->formula[$index] == self::WHITESPACE) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; } $tokens1[] = new FormulaToken('', FormulaToken::TOKEN_TYPE_WHITESPACE); ++$index; - while (($this->formula{$index} == self::WHITESPACE) && ($index < $formulaLength)) { + while (($this->formula[$index] == self::WHITESPACE) && ($index < $formulaLength)) { ++$index; } continue; @@ -380,29 +383,29 @@ class FormulaParser } // standard infix operators - if (strpos(self::OPERATORS_INFIX, $this->formula{$index}) !== false) { + if (strpos(self::OPERATORS_INFIX, $this->formula[$index]) !== false) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; } - $tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORINFIX); + $tokens1[] = new FormulaToken($this->formula[$index], FormulaToken::TOKEN_TYPE_OPERATORINFIX); ++$index; continue; } // standard postfix operators (only one) - if (strpos(self::OPERATORS_POSTFIX, $this->formula{$index}) !== false) { + if (strpos(self::OPERATORS_POSTFIX, $this->formula[$index]) !== false) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; } - $tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); + $tokens1[] = new FormulaToken($this->formula[$index], FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); ++$index; continue; } // start subexpression or function - if ($this->formula{$index} == self::PAREN_OPEN) { + if ($this->formula[$index] == self::PAREN_OPEN) { if (strlen($value) > 0) { $tmp = new FormulaToken($value, FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START); $tokens1[] = $tmp; @@ -418,7 +421,7 @@ class FormulaParser } // function, subexpression, or array parameters, or operand unions - if ($this->formula{$index} == self::COMMA) { + if ($this->formula[$index] == self::COMMA) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; @@ -439,7 +442,7 @@ class FormulaParser } // stop subexpression - if ($this->formula{$index} == self::PAREN_CLOSE) { + if ($this->formula[$index] == self::PAREN_CLOSE) { if (strlen($value) > 0) { $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); $value = ''; @@ -455,7 +458,7 @@ class FormulaParser } // token accumulation - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; ++$index; } diff --git a/src/PhpSpreadsheet/Calculation/FormulaToken.php b/src/PhpSpreadsheet/Calculation/FormulaToken.php index f9360ca6..d6a39fdf 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaToken.php +++ b/src/PhpSpreadsheet/Calculation/FormulaToken.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -75,28 +76,28 @@ class FormulaToken const TOKEN_SUBTYPE_UNION = 'Union'; /** - * Value + * Value. * * @var string */ private $value; /** - * Token Type (represented by TOKEN_TYPE_*) + * Token Type (represented by TOKEN_TYPE_*). * * @var string */ private $tokenType; /** - * Token SubType (represented by TOKEN_SUBTYPE_*) + * Token SubType (represented by TOKEN_SUBTYPE_*). * * @var string */ private $tokenSubType; /** - * Create a new FormulaToken + * Create a new FormulaToken. * * @param string $pValue * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) @@ -111,7 +112,7 @@ class FormulaToken } /** - * Get Value + * Get Value. * * @return string */ @@ -121,7 +122,7 @@ class FormulaToken } /** - * Set Value + * Set Value. * * @param string $value */ @@ -131,7 +132,7 @@ class FormulaToken } /** - * Get Token Type (represented by TOKEN_TYPE_*) + * Get Token Type (represented by TOKEN_TYPE_*). * * @return string */ @@ -141,7 +142,7 @@ class FormulaToken } /** - * Set Token Type + * Set Token Type. * * @param string $value */ @@ -151,7 +152,7 @@ class FormulaToken } /** - * Get Token SubType (represented by TOKEN_SUBTYPE_*) + * Get Token SubType (represented by TOKEN_SUBTYPE_*). * * @return string */ @@ -161,7 +162,7 @@ class FormulaToken } /** - * Set Token SubType + * Set Token SubType. * * @param string $value */ diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index f41092ea..bdd2edd2 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -15,7 +15,7 @@ define('MAX_ITERATIONS', 256); define('PRECISION', 8.88E-016); /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,6 +32,7 @@ define('PRECISION', 8.88E-016); * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -47,21 +48,21 @@ class Functions const RETURNDATE_EXCEL = 'E'; /** - * Compatibility mode to use for error checking and responses + * Compatibility mode to use for error checking and responses. * * @var string */ protected static $compatibilityMode = self::COMPATIBILITY_EXCEL; /** - * Data Type to use when returning date values + * Data Type to use when returning date values. * * @var string */ protected static $returnDateType = self::RETURNDATE_EXCEL; /** - * List of error codes + * List of error codes. * * @var array */ @@ -77,14 +78,16 @@ class Functions ]; /** - * Set the Compatibility Mode + * Set the Compatibility Mode. * * @category Function Configuration + * * @param string $compatibilityMode Compatibility Mode * Permitted values are: * Functions::COMPATIBILITY_EXCEL 'Excel' * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * * @return bool (Success or Failure) */ public static function setCompatibilityMode($compatibilityMode) @@ -102,9 +105,10 @@ class Functions } /** - * Return the current Compatibility Mode + * Return the current Compatibility Mode. * * @category Function Configuration + * * @return string Compatibility Mode * Possible Return values are: * Functions::COMPATIBILITY_EXCEL 'Excel' @@ -117,14 +121,16 @@ class Functions } /** - * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object) + * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object). * * @category Function Configuration + * * @param string $returnDateType Return Date Format * Permitted values are: * Functions::RETURNDATE_PHP_NUMERIC 'P' * Functions::RETURNDATE_PHP_OBJECT 'O' * Functions::RETURNDATE_EXCEL 'E' + * * @return bool Success or failure */ public static function setReturnDateType($returnDateType) @@ -142,9 +148,10 @@ class Functions } /** - * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object) + * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object). * * @category Function Configuration + * * @return string Return Date Format * Possible Return values are: * Functions::RETURNDATE_PHP_NUMERIC 'P' @@ -157,9 +164,10 @@ class Functions } /** - * DUMMY + * DUMMY. * * @category Error Returns + * * @return string #Not Yet Implemented */ public static function DUMMY() @@ -168,9 +176,10 @@ class Functions } /** - * DIV0 + * DIV0. * * @category Error Returns + * * @return string #Not Yet Implemented */ public static function DIV0() @@ -179,7 +188,7 @@ class Functions } /** - * NA + * NA. * * Excel Function: * =NA() @@ -188,6 +197,7 @@ class Functions * #N/A is the error value that means "no value is available." * * @category Logical Functions + * * @return string #N/A! */ public static function NA() @@ -196,11 +206,12 @@ class Functions } /** - * NaN + * NaN. * * Returns the error value #NUM! * * @category Error Returns + * * @return string #NUM! */ public static function NAN() @@ -209,11 +220,12 @@ class Functions } /** - * NAME + * NAME. * * Returns the error value #NAME? * * @category Error Returns + * * @return string #NAME? */ public static function NAME() @@ -222,11 +234,12 @@ class Functions } /** - * REF + * REF. * * Returns the error value #REF! * * @category Error Returns + * * @return string #REF! */ public static function REF() @@ -235,11 +248,12 @@ class Functions } /** - * NULL + * NULL. * * Returns the error value #NULL! * * @category Error Returns + * * @return string #NULL! */ public static function null() @@ -248,11 +262,12 @@ class Functions } /** - * VALUE + * VALUE. * * Returns the error value #VALUE! * * @category Error Returns + * * @return string #VALUE! */ public static function VALUE() @@ -278,32 +293,32 @@ class Functions public static function ifCondition($condition) { $condition = self::flattenSingleValue($condition); - if (!isset($condition{0})) { + if (!isset($condition[0])) { $condition = '=""'; } - if (!in_array($condition{0}, ['>', '<', '='])) { + if (!in_array($condition[0], ['>', '<', '='])) { if (!is_numeric($condition)) { $condition = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($condition)); } return '=' . $condition; - } else { - preg_match('/([<>=]+)(.*)/', $condition, $matches); - list(, $operator, $operand) = $matches; - - if (!is_numeric($operand)) { - $operand = str_replace('"', '""', $operand); - $operand = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($operand)); - } - - return $operator . $operand; } + preg_match('/([<>=]+)(.*)/', $condition, $matches); + list(, $operator, $operand) = $matches; + + if (!is_numeric($operand)) { + $operand = str_replace('"', '""', $operand); + $operand = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($operand)); + } + + return $operator . $operand; } /** - * ERROR_TYPE + * ERROR_TYPE. * * @param mixed $value Value to check + * * @return bool */ public static function errorType($value = '') @@ -322,9 +337,10 @@ class Functions } /** - * IS_BLANK + * IS_BLANK. * * @param mixed $value Value to check + * * @return bool */ public static function isBlank($value = null) @@ -337,9 +353,10 @@ class Functions } /** - * IS_ERR + * IS_ERR. * * @param mixed $value Value to check + * * @return bool */ public static function isErr($value = '') @@ -350,9 +367,10 @@ class Functions } /** - * IS_ERROR + * IS_ERROR. * * @param mixed $value Value to check + * * @return bool */ public static function isError($value = '') @@ -367,9 +385,10 @@ class Functions } /** - * IS_NA + * IS_NA. * * @param mixed $value Value to check + * * @return bool */ public static function isNa($value = '') @@ -380,9 +399,10 @@ class Functions } /** - * IS_EVEN + * IS_EVEN. * * @param mixed $value Value to check + * * @return string|bool */ public static function isEven($value = null) @@ -399,9 +419,10 @@ class Functions } /** - * IS_ODD + * IS_ODD. * * @param mixed $value Value to check + * * @return string|bool */ public static function isOdd($value = null) @@ -418,9 +439,10 @@ class Functions } /** - * IS_NUMBER + * IS_NUMBER. * * @param mixed $value Value to check + * * @return bool */ public static function isNumber($value = null) @@ -435,9 +457,10 @@ class Functions } /** - * IS_LOGICAL + * IS_LOGICAL. * * @param mixed $value Value to check + * * @return bool */ public static function isLogical($value = null) @@ -448,9 +471,10 @@ class Functions } /** - * IS_TEXT + * IS_TEXT. * * @param mixed $value Value to check + * * @return bool */ public static function isText($value = null) @@ -461,9 +485,10 @@ class Functions } /** - * IS_NONTEXT + * IS_NONTEXT. * * @param mixed $value Value to check + * * @return bool */ public static function isNonText($value = null) @@ -472,11 +497,13 @@ class Functions } /** - * N + * N. * * Returns a value converted to a number * * @param value The value you want converted + * @param null|mixed $value + * * @return number N converts values listed in the following table * If value is or refers to N returns * A number That number @@ -498,10 +525,10 @@ class Functions case 'integer': return $value; case 'boolean': - return (integer) $value; + return (int) $value; case 'string': // Errors - if ((strlen($value) > 0) && ($value{0} == '#')) { + if ((strlen($value) > 0) && ($value[0] == '#')) { return $value; } break; @@ -511,11 +538,13 @@ class Functions } /** - * TYPE + * TYPE. * * Returns a number that identifies the type of a value * * @param value The value you want tested + * @param null|mixed $value + * * @return number N converts values listed in the following table * If value is or refers to N returns * A number 1 @@ -551,7 +580,7 @@ class Functions return 64; } elseif (is_string($value)) { // Errors - if ((strlen($value) > 0) && ($value{0} == '#')) { + if ((strlen($value) > 0) && ($value[0] == '#')) { return 16; } @@ -562,9 +591,10 @@ class Functions } /** - * Convert a multi-dimensional array to a simple 1-dimensional array + * Convert a multi-dimensional array to a simple 1-dimensional array. * * @param array $array Array to be flattened + * * @return array Flattened array */ public static function flattenArray($array) @@ -594,9 +624,10 @@ class Functions } /** - * Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing + * Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing. * * @param array $array Array to be flattened + * * @return array Flattened array */ public static function flattenArrayIndexed($array) @@ -626,9 +657,10 @@ class Functions } /** - * Convert an array to a single scalar value by extracting the first element + * Convert an array to a single scalar value by extracting the first element. * * @param mixed $value Array or scalar value + * * @return mixed */ public static function flattenSingleValue($value = '') diff --git a/src/PhpSpreadsheet/Calculation/Logical.php b/src/PhpSpreadsheet/Calculation/Logical.php index 1bc4711d..e120f90c 100644 --- a/src/PhpSpreadsheet/Calculation/Logical.php +++ b/src/PhpSpreadsheet/Calculation/Logical.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Logical { /** - * TRUE + * TRUE. * * Returns the boolean TRUE. * @@ -34,6 +35,7 @@ class Logical * =TRUE() * * @category Logical Functions + * * @return bool True */ public static function true() @@ -42,7 +44,7 @@ class Logical } /** - * FALSE + * FALSE. * * Returns the boolean FALSE. * @@ -50,6 +52,7 @@ class Logical * =FALSE() * * @category Logical Functions + * * @return bool False */ public static function false() @@ -58,7 +61,7 @@ class Logical } /** - * LOGICAL_AND + * LOGICAL_AND. * * Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE. * @@ -74,8 +77,10 @@ class Logical * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value * * @category Logical Functions + * * @param mixed $arg,... Data values - * @return string|bool The logical AND of the arguments. + * + * @return string|bool the logical AND of the arguments */ public static function logicalAnd() { @@ -113,7 +118,7 @@ class Logical } /** - * LOGICAL_OR + * LOGICAL_OR. * * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE. * @@ -129,8 +134,10 @@ class Logical * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value * * @category Logical Functions + * * @param mixed $arg,... Data values - * @return string|bool The logical OR of the arguments. + * + * @return string|bool the logical OR of the arguments */ public static function logicalOr() { @@ -168,7 +175,7 @@ class Logical } /** - * NOT + * NOT. * * Returns the boolean inverse of the argument. * @@ -183,8 +190,10 @@ class Logical * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value * * @category Logical Functions + * * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE - * @return bool|string The boolean inverse of the argument. + * + * @return bool|string the boolean inverse of the argument */ public static function NOT($logical = false) { @@ -195,16 +204,16 @@ class Logical return false; } elseif (($logical == 'FALSE') || ($logical == \PhpOffice\PhpSpreadsheet\Calculation::getFALSE())) { return true; - } else { - return Functions::VALUE(); } + + return Functions::VALUE(); } return !$logical; } /** - * STATEMENT_IF + * STATEMENT_IF. * * Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. * @@ -229,14 +238,16 @@ class Logical * ReturnIfFalse can be another formula. * * @category Logical Functions + * * @param mixed $condition Condition to evaluate * @param mixed $returnIfTrue Value to return when condition is true * @param mixed $returnIfFalse Optional value to return when condition is false + * * @return mixed The value of returnIfTrue or returnIfFalse determined by condition */ public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false) { - $condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition); + $condition = (is_null($condition)) ? true : (bool) Functions::flattenSingleValue($condition); $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue); $returnIfFalse = (is_null($returnIfFalse)) ? false : Functions::flattenSingleValue($returnIfFalse); @@ -244,14 +255,16 @@ class Logical } /** - * IFERROR + * IFERROR. * * Excel Function: * =IFERROR(testValue,errorpart) * * @category Logical Functions + * * @param mixed $testValue Value to check, is also the value returned when no error * @param mixed $errorpart Value to return when testValue is an error condition + * * @return mixed The value of errorpart or testValue determined by error condition */ public static function IFERROR($testValue = '', $errorpart = '') diff --git a/src/PhpSpreadsheet/Calculation/LookupRef.php b/src/PhpSpreadsheet/Calculation/LookupRef.php index b0e601ba..ceb06411 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class LookupRef { /** - * CELL_ADDRESS + * CELL_ADDRESS. * * Creates a cell address as text, given specified row and column numbers. * @@ -44,6 +45,12 @@ class LookupRef * TRUE or omitted CELL_ADDRESS returns an A1-style reference * FALSE CELL_ADDRESS returns an R1C1-style reference * @param sheetText Optional Name of worksheet to use + * @param mixed $row + * @param mixed $column + * @param mixed $relativity + * @param mixed $referenceStyle + * @param mixed $sheetText + * * @return string */ public static function cellAddress($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '') @@ -74,20 +81,19 @@ class LookupRef } return $sheetText . $columnRelative . $column . $rowRelative . $row; - } else { - if (($relativity == 2) || ($relativity == 4)) { - $column = '[' . $column . ']'; - } - if (($relativity == 3) || ($relativity == 4)) { - $row = '[' . $row . ']'; - } - - return $sheetText . 'R' . $row . 'C' . $column; } + if (($relativity == 2) || ($relativity == 4)) { + $column = '[' . $column . ']'; + } + if (($relativity == 3) || ($relativity == 4)) { + $row = '[' . $row . ']'; + } + + return $sheetText . 'R' . $row . 'C' . $column; } /** - * COLUMN + * COLUMN. * * Returns the column number of the given cell reference * If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array. @@ -98,6 +104,8 @@ class LookupRef * =COLUMN([cellAddress]) * * @param cellAddress A reference to a range of cells for which you want the column numbers + * @param null|mixed $cellAddress + * * @return int or array of integer */ public static function COLUMN($cellAddress = null) @@ -110,7 +118,7 @@ class LookupRef foreach ($cellAddress as $columnKey => $value) { $columnKey = preg_replace('/[^a-z]/i', '', $columnKey); - return (integer) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($columnKey); + return (int) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($columnKey); } } else { if (strpos($cellAddress, '!') !== false) { @@ -122,20 +130,19 @@ class LookupRef $endAddress = preg_replace('/[^a-z]/i', '', $endAddress); $returnValue = []; do { - $returnValue[] = (integer) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($startAddress); + $returnValue[] = (int) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($startAddress); } while ($startAddress++ != $endAddress); return $returnValue; - } else { - $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress); - - return (integer) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($cellAddress); } + $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress); + + return (int) \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($cellAddress); } } /** - * COLUMNS + * COLUMNS. * * Returns the number of columns in an array or reference. * @@ -143,6 +150,8 @@ class LookupRef * =COLUMNS(cellAddress) * * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns + * @param null|mixed $cellAddress + * * @return int The number of columns in cellAddress */ public static function COLUMNS($cellAddress = null) @@ -159,13 +168,13 @@ class LookupRef if ($isMatrix) { return $rows; - } else { - return $columns; } + + return $columns; } /** - * ROW + * ROW. * * Returns the row number of the given cell reference * If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array. @@ -176,6 +185,8 @@ class LookupRef * =ROW([cellAddress]) * * @param cellAddress A reference to a range of cells for which you want the row numbers + * @param null|mixed $cellAddress + * * @return int or array of integer */ public static function ROW($cellAddress = null) @@ -187,7 +198,7 @@ class LookupRef if (is_array($cellAddress)) { foreach ($cellAddress as $columnKey => $rowValue) { foreach ($rowValue as $rowKey => $cellValue) { - return (integer) preg_replace('/[^0-9]/i', '', $rowKey); + return (int) preg_replace('/[^0-9]/i', '', $rowKey); } } } else { @@ -200,20 +211,19 @@ class LookupRef $endAddress = preg_replace('/[^0-9]/', '', $endAddress); $returnValue = []; do { - $returnValue[][] = (integer) $startAddress; + $returnValue[][] = (int) $startAddress; } while ($startAddress++ != $endAddress); return $returnValue; - } else { - list($cellAddress) = explode(':', $cellAddress); - - return (integer) preg_replace('/[^0-9]/', '', $cellAddress); } + list($cellAddress) = explode(':', $cellAddress); + + return (int) preg_replace('/[^0-9]/', '', $cellAddress); } } /** - * ROWS + * ROWS. * * Returns the number of rows in an array or reference. * @@ -221,6 +231,8 @@ class LookupRef * =ROWS(cellAddress) * * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows + * @param null|mixed $cellAddress + * * @return int The number of rows in cellAddress */ public static function ROWS($cellAddress = null) @@ -237,21 +249,23 @@ class LookupRef if ($isMatrix) { return $columns; - } else { - return $rows; } + + return $rows; } /** - * HYPERLINK + * HYPERLINK. * * Excel Function: * =HYPERLINK(linkURL,displayName) * * @category Logical Functions + * * @param string $linkURL Value to check, is also the value returned when no error * @param string $displayName Value to return when testValue is an error condition * @param \PhpOffice\PhpSpreadsheet\Cell $pCell The cell to set the hyperlink in + * * @return mixed The value of $displayName (or $linkURL if $displayName was blank) */ public static function HYPERLINK($linkURL = '', $displayName = null, \PhpOffice\PhpSpreadsheet\Cell $pCell = null) @@ -277,7 +291,7 @@ class LookupRef } /** - * INDIRECT + * INDIRECT. * * Returns the reference specified by a text string. * References are immediately evaluated to display their contents. @@ -289,6 +303,7 @@ class LookupRef * * @param cellAddress $cellAddress The cell address of the current cell (containing this formula) * @param \PhpOffice\PhpSpreadsheet\Cell $pCell The current cell (containing this formula) + * * @return mixed The cells referenced by cellAddress * * @todo Support for the optional a1 parameter introduced in Excel 2010 @@ -335,7 +350,7 @@ class LookupRef } /** - * OFFSET + * OFFSET. * * Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. * The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and @@ -357,6 +372,12 @@ class LookupRef * starting reference). * @param height The height, in number of rows, that you want the returned reference to be. Height must be a positive number. * @param width The width, in number of columns, that you want the returned reference to be. Width must be a positive number. + * @param null|mixed $cellAddress + * @param mixed $rows + * @param mixed $columns + * @param null|mixed $height + * @param null|mixed $width + * * @return string A reference to a cell or range of cells */ public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null) @@ -429,7 +450,7 @@ class LookupRef } /** - * CHOOSE + * CHOOSE. * * Uses lookup_value to return a value from the list of value arguments. * Use CHOOSE to select one of up to 254 values based on the lookup_value. @@ -444,6 +465,7 @@ class LookupRef * Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on * index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or * text. + * * @return mixed The selected value */ public static function CHOOSE() @@ -467,13 +489,13 @@ class LookupRef if (is_array($chooseArgs[$chosenEntry])) { return Functions::flattenArray($chooseArgs[$chosenEntry]); - } else { - return $chooseArgs[$chosenEntry]; } + + return $chooseArgs[$chosenEntry]; } /** - * MATCH + * MATCH. * * The MATCH function searches for a specified item in a range of cells * @@ -483,6 +505,10 @@ class LookupRef * @param lookup_value The value that you want to match in lookup_array * @param lookup_array The range of cells being searched * @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered. + * @param mixed $lookup_value + * @param mixed $lookup_array + * @param mixed $match_type + * * @return int The relative position of the found item */ public static function MATCH($lookup_value, $lookup_array, $match_type = 1) @@ -547,20 +573,18 @@ class LookupRef if ($i < 1) { // 1st cell was already smaller than the lookup_value break; - } else { + } // the previous cell was the match return $keySet[$i - 1] + 1; - } } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) { $i = array_search($i, $keySet); // if match_type is 1 <=> find the largest value that is less than or equal to lookup_value if ($i < 1) { // 1st cell was already bigger than the lookup_value break; - } else { + } // the previous cell was the match return $keySet[$i - 1] + 1; - } } } @@ -569,7 +593,7 @@ class LookupRef } /** - * INDEX + * INDEX. * * Uses an index to choose a value from a reference or array * @@ -579,6 +603,10 @@ class LookupRef * @param range_array A range of cells or an array constant * @param row_num The row in array from which to return a value. If row_num is omitted, column_num is required. * @param column_num The column in array from which to return a value. If column_num is omitted, row_num is required. + * @param mixed $arrayValues + * @param mixed $rowNum + * @param mixed $columnNum + * * @return mixed the value of a specified cell or array of cells */ public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0) @@ -628,12 +656,13 @@ class LookupRef } /** - * TRANSPOSE + * TRANSPOSE. * * @param array $matrixData A matrix of values + * * @return array * - * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix. + * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix */ public static function TRANSPOSE($matrixData) { @@ -669,10 +698,16 @@ class LookupRef /** * VLOOKUP * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number. + * * @param lookup_value The value that you want to match in lookup_array * @param lookup_array The range of cells being searched * @param index_number The column number in table_array from which the matching value must be returned. The first column is 1. - * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. + * @param not_exact_match determines if you are looking for an exact match based on lookup_value + * @param mixed $lookup_value + * @param mixed $lookup_array + * @param mixed $index_number + * @param mixed $not_exact_match + * * @return mixed The value of the found cell */ public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true) @@ -689,17 +724,15 @@ class LookupRef // index_number must be less than or equal to the number of columns in lookup_array if ((!is_array($lookup_array)) || (empty($lookup_array))) { return Functions::REF(); - } else { - $f = array_keys($lookup_array); - $firstRow = array_pop($f); - if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { - return Functions::REF(); - } else { - $columnKeys = array_keys($lookup_array[$firstRow]); - $returnColumn = $columnKeys[--$index_number]; - $firstColumn = array_shift($columnKeys); - } } + $f = array_keys($lookup_array); + $firstRow = array_pop($f); + if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { + return Functions::REF(); + } + $columnKeys = array_keys($lookup_array[$firstRow]); + $returnColumn = $columnKeys[--$index_number]; + $firstColumn = array_shift($columnKeys); if (!$not_exact_match) { uasort($lookup_array, ['self', 'vlookupSort']); @@ -723,10 +756,9 @@ class LookupRef if ((!$not_exact_match) && ($rowValue != $lookup_value)) { // if an exact match is required, we have what we need to return an appropriate response return Functions::NA(); - } else { + } // otherwise return the appropriate value return $lookup_array[$rowNumber][$returnColumn]; - } } return Functions::NA(); @@ -735,10 +767,16 @@ class LookupRef /** * HLOOKUP * The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number. + * * @param lookup_value The value that you want to match in lookup_array * @param lookup_array The range of cells being searched * @param index_number The row number in table_array from which the matching value must be returned. The first row is 1. - * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. + * @param not_exact_match determines if you are looking for an exact match based on lookup_value + * @param mixed $lookup_value + * @param mixed $lookup_array + * @param mixed $index_number + * @param mixed $not_exact_match + * * @return mixed The value of the found cell */ public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true) @@ -755,18 +793,16 @@ class LookupRef // index_number must be less than or equal to the number of columns in lookup_array if ((!is_array($lookup_array)) || (empty($lookup_array))) { return Functions::REF(); - } else { - $f = array_keys($lookup_array); - $firstRow = array_pop($f); - if ((!is_array($lookup_array[$firstRow])) || ($index_number - 1 > count($lookup_array[$firstRow]))) { - return Functions::REF(); - } else { - $columnKeys = array_keys($lookup_array[$firstRow]); - $firstkey = $f[0] - 1; - $returnColumn = $firstkey + $index_number; - $firstColumn = array_shift($f); - } } + $f = array_keys($lookup_array); + $firstRow = array_pop($f); + if ((!is_array($lookup_array[$firstRow])) || ($index_number - 1 > count($lookup_array[$firstRow]))) { + return Functions::REF(); + } + $columnKeys = array_keys($lookup_array[$firstRow]); + $firstkey = $f[0] - 1; + $returnColumn = $firstkey + $index_number; + $firstColumn = array_shift($f); if (!$not_exact_match) { $firstRowH = asort($lookup_array[$firstColumn]); @@ -785,10 +821,9 @@ class LookupRef if ((!$not_exact_match) && ($rowValue != $lookup_value)) { // if an exact match is required, we have what we need to return an appropriate response return Functions::NA(); - } else { + } // otherwise return the appropriate value return $lookup_array[$returnColumn][$rowNumber]; - } } return Functions::NA(); @@ -797,9 +832,14 @@ class LookupRef /** * LOOKUP * The LOOKUP function searches for value either from a one-row or one-column range or from an array. + * * @param lookup_value The value that you want to match in lookup_array * @param lookup_vector The range of cells being searched * @param result_vector The column from which the matching value must be returned + * @param mixed $lookup_value + * @param mixed $lookup_vector + * @param null|mixed $result_vector + * * @return mixed The value of the found cell */ public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null) diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 9c6b60ec..34582f41 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -46,9 +47,9 @@ class MathTrig rsort($factorArray); return $factorArray; - } else { - return [(integer) $value]; } + + return [(int) $value]; } private static function romanCut($num, $n) @@ -57,7 +58,7 @@ class MathTrig } /** - * ATAN2 + * ATAN2. * * This function calculates the arc tangent of the two variables x and y. It is similar to * calculating the arc tangent of y Ă· x, except that the signs of both arguments are used @@ -73,9 +74,11 @@ class MathTrig * ATAN2(xCoordinate,yCoordinate) * * @category Mathematical and Trigonometric Functions - * @param float $xCoordinate The x-coordinate of the point. - * @param float $yCoordinate The y-coordinate of the point. - * @return float The inverse tangent of the specified x- and y-coordinates. + * + * @param float $xCoordinate the x-coordinate of the point + * @param float $yCoordinate the y-coordinate of the point + * + * @return float the inverse tangent of the specified x- and y-coordinates */ public static function ATAN2($xCoordinate = null, $yCoordinate = null) { @@ -101,7 +104,7 @@ class MathTrig } /** - * CEILING + * CEILING. * * Returns number rounded up, away from zero, to the nearest multiple of significance. * For example, if you want to avoid using pennies in your prices and your product is @@ -112,8 +115,10 @@ class MathTrig * CEILING(number[,significance]) * * @category Mathematical and Trigonometric Functions - * @param float $number The number you want to round. - * @param float $significance The multiple to which you want to round. + * + * @param float $number the number you want to round + * @param float $significance the multiple to which you want to round + * * @return float Rounded Number */ public static function CEILING($number, $significance = null) @@ -131,16 +136,16 @@ class MathTrig return 0.0; } elseif (self::SIGN($number) == self::SIGN($significance)) { return ceil($number / $significance) * $significance; - } else { - return Functions::NAN(); } + + return Functions::NAN(); } return Functions::VALUE(); } /** - * COMBIN + * COMBIN. * * Returns the number of combinations for a given number of items. Use COMBIN to * determine the total possible number of groups for a given number of items. @@ -149,8 +154,10 @@ class MathTrig * COMBIN(numObjs,numInSet) * * @category Mathematical and Trigonometric Functions + * * @param int $numObjs Number of different objects * @param int $numInSet Number of objects in each combination + * * @return int Number of combinations */ public static function COMBIN($numObjs, $numInSet) @@ -172,7 +179,7 @@ class MathTrig } /** - * EVEN + * EVEN. * * Returns number rounded up to the nearest even integer. * You can use this function for processing items that come in twos. For example, @@ -184,7 +191,9 @@ class MathTrig * EVEN(number) * * @category Mathematical and Trigonometric Functions + * * @param float $number Number to round + * * @return int Rounded Number */ public static function EVEN($number) @@ -207,7 +216,7 @@ class MathTrig } /** - * FACT + * FACT. * * Returns the factorial of a number. * The factorial of a number is equal to 1*2*3*...* number. @@ -216,7 +225,9 @@ class MathTrig * FACT(factVal) * * @category Mathematical and Trigonometric Functions + * * @param float $factVal Factorial Value + * * @return int Factorial */ public static function FACT($factVal) @@ -246,7 +257,7 @@ class MathTrig } /** - * FACTDOUBLE + * FACTDOUBLE. * * Returns the double factorial of a number. * @@ -254,7 +265,9 @@ class MathTrig * FACTDOUBLE(factVal) * * @category Mathematical and Trigonometric Functions + * * @param float $factVal Factorial Value + * * @return int Double Factorial */ public static function FACTDOUBLE($factVal) @@ -279,7 +292,7 @@ class MathTrig } /** - * FLOOR + * FLOOR. * * Rounds number down, toward zero, to the nearest multiple of significance. * @@ -287,8 +300,10 @@ class MathTrig * FLOOR(number[,significance]) * * @category Mathematical and Trigonometric Functions + * * @param float $number Number to round * @param float $significance Significance + * * @return float Rounded Number */ public static function FLOOR($number, $significance = null) @@ -308,16 +323,16 @@ class MathTrig return 0.0; } elseif (self::SIGN($number) == self::SIGN($significance)) { return floor($number / $significance) * $significance; - } else { - return Functions::NAN(); } + + return Functions::NAN(); } return Functions::VALUE(); } /** - * GCD + * GCD. * * Returns the greatest common divisor of a series of numbers. * The greatest common divisor is the largest integer that divides both @@ -327,7 +342,9 @@ class MathTrig * GCD(number1[,number2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return int Greatest Common Divisor */ public static function GCD() @@ -377,24 +394,23 @@ class MathTrig } return $returnValue; - } else { - $keys = array_keys($mergedArray); - $key = $keys[0]; - $value = $mergedArray[$key]; - foreach ($allValuesFactors as $testValue) { - foreach ($testValue as $mergedKey => $mergedValue) { - if (($mergedKey == $key) && ($mergedValue < $value)) { - $value = $mergedValue; - } + } + $keys = array_keys($mergedArray); + $key = $keys[0]; + $value = $mergedArray[$key]; + foreach ($allValuesFactors as $testValue) { + foreach ($testValue as $mergedKey => $mergedValue) { + if (($mergedKey == $key) && ($mergedValue < $value)) { + $value = $mergedValue; } } - - return pow($key, $value); } + + return pow($key, $value); } /** - * INT + * INT. * * Casts a floating point value to an integer * @@ -402,7 +418,9 @@ class MathTrig * INT(number) * * @category Mathematical and Trigonometric Functions + * * @param float $number Number to cast to an integer + * * @return int Integer value */ public static function INT($number) @@ -422,7 +440,7 @@ class MathTrig } /** - * LCM + * LCM. * * Returns the lowest common multiplier of a series of numbers * The least common multiple is the smallest positive integer that is a multiple @@ -433,7 +451,9 @@ class MathTrig * LCM(number1[,number2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return int Lowest Common Multiplier */ public static function LCM() @@ -467,14 +487,14 @@ class MathTrig } } foreach ($allPoweredFactors as $allPoweredFactor) { - $returnValue *= (integer) $allPoweredFactor; + $returnValue *= (int) $allPoweredFactor; } return $returnValue; } /** - * LOG_BASE + * LOG_BASE. * * Returns the logarithm of a number to a specified base. The default base is 10. * @@ -482,8 +502,10 @@ class MathTrig * LOG(number[,base]) * * @category Mathematical and Trigonometric Functions + * * @param float $number The positive real number for which you want the logarithm * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. + * * @return float */ public static function logBase($number = null, $base = 10) @@ -502,7 +524,7 @@ class MathTrig } /** - * MDETERM + * MDETERM. * * Returns the matrix determinant of an array. * @@ -510,7 +532,9 @@ class MathTrig * MDETERM(array) * * @category Mathematical and Trigonometric Functions + * * @param array $matrixValues A matrix of values + * * @return float */ public static function MDETERM($matrixValues) @@ -552,7 +576,7 @@ class MathTrig } /** - * MINVERSE + * MINVERSE. * * Returns the inverse matrix for the matrix stored in an array. * @@ -560,7 +584,9 @@ class MathTrig * MINVERSE(array) * * @category Mathematical and Trigonometric Functions + * * @param array $matrixValues A matrix of values + * * @return array */ public static function MINVERSE($matrixValues) @@ -604,10 +630,11 @@ class MathTrig } /** - * MMULT + * MMULT. * * @param array $matrixData1 A matrix of values * @param array $matrixData2 A matrix of values + * * @return array */ public static function MMULT($matrixData1, $matrixData2) @@ -665,10 +692,11 @@ class MathTrig } /** - * MOD + * MOD. * * @param int $a Dividend * @param int $b Divisor + * * @return int Remainder */ public static function MOD($a = 1, $b = 1) @@ -688,12 +716,13 @@ class MathTrig } /** - * MROUND + * MROUND. * * Rounds a number to the nearest multiple of a specified value * * @param float $number Number to round * @param int $multiple Multiple to which you want to round $number + * * @return float Rounded Number */ public static function MROUND($number, $multiple) @@ -718,11 +747,12 @@ class MathTrig } /** - * MULTINOMIAL + * MULTINOMIAL. * * Returns the ratio of the factorial of a sum of values to the product of factorials. * * @param array of mixed Data Series + * * @return float */ public static function MULTINOMIAL() @@ -754,11 +784,12 @@ class MathTrig } /** - * ODD + * ODD. * * Returns number rounded up to the nearest odd integer. * * @param float $number Number to round + * * @return int Rounded Number */ public static function ODD($number) @@ -787,12 +818,13 @@ class MathTrig } /** - * POWER + * POWER. * * Computes x raised to the power y. * * @param float $x * @param float $y + * * @return float */ public static function POWER($x = 0, $y = 2) @@ -814,7 +846,7 @@ class MathTrig } /** - * PRODUCT + * PRODUCT. * * PRODUCT returns the product of all the values and cells referenced in the argument list. * @@ -822,7 +854,9 @@ class MathTrig * PRODUCT(value1[,value2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function PRODUCT() @@ -851,7 +885,7 @@ class MathTrig } /** - * QUOTIENT + * QUOTIENT. * * QUOTIENT function returns the integer portion of a division. Numerator is the divided number * and denominator is the divisor. @@ -860,7 +894,9 @@ class MathTrig * QUOTIENT(value1[,value2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function QUOTIENT() @@ -885,14 +921,15 @@ class MathTrig } // Return - return intval($returnValue); + return (int) $returnValue; } /** - * RAND + * RAND. * * @param int $min Minimal value * @param int $max Maximal value + * * @return int Random number */ public static function RAND($min = 0, $max = 0) @@ -902,19 +939,19 @@ class MathTrig if ($min == 0 && $max == 0) { return (mt_rand(0, 10000000)) / 10000000; - } else { - return mt_rand($min, $max); } + + return mt_rand($min, $max); } public static function ROMAN($aValue, $style = 0) { $aValue = Functions::flattenSingleValue($aValue); - $style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style); + $style = (is_null($style)) ? 0 : (int) Functions::flattenSingleValue($style); if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) { return Functions::VALUE(); } - $aValue = (integer) $aValue; + $aValue = (int) $aValue; if ($aValue == 0) { return ''; } @@ -940,12 +977,13 @@ class MathTrig } /** - * ROUNDUP + * ROUNDUP. * * Rounds a number up to a specified number of decimal places * * @param float $number Number to round * @param int $digits Number of digits to which you want to round $number + * * @return float Rounded Number */ public static function ROUNDUP($number, $digits) @@ -957,21 +995,22 @@ class MathTrig $significance = pow(10, (int) $digits); if ($number < 0.0) { return floor($number * $significance) / $significance; - } else { - return ceil($number * $significance) / $significance; } + + return ceil($number * $significance) / $significance; } return Functions::VALUE(); } /** - * ROUNDDOWN + * ROUNDDOWN. * * Rounds a number down to a specified number of decimal places * * @param float $number Number to round * @param int $digits Number of digits to which you want to round $number + * * @return float Rounded Number */ public static function ROUNDDOWN($number, $digits) @@ -983,16 +1022,16 @@ class MathTrig $significance = pow(10, (int) $digits); if ($number < 0.0) { return ceil($number * $significance) / $significance; - } else { - return floor($number * $significance) / $significance; } + + return floor($number * $significance) / $significance; } return Functions::VALUE(); } /** - * SERIESSUM + * SERIESSUM. * * Returns the sum of a power series * @@ -1000,6 +1039,7 @@ class MathTrig * @param float $n Initial power to which you want to raise $x * @param float $m Step by which to increase $n for each term in the series * @param array of mixed Data Series + * * @return float */ public static function SERIESSUM() @@ -1032,12 +1072,13 @@ class MathTrig } /** - * SIGN + * SIGN. * * Determines the sign of a number. Returns 1 if the number is positive, zero (0) * if the number is 0, and -1 if the number is negative. * * @param float $number Number to round + * * @return int sign value */ public static function SIGN($number) @@ -1059,11 +1100,12 @@ class MathTrig } /** - * SQRTPI + * SQRTPI. * * Returns the square root of (number * pi). * * @param float $number Number + * * @return float Square Root of Number * Pi */ public static function SQRTPI($number) @@ -1082,13 +1124,14 @@ class MathTrig } /** - * SUBTOTAL + * SUBTOTAL. * * Returns a subtotal in a list or database. * * @param int the number 1 to 11 that specifies which function to - * use in calculating subtotals within a list. + * use in calculating subtotals within a list * @param array of mixed Data Series + * * @return float */ public static function SUBTOTAL() @@ -1129,7 +1172,7 @@ class MathTrig } /** - * SUM + * SUM. * * SUM computes the sum of all the values and cells referenced in the argument list. * @@ -1137,7 +1180,9 @@ class MathTrig * SUM(value1[,value2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function SUM() @@ -1156,7 +1201,7 @@ class MathTrig } /** - * SUMIF + * SUMIF. * * Counts the number of cells that contain numbers within the list of arguments * @@ -1164,8 +1209,12 @@ class MathTrig * SUMIF(value1[,value2[, ...]],condition) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be summed. + * @param string $condition the criteria that defines which cells will be summed + * @param mixed $aArgs + * @param mixed $sumArgs + * * @return float */ public static function SUMIF($aArgs, $condition, $sumArgs = []) @@ -1196,7 +1245,7 @@ class MathTrig } /** - * SUMIFS + * SUMIFS. * * Counts the number of cells that contain numbers within the list of arguments * @@ -1204,8 +1253,10 @@ class MathTrig * SUMIFS(value1[,value2[, ...]],condition) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be summed. + * @param string $condition the criteria that defines which cells will be summed + * * @return float */ public static function SUMIFS() @@ -1244,13 +1295,15 @@ class MathTrig } /** - * SUMPRODUCT + * SUMPRODUCT. * * Excel Function: * SUMPRODUCT(value1[,value2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function SUMPRODUCT() @@ -1285,7 +1338,7 @@ class MathTrig } /** - * SUMSQ + * SUMSQ. * * SUMSQ returns the sum of the squares of the arguments * @@ -1293,7 +1346,9 @@ class MathTrig * SUMSQ(value1[,value2[, ...]]) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function SUMSQ() @@ -1312,10 +1367,11 @@ class MathTrig } /** - * SUMX2MY2 + * SUMX2MY2. * * @param mixed[] $matrixData1 Matrix #1 * @param mixed[] $matrixData2 Matrix #2 + * * @return float */ public static function SUMX2MY2($matrixData1, $matrixData2) @@ -1336,10 +1392,11 @@ class MathTrig } /** - * SUMX2PY2 + * SUMX2PY2. * * @param mixed[] $matrixData1 Matrix #1 * @param mixed[] $matrixData2 Matrix #2 + * * @return float */ public static function SUMX2PY2($matrixData1, $matrixData2) @@ -1360,10 +1417,11 @@ class MathTrig } /** - * SUMXMY2 + * SUMXMY2. * * @param mixed[] $matrixData1 Matrix #1 * @param mixed[] $matrixData2 Matrix #2 + * * @return float */ public static function SUMXMY2($matrixData1, $matrixData2) @@ -1384,12 +1442,13 @@ class MathTrig } /** - * TRUNC + * TRUNC. * * Truncates value to the number of fractional digits by number_digits. * * @param float $value * @param int $digits + * * @return float Truncated value */ public static function TRUNC($value = 0, $digits = 0) @@ -1406,10 +1465,10 @@ class MathTrig // Truncate $adjust = pow(10, $digits); - if (($digits > 0) && (rtrim(intval((abs($value) - abs(intval($value))) * $adjust), '0') < $adjust / 10)) { + if (($digits > 0) && (rtrim((int) ((abs($value) - abs((int) $value)) * $adjust), '0') < $adjust / 10)) { return $value; } - return (intval($value * $adjust)) / $adjust; + return ((int) ($value * $adjust)) / $adjust; } } diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index 593d0478..e020630e 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -15,7 +15,7 @@ define('EPS', 2.22e-16); define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099); /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,6 +32,7 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099); * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -50,14 +51,12 @@ class Statistical $array2 = Functions::flattenArray($array2); foreach ($array1 as $key => $value) { if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { - unset($array1[$key]); - unset($array2[$key]); + unset($array1[$key], $array2[$key]); } } foreach ($array2 as $key => $value) { if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { - unset($array1[$key]); - unset($array2[$key]); + unset($array1[$key], $array2[$key]); } } $array1 = array_merge($array1); @@ -73,27 +72,35 @@ class Statistical * * @param p require p>0 * @param q require q>0 + * @param mixed $p + * @param mixed $q + * * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow */ private static function beta($p, $q) { if ($p <= 0.0 || $q <= 0.0 || ($p + $q) > LOG_GAMMA_X_MAX_VALUE) { return 0.0; - } else { - return exp(self::logBeta($p, $q)); } + + return exp(self::logBeta($p, $q)); } /** - * Incomplete beta function + * Incomplete beta function. * * @author Jaco van Kooten * @author Paul Meagher * * The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992). + * * @param x require 0<=x<=1 * @param p require p>0 * @param q require q>0 + * @param mixed $x + * @param mixed $p + * @param mixed $q + * * @return 0 if x<0, p<=0, q<=0 or p+q>2.55E305 and 1 if x>1 to avoid errors and over/underflow */ private static function incompleteBeta($x, $p, $q) @@ -108,9 +115,9 @@ class Statistical $beta_gam = exp((0 - self::logBeta($p, $q)) + $p * log($x) + $q * log(1.0 - $x)); if ($x < ($p + 1.0) / ($p + $q + 2.0)) { return $beta_gam * self::betaFraction($x, $p, $q) / $p; - } else { - return 1.0 - ($beta_gam * self::betaFraction(1 - $x, $q, $p) / $q); } + + return 1.0 - ($beta_gam * self::betaFraction(1 - $x, $q, $p) / $q); } // Function cache for logBeta function @@ -123,7 +130,11 @@ class Statistical * * @param p require p>0 * @param q require q>0 + * @param mixed $p + * @param mixed $q + * * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow + * * @author Jaco van Kooten */ private static function logBeta($p, $q) @@ -144,7 +155,12 @@ class Statistical /** * Evaluates of continued fraction part of incomplete beta function. * Based on an idea from Numerical Recipes (W.H. Press et al, 1992). + * * @author Jaco van Kooten + * + * @param mixed $x + * @param mixed $p + * @param mixed $q */ private static function betaFraction($x, $p, $q) { @@ -193,48 +209,50 @@ class Statistical return $frac; } -/** - * logGamma function - * - * @version 1.1 - * @author Jaco van Kooten - * - * Original author was Jaco van Kooten. Ported to PHP by Paul Meagher. - * - * The natural logarithm of the gamma function.
- * Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
- * Applied Mathematics Division
- * Argonne National Laboratory
- * Argonne, IL 60439
- *

- * References: - *

    - *
  1. W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural - * Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.
  2. - *
  3. K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.
  4. - *
  5. Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.
  6. - *
- *

- *

- * From the original documentation: - *

- *

- * This routine calculates the LOG(GAMMA) function for a positive real argument X. - * Computation is based on an algorithm outlined in references 1 and 2. - * The program uses rational functions that theoretically approximate LOG(GAMMA) - * to at least 18 significant decimal digits. The approximation for X > 12 is from - * reference 3, while approximations for X < 12.0 are similar to those in reference - * 1, but are unpublished. The accuracy achieved depends on the arithmetic system, - * the compiler, the intrinsic functions, and proper selection of the - * machine-dependent constants. - *

- *

- * Error returns:
- * The program returns the value XINF for X .LE. 0.0 or when overflow would occur. - * The computation is believed to be free of underflow and overflow. - *

- * @return MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305 - */ + /** + * logGamma function. + * + * @version 1.1 + * + * @author Jaco van Kooten + * + * Original author was Jaco van Kooten. Ported to PHP by Paul Meagher. + * + * The natural logarithm of the gamma function.
+ * Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
+ * Applied Mathematics Division
+ * Argonne National Laboratory
+ * Argonne, IL 60439
+ *

+ * References: + *

    + *
  1. W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural + * Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.
  2. + *
  3. K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.
  4. + *
  5. Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.
  6. + *
+ *

+ *

+ * From the original documentation: + *

+ *

+ * This routine calculates the LOG(GAMMA) function for a positive real argument X. + * Computation is based on an algorithm outlined in references 1 and 2. + * The program uses rational functions that theoretically approximate LOG(GAMMA) + * to at least 18 significant decimal digits. The approximation for X > 12 is from + * reference 3, while approximations for X < 12.0 are similar to those in reference + * 1, but are unpublished. The accuracy achieved depends on the arithmetic system, + * the compiler, the intrinsic functions, and proper selection of the + * machine-dependent constants. + *

+ *

+ * Error returns:
+ * The program returns the value XINF for X .LE. 0.0 or when overflow would occur. + * The computation is believed to be free of underflow and overflow. + *

+ * + * @return MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305 + */ // Function cache for logGamma private static $logGammaCacheResult = 0.0; @@ -588,7 +606,9 @@ class Statistical } return $z; - } // function inverseNcdf2() + } + + // function inverseNcdf2() private static function inverseNcdf3($p) { @@ -692,7 +712,7 @@ class Statistical } /** - * AVEDEV + * AVEDEV. * * Returns the average of the absolute deviations of data points from their mean. * AVEDEV is a measure of the variability in a data set. @@ -701,7 +721,9 @@ class Statistical * AVEDEV(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function AVEDEV() @@ -717,7 +739,7 @@ class Statistical foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -742,7 +764,7 @@ class Statistical } /** - * AVERAGE + * AVERAGE. * * Returns the average (arithmetic mean) of the arguments * @@ -750,7 +772,9 @@ class Statistical * AVERAGE(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function AVERAGE() @@ -761,7 +785,7 @@ class Statistical foreach (Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { if ((is_bool($arg)) && ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -777,13 +801,13 @@ class Statistical // Return if ($aCount > 0) { return $returnValue / $aCount; - } else { - return Functions::DIV0(); } + + return Functions::DIV0(); } /** - * AVERAGEA + * AVERAGEA. * * Returns the average of its arguments, including numbers, text, and logical values * @@ -791,7 +815,9 @@ class Statistical * AVERAGEA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function AVERAGEA() @@ -806,7 +832,7 @@ class Statistical } else { if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -822,13 +848,13 @@ class Statistical if ($aCount > 0) { return $returnValue / $aCount; - } else { - return Functions::DIV0(); } + + return Functions::DIV0(); } /** - * AVERAGEIF + * AVERAGEIF. * * Returns the average value from a range of cells that contain numbers within the list of arguments * @@ -836,9 +862,12 @@ class Statistical * AVERAGEIF(value1[,value2[, ...]],condition) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be checked. + * @param string $condition the criteria that defines which cells will be checked * @param mixed[] $averageArgs Data values + * @param mixed $aArgs + * * @return float */ public static function AVERAGEIF($aArgs, $condition, $averageArgs = []) @@ -874,13 +903,16 @@ class Statistical } /** - * BETADIST + * BETADIST. * * Returns the beta distribution. * * @param float $value Value at which you want to evaluate the distribution * @param float $alpha Parameter to the distribution * @param float $beta Parameter to the distribution + * @param mixed $rMin + * @param mixed $rMax + * * @return float */ public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) @@ -910,7 +942,7 @@ class Statistical } /** - * BETAINV + * BETAINV. * * Returns the inverse of the beta distribution. * @@ -919,6 +951,7 @@ class Statistical * @param float $beta Parameter to the distribution * @param float $rMin Minimum value * @param float $rMax Maximum value + * * @return float */ public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1) @@ -964,7 +997,7 @@ class Statistical } /** - * BINOMDIST + * BINOMDIST. * * Returns the individual term binomial distribution probability. Use BINOMDIST in problems with * a fixed number of tests or trials, when the outcomes of any trial are only success or failure, @@ -976,6 +1009,7 @@ class Statistical * @param float $trials Number of trials * @param float $probability Probability of success on each trial * @param bool $cumulative + * * @return float * * @todo Cumulative distribution function @@ -1001,9 +1035,9 @@ class Statistical } return $summer; - } else { - return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value); } + + return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value); } } @@ -1011,12 +1045,13 @@ class Statistical } /** - * CHIDIST + * CHIDIST. * * Returns the one-tailed probability of the chi-squared distribution. * * @param float $value Value for the function * @param float $degrees degrees of freedom + * * @return float */ public static function CHIDIST($value, $degrees) @@ -1043,12 +1078,13 @@ class Statistical } /** - * CHIINV + * CHIINV. * * Returns the one-tailed probability of the chi-squared distribution. * * @param float $probability Probability for the function * @param float $degrees degrees of freedom + * * @return float */ public static function CHIINV($probability, $degrees) @@ -1100,13 +1136,14 @@ class Statistical } /** - * CONFIDENCE + * CONFIDENCE. * * Returns the confidence interval for a population mean * * @param float $alpha * @param float $stdDev Standard Deviation * @param float $size + * * @return float */ public static function CONFIDENCE($alpha, $stdDev, $size) @@ -1130,12 +1167,15 @@ class Statistical } /** - * CORREL + * CORREL. * * Returns covariance, the average of the products of deviations for each data point pair. * * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $yValues + * @param null|mixed $xValues + * * @return float */ public static function CORREL($yValues, $xValues = null) @@ -1161,7 +1201,7 @@ class Statistical } /** - * COUNT + * COUNT. * * Counts the number of cells that contain numbers within the list of arguments * @@ -1169,7 +1209,9 @@ class Statistical * COUNT(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return int */ public static function COUNT() @@ -1181,7 +1223,7 @@ class Statistical foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -1193,7 +1235,7 @@ class Statistical } /** - * COUNTA + * COUNTA. * * Counts the number of cells that are not empty within the list of arguments * @@ -1201,7 +1243,9 @@ class Statistical * COUNTA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return int */ public static function COUNTA() @@ -1221,7 +1265,7 @@ class Statistical } /** - * COUNTBLANK + * COUNTBLANK. * * Counts the number of empty cells within the list of arguments * @@ -1229,7 +1273,9 @@ class Statistical * COUNTBLANK(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return int */ public static function COUNTBLANK() @@ -1249,7 +1295,7 @@ class Statistical } /** - * COUNTIF + * COUNTIF. * * Counts the number of cells that contain numbers within the list of arguments * @@ -1257,8 +1303,11 @@ class Statistical * COUNTIF(value1[,value2[, ...]],condition) * * @category Statistical Functions + * * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be counted. + * @param string $condition the criteria that defines which cells will be counted + * @param mixed $aArgs + * * @return int */ public static function COUNTIF($aArgs, $condition) @@ -1283,12 +1332,15 @@ class Statistical } /** - * COVAR + * COVAR. * * Returns covariance, the average of the products of deviations for each data point pair. * * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $yValues + * @param mixed $xValues + * * @return float */ public static function COVAR($yValues, $xValues) @@ -1311,7 +1363,7 @@ class Statistical } /** - * CRITBINOM + * CRITBINOM. * * Returns the smallest value for which the cumulative binomial distribution is greater * than or equal to a criterion value @@ -1321,6 +1373,7 @@ class Statistical * @param float $trials number of Bernoulli trials * @param float $probability probability of a success on each trial * @param float $alpha criterion value + * * @return int * * @todo Warning. This implementation differs from the algorithm detailed on the MS @@ -1433,7 +1486,7 @@ class Statistical } /** - * DEVSQ + * DEVSQ. * * Returns the sum of squares of deviations of data points from their sample mean. * @@ -1441,7 +1494,9 @@ class Statistical * DEVSQ(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function DEVSQ() @@ -1459,7 +1514,7 @@ class Statistical if ((is_bool($arg)) && ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { - $arg = (integer) $arg; + $arg = (int) $arg; } if ((is_numeric($arg)) && (!is_string($arg))) { if (is_null($returnValue)) { @@ -1474,16 +1529,16 @@ class Statistical // Return if (is_null($returnValue)) { return Functions::NAN(); - } else { - return $returnValue; } + + return $returnValue; } return self::NA(); } /** - * EXPONDIST + * EXPONDIST. * * Returns the exponential distribution. Use EXPONDIST to model the time between events, * such as how long an automated bank teller takes to deliver cash. For example, you can @@ -1492,6 +1547,7 @@ class Statistical * @param float $value Value of the function * @param float $lambda The parameter value * @param bool $cumulative + * * @return float */ public static function EXPONDIST($value, $lambda, $cumulative) @@ -1507,9 +1563,9 @@ class Statistical if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { return 1 - exp(0 - $value * $lambda); - } else { - return $lambda * exp(0 - $value * $lambda); } + + return $lambda * exp(0 - $value * $lambda); } } @@ -1517,13 +1573,14 @@ class Statistical } /** - * FISHER + * FISHER. * * Returns the Fisher transformation at x. This transformation produces a function that * is normally distributed rather than skewed. Use this function to perform hypothesis * testing on the correlation coefficient. * * @param float $value + * * @return float */ public static function FISHER($value) @@ -1542,13 +1599,14 @@ class Statistical } /** - * FISHERINV + * FISHERINV. * * Returns the inverse of the Fisher transformation. Use this transformation when * analyzing correlations between ranges or arrays of data. If y = FISHER(x), then * FISHERINV(y) = x. * * @param float $value + * * @return float */ public static function FISHERINV($value) @@ -1563,13 +1621,17 @@ class Statistical } /** - * FORECAST + * FORECAST. * * Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. * * @param float Value of X for which we want to find Y * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $xValue + * @param mixed $yValues + * @param mixed $xValues + * * @return float */ public static function FORECAST($xValue, $yValues, $xValues) @@ -1595,7 +1657,7 @@ class Statistical } /** - * GAMMADIST + * GAMMADIST. * * Returns the gamma distribution. * @@ -1603,6 +1665,7 @@ class Statistical * @param float $a Parameter to the distribution * @param float $b Parameter to the distribution * @param bool $cumulative + * * @return float */ public static function GAMMADIST($value, $a, $b, $cumulative) @@ -1618,9 +1681,9 @@ class Statistical if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { return self::incompleteGamma($a, $value / $b) / self::gamma($a); - } else { - return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b)); } + + return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b)); } } @@ -1628,13 +1691,14 @@ class Statistical } /** - * GAMMAINV + * GAMMAINV. * * Returns the inverse of the beta distribution. * * @param float $probability Probability at which you want to evaluate the distribution * @param float $alpha Parameter to the distribution * @param float $beta Parameter to the distribution + * * @return float */ public static function GAMMAINV($probability, $alpha, $beta) @@ -1690,11 +1754,12 @@ class Statistical } /** - * GAMMALN + * GAMMALN. * * Returns the natural logarithm of the gamma function. * * @param float $value + * * @return float */ public static function GAMMALN($value) @@ -1713,7 +1778,7 @@ class Statistical } /** - * GEOMEAN + * GEOMEAN. * * Returns the geometric mean of an array or range of positive data. For example, you * can use GEOMEAN to calculate average growth rate given compound interest with @@ -1723,7 +1788,9 @@ class Statistical * GEOMEAN(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function GEOMEAN() @@ -1742,14 +1809,19 @@ class Statistical } /** - * GROWTH + * GROWTH. * * Returns values along a predicted emponential Trend * * @param array of mixed Data Series Y * @param array of mixed Data Series X * @param array of mixed Values of X for which we want to find Y - * @param bool A logical value specifying whether to force the intersect to equal 0. + * @param bool a logical value specifying whether to force the intersect to equal 0 + * @param mixed $yValues + * @param mixed $xValues + * @param mixed $newValues + * @param mixed $const + * * @return array of float */ public static function GROWTH($yValues, $xValues = [], $newValues = [], $const = true) @@ -1757,7 +1829,7 @@ class Statistical $yValues = Functions::flattenArray($yValues); $xValues = Functions::flattenArray($xValues); $newValues = Functions::flattenArray($newValues); - $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const); + $const = (is_null($const)) ? true : (bool) Functions::flattenSingleValue($const); $bestFitExponential = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_EXPONENTIAL, $yValues, $xValues, $const); if (empty($newValues)) { @@ -1773,7 +1845,7 @@ class Statistical } /** - * HARMEAN + * HARMEAN. * * Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the * arithmetic mean of reciprocals. @@ -1782,7 +1854,9 @@ class Statistical * HARMEAN(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function HARMEAN() @@ -1814,13 +1888,13 @@ class Statistical // Return if ($aCount > 0) { return 1 / ($returnValue / $aCount); - } else { - return $returnValue; } + + return $returnValue; } /** - * HYPGEOMDIST + * HYPGEOMDIST. * * Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of * sample successes, given the sample size, population successes, and population size. @@ -1829,6 +1903,7 @@ class Statistical * @param float $sampleNumber Size of the sample * @param float $populationSuccesses Number of successes in the population * @param float $populationNumber Population size + * * @return float */ public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) @@ -1858,12 +1933,15 @@ class Statistical } /** - * INTERCEPT + * INTERCEPT. * * Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. * * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $yValues + * @param mixed $xValues + * * @return float */ public static function INTERCEPT($yValues, $xValues) @@ -1886,7 +1964,7 @@ class Statistical } /** - * KURT + * KURT. * * Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness * or flatness of a distribution compared with the normal distribution. Positive @@ -1894,6 +1972,7 @@ class Statistical * relatively flat distribution. * * @param array Data Series + * * @return float */ public static function KURT() @@ -1927,7 +2006,7 @@ class Statistical } /** - * LARGE + * LARGE. * * Returns the nth largest value in a data set. You can use this function to * select a value based on its relative standing. @@ -1936,8 +2015,10 @@ class Statistical * LARGE(value1[,value2[, ...]],entry) * * @category Statistical Functions + * * @param mixed $arg,... Data values * @param int $entry Position (ordered from the largest) in the array or range of data to return + * * @return float */ public static function LARGE() @@ -1969,21 +2050,26 @@ class Statistical } /** - * LINEST + * LINEST. * * Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, * and then returns an array that describes the line. * * @param array of mixed Data Series Y * @param array of mixed Data Series X - * @param bool A logical value specifying whether to force the intersect to equal 0. - * @param bool A logical value specifying whether to return additional regression statistics. + * @param bool a logical value specifying whether to force the intersect to equal 0 + * @param bool a logical value specifying whether to return additional regression statistics + * @param mixed $yValues + * @param null|mixed $xValues + * @param mixed $const + * @param mixed $stats + * * @return array */ public static function LINEST($yValues, $xValues = null, $const = true, $stats = false) { - $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const); - $stats = (is_null($stats)) ? false : (boolean) Functions::flattenSingleValue($stats); + $const = (is_null($const)) ? true : (bool) Functions::flattenSingleValue($const); + $stats = (is_null($stats)) ? false : (bool) Functions::flattenSingleValue($stats); if (is_null($xValues)) { $xValues = range(1, count(Functions::flattenArray($yValues))); } @@ -2018,30 +2104,35 @@ class Statistical $bestFitLinear->getSSResiduals(), ], ]; - } else { - return [ + } + + return [ $bestFitLinear->getSlope(), $bestFitLinear->getIntersect(), ]; - } } /** - * LOGEST + * LOGEST. * * Calculates an exponential curve that best fits the X and Y data series, * and then returns an array that describes the line. * * @param array of mixed Data Series Y * @param array of mixed Data Series X - * @param bool A logical value specifying whether to force the intersect to equal 0. - * @param bool A logical value specifying whether to return additional regression statistics. + * @param bool a logical value specifying whether to force the intersect to equal 0 + * @param bool a logical value specifying whether to return additional regression statistics + * @param mixed $yValues + * @param null|mixed $xValues + * @param mixed $const + * @param mixed $stats + * * @return array */ public static function LOGEST($yValues, $xValues = null, $const = true, $stats = false) { - $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const); - $stats = (is_null($stats)) ? false : (boolean) Functions::flattenSingleValue($stats); + $const = (is_null($const)) ? true : (bool) Functions::flattenSingleValue($const); + $stats = (is_null($stats)) ? false : (bool) Functions::flattenSingleValue($stats); if (is_null($xValues)) { $xValues = range(1, count(Functions::flattenArray($yValues))); } @@ -2082,22 +2173,23 @@ class Statistical $bestFitExponential->getSSResiduals(), ], ]; - } else { - return [ + } + + return [ $bestFitExponential->getSlope(), $bestFitExponential->getIntersect(), ]; - } } /** - * LOGINV + * LOGINV. * * Returns the inverse of the normal cumulative distribution * * @param float $probability * @param float $mean * @param float $stdDev + * * @return float * * @todo Try implementing P J Acklam's refinement algorithm for greater @@ -2122,7 +2214,7 @@ class Statistical } /** - * LOGNORMDIST + * LOGNORMDIST. * * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed * with parameters mean and standard_dev. @@ -2130,6 +2222,7 @@ class Statistical * @param float $value * @param float $mean * @param float $stdDev + * * @return float */ public static function LOGNORMDIST($value, $mean, $stdDev) @@ -2150,7 +2243,7 @@ class Statistical } /** - * MAX + * MAX. * * MAX returns the value of the element of the values passed that has the highest value, * with negative numbers considered smaller than positive numbers. @@ -2159,7 +2252,9 @@ class Statistical * MAX(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function MAX() @@ -2185,7 +2280,7 @@ class Statistical } /** - * MAXA + * MAXA. * * Returns the greatest value in a list of arguments, including numbers, text, and logical values * @@ -2193,7 +2288,9 @@ class Statistical * MAXA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function MAXA() @@ -2206,7 +2303,7 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -2224,7 +2321,7 @@ class Statistical } /** - * MAXIF + * MAXIF. * * Counts the maximum value within a range of cells that contain numbers within the list of arguments * @@ -2232,8 +2329,12 @@ class Statistical * MAXIF(value1[,value2[, ...]],condition) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be checked. + * @param string $condition the criteria that defines which cells will be checked + * @param mixed $aArgs + * @param mixed $sumArgs + * * @return float */ public static function MAXIF($aArgs, $condition, $sumArgs = []) @@ -2263,7 +2364,7 @@ class Statistical } /** - * MEDIAN + * MEDIAN. * * Returns the median of the given numbers. The median is the number in the middle of a set of numbers. * @@ -2271,7 +2372,9 @@ class Statistical * MEDIAN(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function MEDIAN() @@ -2304,7 +2407,7 @@ class Statistical } /** - * MIN + * MIN. * * MIN returns the value of the element of the values passed that has the smallest value, * with negative numbers considered smaller than positive numbers. @@ -2313,7 +2416,9 @@ class Statistical * MIN(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function MIN() @@ -2339,7 +2444,7 @@ class Statistical } /** - * MINA + * MINA. * * Returns the smallest value in a list of arguments, including numbers, text, and logical values * @@ -2347,7 +2452,9 @@ class Statistical * MINA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function MINA() @@ -2360,7 +2467,7 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -2378,7 +2485,7 @@ class Statistical } /** - * MINIF + * MINIF. * * Returns the minimum value within a range of cells that contain numbers within the list of arguments * @@ -2386,8 +2493,12 @@ class Statistical * MINIF(value1[,value2[, ...]],condition) * * @category Mathematical and Trigonometric Functions + * * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be checked. + * @param string $condition the criteria that defines which cells will be checked + * @param mixed $aArgs + * @param mixed $sumArgs + * * @return float */ public static function MINIF($aArgs, $condition, $sumArgs = []) @@ -2454,7 +2565,7 @@ class Statistical } /** - * MODE + * MODE. * * Returns the most frequently occurring, or repetitive, value in an array or range of data * @@ -2462,7 +2573,9 @@ class Statistical * MODE(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function MODE() @@ -2488,7 +2601,7 @@ class Statistical } /** - * NEGBINOMDIST + * NEGBINOMDIST. * * Returns the negative binomial distribution. NEGBINOMDIST returns the probability that * there will be number_f failures before the number_s-th success, when the constant @@ -2499,6 +2612,7 @@ class Statistical * @param float $failures Number of Failures * @param float $successes Threshold number of Successes * @param float $probability Probability of success on each trial + * * @return float */ public static function NEGBINOMDIST($failures, $successes, $probability) @@ -2526,7 +2640,7 @@ class Statistical } /** - * NORMDIST + * NORMDIST. * * Returns the normal distribution for the specified mean and standard deviation. This * function has a very wide range of applications in statistics, including hypothesis @@ -2536,6 +2650,7 @@ class Statistical * @param float $mean Mean Value * @param float $stdDev Standard Deviation * @param bool $cumulative + * * @return float */ public static function NORMDIST($value, $mean, $stdDev, $cumulative) @@ -2551,9 +2666,9 @@ class Statistical if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { return 0.5 * (1 + Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2)))); - } else { - return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); } + + return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); } } @@ -2561,13 +2676,14 @@ class Statistical } /** - * NORMINV + * NORMINV. * * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. * * @param float $probability * @param float $mean Mean Value * @param float $stdDev Standard Deviation + * * @return float */ public static function NORMINV($probability, $mean, $stdDev) @@ -2591,13 +2707,14 @@ class Statistical } /** - * NORMSDIST + * NORMSDIST. * * Returns the standard normal cumulative distribution function. The distribution has * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a * table of standard normal curve areas. * * @param float $value + * * @return float */ public static function NORMSDIST($value) @@ -2608,11 +2725,12 @@ class Statistical } /** - * NORMSINV + * NORMSINV. * * Returns the inverse of the standard normal cumulative distribution * * @param float $value + * * @return float */ public static function NORMSINV($value) @@ -2621,7 +2739,7 @@ class Statistical } /** - * PERCENTILE + * PERCENTILE. * * Returns the nth percentile of values in a range.. * @@ -2629,8 +2747,10 @@ class Statistical * PERCENTILE(value1[,value2[, ...]],entry) * * @category Statistical Functions + * * @param mixed $arg,... Data values * @param float $entry Percentile value in the range 0..1, inclusive. + * * @return float */ public static function PERCENTILE() @@ -2659,12 +2779,11 @@ class Statistical $iBase = floor($index); if ($index == $iBase) { return $mArgs[$index]; - } else { - $iNext = $iBase + 1; - $iProportion = $index - $iBase; - - return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion); } + $iNext = $iBase + 1; + $iProportion = $index - $iBase; + + return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion); } } @@ -2672,20 +2791,24 @@ class Statistical } /** - * PERCENTRANK + * PERCENTRANK. * * Returns the rank of a value in a data set as a percentage of the data set. * - * @param array of number An array of, or a reference to, a list of numbers. - * @param number The number whose rank you want to find. - * @param number The number of significant digits for the returned percentage value. + * @param array of number An array of, or a reference to, a list of numbers + * @param number the number whose rank you want to find + * @param number the number of significant digits for the returned percentage value + * @param mixed $valueSet + * @param mixed $value + * @param mixed $significance + * * @return float */ public static function PERCENTRANK($valueSet, $value, $significance = 3) { $valueSet = Functions::flattenArray($valueSet); $value = Functions::flattenSingleValue($value); - $significance = (is_null($significance)) ? 3 : (integer) Functions::flattenSingleValue($significance); + $significance = (is_null($significance)) ? 3 : (int) Functions::flattenSingleValue($significance); foreach ($valueSet as $key => $valueEntry) { if (!is_numeric($valueEntry)) { @@ -2718,7 +2841,7 @@ class Statistical } /** - * PERMUT + * PERMUT. * * Returns the number of permutations for a given number of objects that can be * selected from number objects. A permutation is any set or subset of objects or @@ -2728,6 +2851,7 @@ class Statistical * * @param int $numObjs Number of different objects * @param int $numInSet Number of objects in each permutation + * * @return int Number of permutations */ public static function PERMUT($numObjs, $numInSet) @@ -2748,7 +2872,7 @@ class Statistical } /** - * POISSON + * POISSON. * * Returns the Poisson distribution. A common application of the Poisson distribution * is predicting the number of events over a specific time, such as the number of @@ -2757,6 +2881,7 @@ class Statistical * @param float $value * @param float $mean Mean Value * @param bool $cumulative + * * @return float */ public static function POISSON($value, $mean, $cumulative) @@ -2776,9 +2901,9 @@ class Statistical } return exp(0 - $mean) * $summer; - } else { - return (exp(0 - $mean) * pow($mean, $value)) / MathTrig::FACT($value); } + + return (exp(0 - $mean) * pow($mean, $value)) / MathTrig::FACT($value); } } @@ -2786,7 +2911,7 @@ class Statistical } /** - * QUARTILE + * QUARTILE. * * Returns the quartile of a data set. * @@ -2794,8 +2919,10 @@ class Statistical * QUARTILE(value1[,value2[, ...]],entry) * * @category Statistical Functions + * * @param mixed $arg,... Data values * @param int $entry Quartile value in the range 1..3, inclusive. + * * @return float */ public static function QUARTILE() @@ -2818,20 +2945,24 @@ class Statistical } /** - * RANK + * RANK. * * Returns the rank of a number in a list of numbers. * - * @param number The number whose rank you want to find. - * @param array of number An array of, or a reference to, a list of numbers. + * @param number the number whose rank you want to find + * @param array of number An array of, or a reference to, a list of numbers * @param mixed Order to sort the values in the value set + * @param mixed $value + * @param mixed $valueSet + * @param mixed $order + * * @return float */ public static function RANK($value, $valueSet, $order = 0) { $value = Functions::flattenSingleValue($value); $valueSet = Functions::flattenArray($valueSet); - $order = (is_null($order)) ? 0 : (integer) Functions::flattenSingleValue($order); + $order = (is_null($order)) ? 0 : (int) Functions::flattenSingleValue($order); foreach ($valueSet as $key => $valueEntry) { if (!is_numeric($valueEntry)) { @@ -2853,12 +2984,15 @@ class Statistical } /** - * RSQ + * RSQ. * * Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. * * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $yValues + * @param mixed $xValues + * * @return float */ public static function RSQ($yValues, $xValues) @@ -2881,7 +3015,7 @@ class Statistical } /** - * SKEW + * SKEW. * * Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry * of a distribution around its mean. Positive skewness indicates a distribution with an @@ -2889,6 +3023,7 @@ class Statistical * distribution with an asymmetric tail extending toward more negative values. * * @param array Data Series + * * @return float */ public static function SKEW() @@ -2919,12 +3054,15 @@ class Statistical } /** - * SLOPE + * SLOPE. * * Returns the slope of the linear regression line through data points in known_y's and known_x's. * * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $yValues + * @param mixed $xValues + * * @return float */ public static function SLOPE($yValues, $xValues) @@ -2947,7 +3085,7 @@ class Statistical } /** - * SMALL + * SMALL. * * Returns the nth smallest value in a data set. You can use this function to * select a value based on its relative standing. @@ -2956,8 +3094,10 @@ class Statistical * SMALL(value1[,value2[, ...]],entry) * * @category Statistical Functions + * * @param mixed $arg,... Data values * @param int $entry Position (ordered from the smallest) in the array or range of data to return + * * @return float */ public static function SMALL() @@ -2989,13 +3129,14 @@ class Statistical } /** - * STANDARDIZE + * STANDARDIZE. * * Returns a normalized value from a distribution characterized by mean and standard_dev. * * @param float $value Value to normalize * @param float $mean Mean Value * @param float $stdDev Standard Deviation + * * @return float Standardized value */ public static function STANDARDIZE($value, $mean, $stdDev) @@ -3016,7 +3157,7 @@ class Statistical } /** - * STDEV + * STDEV. * * Estimates standard deviation based on a sample. The standard deviation is a measure of how * widely values are dispersed from the average value (the mean). @@ -3025,7 +3166,9 @@ class Statistical * STDEV(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function STDEV() @@ -3041,7 +3184,7 @@ class Statistical foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -3064,7 +3207,7 @@ class Statistical } /** - * STDEVA + * STDEVA. * * Estimates standard deviation based on a sample, including numbers, text, and logical values * @@ -3072,7 +3215,9 @@ class Statistical * STDEVA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function STDEVA() @@ -3091,7 +3236,7 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -3114,7 +3259,7 @@ class Statistical } /** - * STDEVP + * STDEVP. * * Calculates standard deviation based on the entire population * @@ -3122,7 +3267,9 @@ class Statistical * STDEVP(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function STDEVP() @@ -3137,7 +3284,7 @@ class Statistical foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -3159,7 +3306,7 @@ class Statistical } /** - * STDEVPA + * STDEVPA. * * Calculates standard deviation based on the entire population, including numbers, text, and logical values * @@ -3167,7 +3314,9 @@ class Statistical * STDEVPA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function STDEVPA() @@ -3186,7 +3335,7 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -3209,12 +3358,15 @@ class Statistical } /** - * STEYX + * STEYX. * * Returns the standard error of the predicted y-value for each x in the regression. * * @param array of mixed Data Series Y * @param array of mixed Data Series X + * @param mixed $yValues + * @param mixed $xValues + * * @return float */ public static function STEYX($yValues, $xValues) @@ -3237,13 +3389,14 @@ class Statistical } /** - * TDIST + * TDIST. * * Returns the probability of Student's T distribution. * * @param float $value Value for the function * @param float $degrees degrees of freedom * @param float $tails number of tails (1 or 2) + * * @return float */ public static function TDIST($value, $degrees, $tails) @@ -3292,21 +3445,22 @@ class Statistical $tValue = 0.5 * (1 + $tsum); if ($tails == 1) { return 1 - abs($tValue); - } else { - return 1 - abs((1 - $tValue) - $tValue); } + + return 1 - abs((1 - $tValue) - $tValue); } return Functions::VALUE(); } /** - * TINV + * TINV. * * Returns the one-tailed probability of the chi-squared distribution. * * @param float $probability Probability for the function * @param float $degrees degrees of freedom + * * @return float */ public static function TINV($probability, $degrees) @@ -3358,14 +3512,19 @@ class Statistical } /** - * TREND + * TREND. * * Returns values along a linear Trend * * @param array of mixed Data Series Y * @param array of mixed Data Series X * @param array of mixed Values of X for which we want to find Y - * @param bool A logical value specifying whether to force the intersect to equal 0. + * @param bool a logical value specifying whether to force the intersect to equal 0 + * @param mixed $yValues + * @param mixed $xValues + * @param mixed $newValues + * @param mixed $const + * * @return array of float */ public static function TREND($yValues, $xValues = [], $newValues = [], $const = true) @@ -3373,7 +3532,7 @@ class Statistical $yValues = Functions::flattenArray($yValues); $xValues = Functions::flattenArray($xValues); $newValues = Functions::flattenArray($newValues); - $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const); + $const = (is_null($const)) ? true : (bool) Functions::flattenSingleValue($const); $bestFitLinear = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues, $const); if (empty($newValues)) { @@ -3389,7 +3548,7 @@ class Statistical } /** - * TRIMMEAN + * TRIMMEAN. * * Returns the mean of the interior of a data set. TRIMMEAN calculates the mean * taken by excluding a percentage of data points from the top and bottom tails @@ -3399,8 +3558,10 @@ class Statistical * TRIMEAN(value1[,value2[, ...]], $discard) * * @category Statistical Functions + * * @param mixed $arg,... Data values * @param float $discard Percentage to discard + * * @return float */ public static function TRIMMEAN() @@ -3435,7 +3596,7 @@ class Statistical } /** - * VARFunc + * VARFunc. * * Estimates variance based on a sample. * @@ -3443,7 +3604,9 @@ class Statistical * VAR(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function VARFunc() @@ -3457,7 +3620,7 @@ class Statistical $aCount = 0; foreach ($aArgs as $arg) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -3477,7 +3640,7 @@ class Statistical } /** - * VARA + * VARA. * * Estimates variance based on a sample, including numbers, text, and logical values * @@ -3485,7 +3648,9 @@ class Statistical * VARA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function VARA() @@ -3507,7 +3672,7 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -3528,7 +3693,7 @@ class Statistical } /** - * VARP + * VARP. * * Calculates variance based on the entire population * @@ -3536,7 +3701,9 @@ class Statistical * VARP(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function VARP() @@ -3551,7 +3718,7 @@ class Statistical $aCount = 0; foreach ($aArgs as $arg) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -3571,7 +3738,7 @@ class Statistical } /** - * VARPA + * VARPA. * * Calculates variance based on the entire population, including numbers, text, and logical values * @@ -3579,7 +3746,9 @@ class Statistical * VARPA(value1[,value2[, ...]]) * * @category Statistical Functions + * * @param mixed $arg,... Data values + * * @return float */ public static function VARPA() @@ -3601,7 +3770,7 @@ class Statistical // Is it a numeric value? if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { if (is_bool($arg)) { - $arg = (integer) $arg; + $arg = (int) $arg; } elseif (is_string($arg)) { $arg = 0; } @@ -3622,7 +3791,7 @@ class Statistical } /** - * WEIBULL + * WEIBULL. * * Returns the Weibull distribution. Use this distribution in reliability * analysis, such as calculating a device's mean time to failure. @@ -3631,6 +3800,7 @@ class Statistical * @param float $alpha Alpha Parameter * @param float $beta Beta Parameter * @param bool $cumulative + * * @return float */ public static function WEIBULL($value, $alpha, $beta, $cumulative) @@ -3646,9 +3816,9 @@ class Statistical if ((is_numeric($cumulative)) || (is_bool($cumulative))) { if ($cumulative) { return 1 - exp(0 - pow($value / $beta, $alpha)); - } else { - return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha)); } + + return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha)); } } @@ -3656,7 +3826,7 @@ class Statistical } /** - * ZTEST + * ZTEST. * * Returns the Weibull distribution. Use this distribution in reliability * analysis, such as calculating a device's mean time to failure. @@ -3664,6 +3834,7 @@ class Statistical * @param float $dataSet * @param float $m0 Alpha Parameter * @param float $sigma Beta Parameter + * * @return float */ public static function ZTEST($dataSet, $m0, $sigma = null) @@ -3677,6 +3848,6 @@ class Statistical } $n = count($dataSet); - return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0) / ($sigma / SQRT($n))); + return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0) / ($sigma / sqrt($n))); } } diff --git a/src/PhpSpreadsheet/Calculation/TextData.php b/src/PhpSpreadsheet/Calculation/TextData.php index b4f322cd..da3a147b 100644 --- a/src/PhpSpreadsheet/Calculation/TextData.php +++ b/src/PhpSpreadsheet/Calculation/TextData.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,9 +34,10 @@ class TextData } /** - * CHARACTER + * CHARACTER. * * @param string $character Value + * * @return string */ public static function CHARACTER($character) @@ -50,13 +52,14 @@ class TextData return iconv('UCS-4LE', 'UTF-8', pack('V', $character)); } - return mb_convert_encoding('&#' . intval($character) . ';', 'UTF-8', 'HTML-ENTITIES'); + return mb_convert_encoding('&#' . (int) $character . ';', 'UTF-8', 'HTML-ENTITIES'); } /** - * TRIMNONPRINTABLE + * TRIMNONPRINTABLE. * * @param mixed $stringValue Value to check + * * @return string */ public static function TRIMNONPRINTABLE($stringValue = '') @@ -79,9 +82,10 @@ class TextData } /** - * TRIMSPACES + * TRIMSPACES. * * @param mixed $stringValue Value to check + * * @return string */ public static function TRIMSPACES($stringValue = '') @@ -99,9 +103,10 @@ class TextData } /** - * ASCIICODE + * ASCIICODE. * * @param string $characters Value + * * @return int */ public static function ASCIICODE($characters) @@ -125,17 +130,16 @@ class TextData } return self::unicodeToOrd($character); - } else { - if (strlen($characters) > 0) { - $character = substr($characters, 0, 1); - } - - return ord($character); } + if (strlen($characters) > 0) { + $character = substr($characters, 0, 1); + } + + return ord($character); } /** - * CONCATENATE + * CONCATENATE. * * @return string */ @@ -160,7 +164,7 @@ class TextData } /** - * DOLLAR + * DOLLAR. * * This function converts a number to text using currency format, with the decimals rounded to the specified place. * The format used is $#,##0.00_);($#,##0.00).. @@ -169,6 +173,7 @@ class TextData * @param int $decimals The number of digits to display to the right of the decimal point. * If decimals is negative, number is rounded to the left of the decimal point. * If you omit decimals, it is assumed to be 2 + * * @return string */ public static function DOLLAR($value = 0, $decimals = 2) @@ -197,11 +202,12 @@ class TextData } /** - * SEARCHSENSITIVE + * SEARCHSENSITIVE. * * @param string $needle The string to look for * @param string $haystack The string in which to look * @param int $offset Offset within $haystack + * * @return string */ public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) @@ -234,11 +240,12 @@ class TextData } /** - * SEARCHINSENSITIVE + * SEARCHINSENSITIVE. * * @param string $needle The string to look for * @param string $haystack The string in which to look * @param int $offset Offset within $haystack + * * @return string */ public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1) @@ -271,11 +278,12 @@ class TextData } /** - * FIXEDFORMAT + * FIXEDFORMAT. * * @param mixed $value Value to check * @param int $decimals * @param bool $no_commas + * * @return string */ public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false) @@ -302,10 +310,11 @@ class TextData } /** - * LEFT + * LEFT. * * @param string $value Value * @param int $chars Number of characters + * * @return string */ public static function LEFT($value = '', $chars = 1) @@ -323,17 +332,18 @@ class TextData if (function_exists('mb_substr')) { return mb_substr($value, 0, $chars, 'UTF-8'); - } else { - return substr($value, 0, $chars); } + + return substr($value, 0, $chars); } /** - * MID + * MID. * * @param string $value Value * @param int $start Start character * @param int $chars Number of characters + * * @return string */ public static function MID($value = '', $start = 1, $chars = null) @@ -355,16 +365,17 @@ class TextData } if (function_exists('mb_substr')) { return mb_substr($value, --$start, $chars, 'UTF-8'); - } else { - return substr($value, --$start, $chars); } + + return substr($value, --$start, $chars); } /** - * RIGHT + * RIGHT. * * @param string $value Value * @param int $chars Number of characters + * * @return string */ public static function RIGHT($value = '', $chars = 1) @@ -382,15 +393,16 @@ class TextData if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) { return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8'); - } else { - return substr($value, strlen($value) - $chars); } + + return substr($value, strlen($value) - $chars); } /** - * STRINGLENGTH + * STRINGLENGTH. * * @param string $value Value + * * @return int */ public static function STRINGLENGTH($value = '') @@ -403,17 +415,18 @@ class TextData if (function_exists('mb_strlen')) { return mb_strlen($value, 'UTF-8'); - } else { - return strlen($value); } + + return strlen($value); } /** - * LOWERCASE + * LOWERCASE. * * Converts a string value to upper case. * * @param string $mixedCaseString + * * @return string */ public static function LOWERCASE($mixedCaseString) @@ -428,11 +441,12 @@ class TextData } /** - * UPPERCASE + * UPPERCASE. * * Converts a string value to upper case. * * @param string $mixedCaseString + * * @return string */ public static function UPPERCASE($mixedCaseString) @@ -447,11 +461,12 @@ class TextData } /** - * PROPERCASE + * PROPERCASE. * * Converts a string value to upper case. * * @param string $mixedCaseString + * * @return string */ public static function PROPERCASE($mixedCaseString) @@ -466,12 +481,13 @@ class TextData } /** - * REPLACE + * REPLACE. * * @param string $oldText String to modify * @param int $start Start character * @param int $chars Number of characters * @param string $newText String to replace in defined position + * * @return string */ public static function REPLACE($oldText, $start, $chars, $newText) @@ -488,12 +504,13 @@ class TextData } /** - * SUBSTITUTE + * SUBSTITUTE. * * @param string $text Value * @param string $fromText From Value * @param string $toText To Value * @param int $instance Instance Number + * * @return string */ public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) @@ -506,38 +523,38 @@ class TextData if ($instance == 0) { if (function_exists('mb_str_replace')) { return mb_str_replace($fromText, $toText, $text); + } + + return str_replace($fromText, $toText, $text); + } + $pos = -1; + while ($instance > 0) { + if (function_exists('mb_strpos')) { + $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8'); } else { - return str_replace($fromText, $toText, $text); + $pos = strpos($text, $fromText, $pos + 1); } - } else { - $pos = -1; - while ($instance > 0) { - if (function_exists('mb_strpos')) { - $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8'); - } else { - $pos = strpos($text, $fromText, $pos + 1); - } - if ($pos === false) { - break; - } - --$instance; + if ($pos === false) { + break; } - if ($pos !== false) { - if (function_exists('mb_strlen')) { - return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText); - } else { - return self::REPLACE($text, ++$pos, strlen($fromText), $toText); - } + --$instance; + } + if ($pos !== false) { + if (function_exists('mb_strlen')) { + return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText); } + + return self::REPLACE($text, ++$pos, strlen($fromText), $toText); } return $text; } /** - * RETURNSTRING + * RETURNSTRING. * * @param mixed $testValue Value to check + * * @return string|null */ public static function RETURNSTRING($testValue = '') @@ -552,10 +569,11 @@ class TextData } /** - * TEXTFORMAT + * TEXTFORMAT. * * @param mixed $value Value to check * @param string $format Format mask to use + * * @return string */ public static function TEXTFORMAT($value, $format) @@ -571,9 +589,10 @@ class TextData } /** - * VALUE + * VALUE. * * @param mixed $value Value to check + * * @return bool */ public static function VALUE($value = '') diff --git a/src/PhpSpreadsheet/Calculation/Token/Stack.php b/src/PhpSpreadsheet/Calculation/Token/Stack.php index 08ccd90d..a83c1b76 100644 --- a/src/PhpSpreadsheet/Calculation/Token/Stack.php +++ b/src/PhpSpreadsheet/Calculation/Token/Stack.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Token; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Token; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Stack { /** - * The parser stack for formulae + * The parser stack for formulae. * * @var mixed[] */ private $stack = []; /** - * Count of entries in the parser stack + * Count of entries in the parser stack. * * @var int */ private $count = 0; /** - * Return the number of entries on the stack + * Return the number of entries on the stack. * * @return int */ @@ -50,7 +51,7 @@ class Stack } /** - * Push a new entry onto the stack + * Push a new entry onto the stack. * * @param mixed $type * @param mixed $value @@ -72,7 +73,7 @@ class Stack } /** - * Pop the last entry from the stack + * Pop the last entry from the stack. * * @return mixed */ @@ -86,9 +87,10 @@ class Stack } /** - * Return an entry from the stack without removing it + * Return an entry from the stack without removing it. * * @param int $n number indicating how far back in the stack we want to look + * * @return mixed */ public function last($n = 1) @@ -101,7 +103,7 @@ class Stack } /** - * Clear the stack + * Clear the stack. */ public function clear() { diff --git a/src/PhpSpreadsheet/Cell.php b/src/PhpSpreadsheet/Cell.php index 5cac7c80..7dcc4d23 100644 --- a/src/PhpSpreadsheet/Cell.php +++ b/src/PhpSpreadsheet/Cell.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Cell { /** - * Default range variable constant + * Default range variable constant. * * @var string */ const DEFAULT_RANGE = 'A1:A1'; /** - * Value binder to use + * Value binder to use. * * @var Cell\IValueBinder */ private static $valueBinder; /** - * Value of the cell + * Value of the cell. * * @var mixed */ @@ -59,33 +60,33 @@ class Cell private $calculatedValue; /** - * Type of the cell data + * Type of the cell data. * * @var string */ private $dataType; /** - * Parent worksheet + * Parent worksheet. * * @var CachedObjectStorage\CacheBase */ private $parent; /** - * Index to cellXf + * Index to cellXf. * * @var int */ private $xfIndex = 0; /** - * Attributes of the formula + * Attributes of the formula. */ private $formulaAttributes; /** - * Send notification to the cache controller + * Send notification to the cache controller. **/ public function notifyCacheController() { @@ -105,11 +106,12 @@ class Cell } /** - * Create a new Cell + * Create a new Cell. * * @param mixed $pValue * @param string $pDataType * @param Worksheet $pSheet + * * @throws Exception */ public function __construct($pValue = null, $pDataType = null, Worksheet $pSheet = null) @@ -132,7 +134,7 @@ class Cell } /** - * Get cell coordinate column + * Get cell coordinate column. * * @return string */ @@ -142,7 +144,7 @@ class Cell } /** - * Get cell coordinate row + * Get cell coordinate row. * * @return int */ @@ -152,7 +154,7 @@ class Cell } /** - * Get cell coordinate + * Get cell coordinate. * * @return string */ @@ -162,7 +164,7 @@ class Cell } /** - * Get cell value + * Get cell value. * * @return mixed */ @@ -172,7 +174,7 @@ class Cell } /** - * Get cell value with formatting + * Get cell value with formatting. * * @return string */ @@ -186,12 +188,14 @@ class Cell } /** - * Set cell value + * Set cell value. * * Sets the value for a cell, automatically determining the datatype using the value binder * * @param mixed $pValue Value + * * @throws Exception + * * @return Cell */ public function setValue($pValue = null) @@ -204,11 +208,13 @@ class Cell } /** - * Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder) + * Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder). * * @param mixed $pValue Value * @param string $pDataType Explicit data type + * * @throws Exception + * * @return Cell */ public function setValueExplicit($pValue = null, $pDataType = Cell\DataType::TYPE_STRING) @@ -251,12 +257,14 @@ class Cell } /** - * Get calculated cell value + * Get calculated cell value. * * @deprecated Since version 1.7.8 for planned changes to cell for array formula handling * * @param bool $resetLog Whether the calculation engine logger should be reset or not + * * @throws Exception + * * @return mixed */ public function getCalculatedValue($resetLog = true) @@ -295,9 +303,10 @@ class Cell } /** - * Set old calculated value (cached) + * Set old calculated value (cached). * * @param mixed $pValue Value + * * @return Cell */ public function setCalculatedValue($pValue = null) @@ -325,7 +334,7 @@ class Cell } /** - * Get cell data type + * Get cell data type. * * @return string */ @@ -335,9 +344,10 @@ class Cell } /** - * Set cell data type + * Set cell data type. * * @param string $pDataType + * * @return Cell */ public function setDataType($pDataType = Cell\DataType::TYPE_STRING) @@ -351,7 +361,7 @@ class Cell } /** - * Identify if the cell contains a formula + * Identify if the cell contains a formula. * * @return bool */ @@ -364,6 +374,7 @@ class Cell * Does this cell contain Data validation rules? * * @throws Exception + * * @return bool */ public function hasDataValidation() @@ -376,9 +387,10 @@ class Cell } /** - * Get Data validation rules + * Get Data validation rules. * * @throws Exception + * * @return Cell\DataValidation */ public function getDataValidation() @@ -391,10 +403,12 @@ class Cell } /** - * Set Data validation rules + * Set Data validation rules. * * @param Cell\DataValidation $pDataValidation + * * @throws Exception + * * @return Cell */ public function setDataValidation(Cell\DataValidation $pDataValidation = null) @@ -412,6 +426,7 @@ class Cell * Does this cell contain a Hyperlink? * * @throws Exception + * * @return bool */ public function hasHyperlink() @@ -424,9 +439,10 @@ class Cell } /** - * Get Hyperlink + * Get Hyperlink. * * @throws Exception + * * @return Cell\Hyperlink */ public function getHyperlink() @@ -439,10 +455,12 @@ class Cell } /** - * Set Hyperlink + * Set Hyperlink. * * @param Cell\Hyperlink $pHyperlink + * * @throws Exception + * * @return Cell */ public function setHyperlink(Cell\Hyperlink $pHyperlink = null) @@ -457,7 +475,7 @@ class Cell } /** - * Get parent worksheet + * Get parent worksheet. * * @return CachedObjectStorage\CacheBase */ @@ -467,7 +485,7 @@ class Cell } /** - * Get parent worksheet + * Get parent worksheet. * * @return Worksheet */ @@ -477,17 +495,17 @@ class Cell } /** - * Is this cell in a merge range + * Is this cell in a merge range. * * @return bool */ public function isInMergeRange() { - return (boolean) $this->getMergeRange(); + return (bool) $this->getMergeRange(); } /** - * Is this cell the master (top left cell) in a merge range (that holds the actual data value) + * Is this cell the master (top left cell) in a merge range (that holds the actual data value). * * @return bool */ @@ -505,7 +523,7 @@ class Cell } /** - * If this cell is in a merge range, then return the range + * If this cell is in a merge range, then return the range. * * @return string */ @@ -521,7 +539,7 @@ class Cell } /** - * Get cell style + * Get cell style. * * @return Style */ @@ -531,9 +549,10 @@ class Cell } /** - * Re-bind parent + * Re-bind parent. * * @param Worksheet $parent + * * @return Cell */ public function rebindParent(Worksheet $parent) @@ -547,6 +566,7 @@ class Cell * Is cell in a specific range? * * @param string $pRange Cell range (e.g. A1:A1) + * * @return bool */ public function isInRange($pRange = 'A1:A1') @@ -563,10 +583,12 @@ class Cell } /** - * Coordinate from string + * Coordinate from string. * * @param string $pCoordinateString + * * @throws Exception + * * @return string[] Array containing column and row (indexes 0 and 1) */ public static function coordinateFromString($pCoordinateString = 'A1') @@ -583,11 +605,13 @@ class Cell } /** - * Make string row, column or cell coordinate absolute + * Make string row, column or cell coordinate absolute. * * @param string $pCoordinateString e.g. 'A' or '1' or 'A1' * Note that this value can be a row or column reference as well as a cell reference + * * @throws Exception + * * @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1' */ public static function absoluteReference($pCoordinateString = 'A1') @@ -617,10 +641,12 @@ class Cell } /** - * Make string coordinate absolute + * Make string coordinate absolute. * * @param string $pCoordinateString e.g. 'A1' + * * @throws Exception + * * @return string Absolute coordinate e.g. '$A$1' */ public static function absoluteCoordinate($pCoordinateString = 'A1') @@ -648,9 +674,10 @@ class Cell } /** - * Split range into coordinate strings + * Split range into coordinate strings. * * @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' + * * @return array Array containg one or more arrays containing one or two coordinate strings * e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11')) * or array('B4') @@ -672,10 +699,12 @@ class Cell } /** - * Build range from coordinate strings + * Build range from coordinate strings. * * @param array $pRange Array containg one or more arrays containing one or two coordinate strings + * * @throws Exception + * * @return string String representation of $pRange */ public static function buildRange($pRange) @@ -697,9 +726,10 @@ class Cell } /** - * Calculate range boundaries + * Calculate range boundaries. * * @param string $pRange Cell range (e.g. A1:A1) + * * @return array Range coordinates array(Start Cell, End Cell) * where Start Cell and End Cell are arrays (Column Number, Row Number) */ @@ -732,9 +762,10 @@ class Cell } /** - * Calculate range dimension + * Calculate range dimension. * * @param string $pRange Cell range (e.g. A1:A1) + * * @return array Range dimension (width, height) */ public static function rangeDimension($pRange = 'A1:A1') @@ -746,9 +777,10 @@ class Cell } /** - * Calculate range boundaries + * Calculate range boundaries. * * @param string $pRange Cell range (e.g. A1:A1) + * * @return array Range coordinates array(Start Cell, End Cell) * where Start Cell and End Cell are arrays (Column ID, Row Number) */ @@ -773,9 +805,10 @@ class Cell } /** - * Column index from string + * Column index from string. * * @param string $pString + * * @return int Column index (base 1 !!!) */ public static function columnIndexFromString($pString = 'A') @@ -800,28 +833,29 @@ class Cell // We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString // for improved performance - if (isset($pString{0})) { - if (!isset($pString{1})) { + if (isset($pString[0])) { + if (!isset($pString[1])) { $_indexCache[$pString] = $_columnLookup[$pString]; return $_indexCache[$pString]; - } elseif (!isset($pString{2})) { - $_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}]; + } elseif (!isset($pString[2])) { + $_indexCache[$pString] = $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]]; return $_indexCache[$pString]; - } elseif (!isset($pString{3})) { - $_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}]; + } elseif (!isset($pString[3])) { + $_indexCache[$pString] = $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]]; return $_indexCache[$pString]; } } - throw new Exception('Column string index can not be ' . ((isset($pString{0})) ? 'longer than 3 characters' : 'empty')); + throw new Exception('Column string index can not be ' . ((isset($pString[0])) ? 'longer than 3 characters' : 'empty')); } /** - * String from columnindex + * String from columnindex. * * @param int $pColumnIndex Column index (base 0 !!!) + * * @return string */ public static function stringFromColumnIndex($pColumnIndex = 0) @@ -849,9 +883,10 @@ class Cell } /** - * Extract all cell references in range + * Extract all cell references in range. * * @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25) + * * @return array Array containing single cell references */ public static function extractAllCellReferencesInRange($pRange = 'A1') @@ -912,10 +947,11 @@ class Cell } /** - * Compare 2 cells + * Compare 2 cells. * * @param Cell $a Cell a * @param Cell $b Cell b + * * @return int Result of comparison (always -1 or 1, never zero!) */ public static function compareCells(Cell $a, Cell $b) @@ -926,13 +962,13 @@ class Cell return 1; } elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) { return -1; - } else { - return 1; } + + return 1; } /** - * Get value binder to use + * Get value binder to use. * * @return Cell\IValueBinder */ @@ -946,9 +982,10 @@ class Cell } /** - * Set value binder to use + * Set value binder to use. * * @param Cell\IValueBinder $binder + * * @throws Exception */ public static function setValueBinder(Cell\IValueBinder $binder = null) @@ -976,7 +1013,7 @@ class Cell } /** - * Get index to cellXf + * Get index to cellXf. * * @return int */ @@ -986,9 +1023,10 @@ class Cell } /** - * Set index to cellXf + * Set index to cellXf. * * @param int $pValue + * * @return Cell */ public function setXfIndex($pValue = 0) @@ -1000,6 +1038,8 @@ class Cell /** * @deprecated Since version 1.7.8 for planned changes to cell for array formula handling + * + * @param mixed $pAttributes */ public function setFormulaAttributes($pAttributes) { @@ -1017,7 +1057,7 @@ class Cell } /** - * Convert to string + * Convert to string. * * @return string */ diff --git a/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php b/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php index 4f7840ab..eaa940c6 100644 --- a/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php +++ b/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,18 @@ namespace PhpOffice\PhpSpreadsheet\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder { /** - * Bind value to a cell + * Bind value to a cell. * * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell + * * @return bool */ public function bindValue(\PhpOffice\PhpSpreadsheet\Cell $cell, $value = null) diff --git a/src/PhpSpreadsheet/Cell/DataType.php b/src/PhpSpreadsheet/Cell/DataType.php index a64cb826..5e18de94 100644 --- a/src/PhpSpreadsheet/Cell/DataType.php +++ b/src/PhpSpreadsheet/Cell/DataType.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -36,7 +37,7 @@ class DataType const TYPE_ERROR = 'e'; /** - * List of error codes + * List of error codes. * * @var array */ @@ -51,7 +52,7 @@ class DataType ]; /** - * Get list of error codes + * Get list of error codes. * * @return array */ @@ -61,9 +62,11 @@ class DataType } /** - * Check a string that it satisfies Excel requirements + * Check a string that it satisfies Excel requirements. * * @param mixed Value to sanitize to an Excel string + * @param null|mixed $pValue + * * @return mixed Sanitized value */ public static function checkString($pValue = null) @@ -83,9 +86,11 @@ class DataType } /** - * Check a value that it is a valid error code + * Check a value that it is a valid error code. * * @param mixed Value to sanitize to an Excel error code + * @param null|mixed $pValue + * * @return string Sanitized value */ public static function checkErrorCode($pValue = null) diff --git a/src/PhpSpreadsheet/Cell/DataValidation.php b/src/PhpSpreadsheet/Cell/DataValidation.php index f397089c..faffe464 100644 --- a/src/PhpSpreadsheet/Cell/DataValidation.php +++ b/src/PhpSpreadsheet/Cell/DataValidation.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -51,105 +52,105 @@ class DataValidation const OPERATOR_NOTEQUAL = 'notEqual'; /** - * Formula 1 + * Formula 1. * * @var string */ private $formula1 = ''; /** - * Formula 2 + * Formula 2. * * @var string */ private $formula2 = ''; /** - * Type + * Type. * * @var string */ private $type = self::TYPE_NONE; /** - * Error style + * Error style. * * @var string */ private $errorStyle = self::STYLE_STOP; /** - * Operator + * Operator. * * @var string */ private $operator = ''; /** - * Allow Blank + * Allow Blank. * * @var bool */ private $allowBlank = false; /** - * Show DropDown + * Show DropDown. * * @var bool */ private $showDropDown = false; /** - * Show InputMessage + * Show InputMessage. * * @var bool */ private $showInputMessage = false; /** - * Show ErrorMessage + * Show ErrorMessage. * * @var bool */ private $showErrorMessage = false; /** - * Error title + * Error title. * * @var string */ private $errorTitle = ''; /** - * Error + * Error. * * @var string */ private $error = ''; /** - * Prompt title + * Prompt title. * * @var string */ private $promptTitle = ''; /** - * Prompt + * Prompt. * * @var string */ private $prompt = ''; /** - * Create a new DataValidation + * Create a new DataValidation. */ public function __construct() { } /** - * Get Formula 1 + * Get Formula 1. * * @return string */ @@ -159,9 +160,10 @@ class DataValidation } /** - * Set Formula 1 + * Set Formula 1. * * @param string $value + * * @return DataValidation */ public function setFormula1($value = '') @@ -172,7 +174,7 @@ class DataValidation } /** - * Get Formula 2 + * Get Formula 2. * * @return string */ @@ -182,9 +184,10 @@ class DataValidation } /** - * Set Formula 2 + * Set Formula 2. * * @param string $value + * * @return DataValidation */ public function setFormula2($value = '') @@ -195,7 +198,7 @@ class DataValidation } /** - * Get Type + * Get Type. * * @return string */ @@ -205,9 +208,10 @@ class DataValidation } /** - * Set Type + * Set Type. * * @param string $value + * * @return DataValidation */ public function setType($value = self::TYPE_NONE) @@ -218,7 +222,7 @@ class DataValidation } /** - * Get Error style + * Get Error style. * * @return string */ @@ -228,9 +232,10 @@ class DataValidation } /** - * Set Error style + * Set Error style. * * @param string $value + * * @return DataValidation */ public function setErrorStyle($value = self::STYLE_STOP) @@ -241,7 +246,7 @@ class DataValidation } /** - * Get Operator + * Get Operator. * * @return string */ @@ -251,9 +256,10 @@ class DataValidation } /** - * Set Operator + * Set Operator. * * @param string $value + * * @return DataValidation */ public function setOperator($value = '') @@ -264,7 +270,7 @@ class DataValidation } /** - * Get Allow Blank + * Get Allow Blank. * * @return bool */ @@ -274,9 +280,10 @@ class DataValidation } /** - * Set Allow Blank + * Set Allow Blank. * * @param bool $value + * * @return DataValidation */ public function setAllowBlank($value = false) @@ -287,7 +294,7 @@ class DataValidation } /** - * Get Show DropDown + * Get Show DropDown. * * @return bool */ @@ -297,9 +304,10 @@ class DataValidation } /** - * Set Show DropDown + * Set Show DropDown. * * @param bool $value + * * @return DataValidation */ public function setShowDropDown($value = false) @@ -310,7 +318,7 @@ class DataValidation } /** - * Get Show InputMessage + * Get Show InputMessage. * * @return bool */ @@ -320,9 +328,10 @@ class DataValidation } /** - * Set Show InputMessage + * Set Show InputMessage. * * @param bool $value + * * @return DataValidation */ public function setShowInputMessage($value = false) @@ -333,7 +342,7 @@ class DataValidation } /** - * Get Show ErrorMessage + * Get Show ErrorMessage. * * @return bool */ @@ -343,9 +352,10 @@ class DataValidation } /** - * Set Show ErrorMessage + * Set Show ErrorMessage. * * @param bool $value + * * @return DataValidation */ public function setShowErrorMessage($value = false) @@ -356,7 +366,7 @@ class DataValidation } /** - * Get Error title + * Get Error title. * * @return string */ @@ -366,9 +376,10 @@ class DataValidation } /** - * Set Error title + * Set Error title. * * @param string $value + * * @return DataValidation */ public function setErrorTitle($value = '') @@ -379,7 +390,7 @@ class DataValidation } /** - * Get Error + * Get Error. * * @return string */ @@ -389,9 +400,10 @@ class DataValidation } /** - * Set Error + * Set Error. * * @param string $value + * * @return DataValidation */ public function setError($value = '') @@ -402,7 +414,7 @@ class DataValidation } /** - * Get Prompt title + * Get Prompt title. * * @return string */ @@ -412,9 +424,10 @@ class DataValidation } /** - * Set Prompt title + * Set Prompt title. * * @param string $value + * * @return DataValidation */ public function setPromptTitle($value = '') @@ -425,7 +438,7 @@ class DataValidation } /** - * Get Prompt + * Get Prompt. * * @return string */ @@ -435,9 +448,10 @@ class DataValidation } /** - * Set Prompt + * Set Prompt. * * @param string $value + * * @return DataValidation */ public function setPrompt($value = '') @@ -448,7 +462,7 @@ class DataValidation } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Cell/DefaultValueBinder.php b/src/PhpSpreadsheet/Cell/DefaultValueBinder.php index a937badf..6faaca11 100644 --- a/src/PhpSpreadsheet/Cell/DefaultValueBinder.php +++ b/src/PhpSpreadsheet/Cell/DefaultValueBinder.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,18 @@ namespace PhpOffice\PhpSpreadsheet\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class DefaultValueBinder implements IValueBinder { /** - * Bind value to a cell + * Bind value to a cell. * * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell + * * @return bool */ public function bindValue(\PhpOffice\PhpSpreadsheet\Cell $cell, $value = null) @@ -54,9 +56,10 @@ class DefaultValueBinder implements IValueBinder } /** - * DataType for value + * DataType for value. * * @param mixed $pValue + * * @return string */ public static function dataTypeForValue($pValue = null) @@ -68,7 +71,7 @@ class DefaultValueBinder implements IValueBinder return DataType::TYPE_STRING; } elseif ($pValue instanceof \PhpOffice\PhpSpreadsheet\RichText) { return DataType::TYPE_INLINE; - } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { + } elseif ($pValue[0] === '=' && strlen($pValue) > 1) { return DataType::TYPE_FORMULA; } elseif (is_bool($pValue)) { return DataType::TYPE_BOOL; @@ -76,7 +79,7 @@ class DefaultValueBinder implements IValueBinder return DataType::TYPE_NUMERIC; } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) { $tValue = ltrim($pValue, '+-'); - if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') { + if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') { return DataType::TYPE_STRING; } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) { return DataType::TYPE_STRING; diff --git a/src/PhpSpreadsheet/Cell/Hyperlink.php b/src/PhpSpreadsheet/Cell/Hyperlink.php index cb9c74db..1be5a818 100644 --- a/src/PhpSpreadsheet/Cell/Hyperlink.php +++ b/src/PhpSpreadsheet/Cell/Hyperlink.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Hyperlink { /** - * URL to link the cell to + * URL to link the cell to. * * @var string */ private $url; /** - * Tooltip to display on the hyperlink + * Tooltip to display on the hyperlink. * * @var string */ private $tooltip; /** - * Create a new Hyperlink + * Create a new Hyperlink. * * @param string $pUrl Url to link the cell to * @param string $pTooltip Tooltip to display on the hyperlink @@ -53,7 +54,7 @@ class Hyperlink } /** - * Get URL + * Get URL. * * @return string */ @@ -63,9 +64,10 @@ class Hyperlink } /** - * Set URL + * Set URL. * * @param string $value + * * @return Hyperlink */ public function setUrl($value = '') @@ -76,7 +78,7 @@ class Hyperlink } /** - * Get tooltip + * Get tooltip. * * @return string */ @@ -86,9 +88,10 @@ class Hyperlink } /** - * Set tooltip + * Set tooltip. * * @param string $value + * * @return Hyperlink */ public function setTooltip($value = '') @@ -99,7 +102,7 @@ class Hyperlink } /** - * Is this hyperlink internal? (to another worksheet) + * Is this hyperlink internal? (to another worksheet). * * @return bool */ @@ -109,7 +112,7 @@ class Hyperlink } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Cell/IValueBinder.php b/src/PhpSpreadsheet/Cell/IValueBinder.php index 339d87b7..6ea5dfbe 100644 --- a/src/PhpSpreadsheet/Cell/IValueBinder.php +++ b/src/PhpSpreadsheet/Cell/IValueBinder.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,18 @@ namespace PhpOffice\PhpSpreadsheet\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ interface IValueBinder { /** - * Bind value to a cell + * Bind value to a cell. * * @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to bind value to * @param mixed $value Value to bind in cell + * * @return bool */ public function bindValue(\PhpOffice\PhpSpreadsheet\Cell $cell, $value = null); diff --git a/src/PhpSpreadsheet/Chart.php b/src/PhpSpreadsheet/Chart.php index 55d53bfa..f15defc9 100644 --- a/src/PhpSpreadsheet/Chart.php +++ b/src/PhpSpreadsheet/Chart.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,146 +20,151 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Chart { /** - * Chart Name + * Chart Name. * * @var string */ private $name = ''; /** - * Worksheet + * Worksheet. * * @var Worksheet */ private $worksheet; /** - * Chart Title + * Chart Title. * * @var Chart\Title */ private $title; /** - * Chart Legend + * Chart Legend. * * @var Chart\Legend */ private $legend; /** - * X-Axis Label + * X-Axis Label. * * @var Chart\Title */ private $xAxisLabel; /** - * Y-Axis Label + * Y-Axis Label. * * @var Chart\Title */ private $yAxisLabel; /** - * Chart Plot Area + * Chart Plot Area. * * @var Chart\PlotArea */ private $plotArea; /** - * Plot Visible Only + * Plot Visible Only. * * @var bool */ private $plotVisibleOnly = true; /** - * Display Blanks as + * Display Blanks as. * * @var string */ private $displayBlanksAs = '0'; /** - * Chart Asix Y as + * Chart Asix Y as. * * @var Chart\Axis */ private $yAxis; /** - * Chart Asix X as + * Chart Asix X as. * * @var Chart\Axis */ private $xAxis; /** - * Chart Major Gridlines as + * Chart Major Gridlines as. * * @var Chart\GridLines */ private $majorGridlines; /** - * Chart Minor Gridlines as + * Chart Minor Gridlines as. * * @var Chart\GridLines */ private $minorGridlines; /** - * Top-Left Cell Position + * Top-Left Cell Position. * * @var string */ private $topLeftCellRef = 'A1'; /** - * Top-Left X-Offset + * Top-Left X-Offset. * * @var int */ private $topLeftXOffset = 0; /** - * Top-Left Y-Offset + * Top-Left Y-Offset. * * @var int */ private $topLeftYOffset = 0; /** - * Bottom-Right Cell Position + * Bottom-Right Cell Position. * * @var string */ private $bottomRightCellRef = 'A1'; /** - * Bottom-Right X-Offset + * Bottom-Right X-Offset. * * @var int */ private $bottomRightXOffset = 10; /** - * Bottom-Right Y-Offset + * Bottom-Right Y-Offset. * * @var int */ private $bottomRightYOffset = 10; /** - * Create a new Chart + * Create a new Chart. + * + * @param mixed $name + * @param mixed $plotVisibleOnly + * @param mixed $displayBlanksAs */ public function __construct($name, Chart\Title $title = null, Chart\Legend $legend = null, Chart\PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Chart\Title $xAxisLabel = null, Chart\Title $yAxisLabel = null, Chart\Axis $xAxis = null, Chart\Axis $yAxis = null, Chart\GridLines $majorGridlines = null, Chart\GridLines $minorGridlines = null) { @@ -178,7 +183,7 @@ class Chart } /** - * Get Name + * Get Name. * * @return string */ @@ -188,7 +193,7 @@ class Chart } /** - * Get Worksheet + * Get Worksheet. * * @return Worksheet */ @@ -198,10 +203,12 @@ class Chart } /** - * Set Worksheet + * Set Worksheet. * * @param Worksheet $pValue + * * @throws Chart\Exception + * * @return Chart */ public function setWorksheet(Worksheet $pValue = null) @@ -212,7 +219,7 @@ class Chart } /** - * Get Title + * Get Title. * * @return Chart\Title */ @@ -222,9 +229,10 @@ class Chart } /** - * Set Title + * Set Title. * * @param Chart\Title $title + * * @return Chart */ public function setTitle(Chart\Title $title) @@ -235,7 +243,7 @@ class Chart } /** - * Get Legend + * Get Legend. * * @return Chart\Legend */ @@ -245,9 +253,10 @@ class Chart } /** - * Set Legend + * Set Legend. * * @param Chart\Legend $legend + * * @return Chart */ public function setLegend(Chart\Legend $legend) @@ -258,7 +267,7 @@ class Chart } /** - * Get X-Axis Label + * Get X-Axis Label. * * @return Chart\Title */ @@ -268,9 +277,10 @@ class Chart } /** - * Set X-Axis Label + * Set X-Axis Label. * * @param Chart\Title $label + * * @return Chart */ public function setXAxisLabel(Chart\Title $label) @@ -281,7 +291,7 @@ class Chart } /** - * Get Y-Axis Label + * Get Y-Axis Label. * * @return Chart\Title */ @@ -291,9 +301,10 @@ class Chart } /** - * Set Y-Axis Label + * Set Y-Axis Label. * * @param Chart\Title $label + * * @return Chart */ public function setYAxisLabel(Chart\Title $label) @@ -304,7 +315,7 @@ class Chart } /** - * Get Plot Area + * Get Plot Area. * * @return Chart\PlotArea */ @@ -314,7 +325,7 @@ class Chart } /** - * Get Plot Visible Only + * Get Plot Visible Only. * * @return bool */ @@ -324,9 +335,10 @@ class Chart } /** - * Set Plot Visible Only + * Set Plot Visible Only. * * @param bool $plotVisibleOnly + * * @return Chart */ public function setPlotVisibleOnly($plotVisibleOnly = true) @@ -337,7 +349,7 @@ class Chart } /** - * Get Display Blanks as + * Get Display Blanks as. * * @return string */ @@ -347,9 +359,10 @@ class Chart } /** - * Set Display Blanks as + * Set Display Blanks as. * * @param string $displayBlanksAs + * * @return Chart */ public function setDisplayBlanksAs($displayBlanksAs = '0') @@ -358,7 +371,7 @@ class Chart } /** - * Get yAxis + * Get yAxis. * * @return Chart\Axis */ @@ -372,7 +385,7 @@ class Chart } /** - * Get xAxis + * Get xAxis. * * @return Chart\Axis */ @@ -386,7 +399,7 @@ class Chart } /** - * Get Major Gridlines + * Get Major Gridlines. * * @return Chart\GridLines */ @@ -400,7 +413,7 @@ class Chart } /** - * Get Minor Gridlines + * Get Minor Gridlines. * * @return Chart\GridLines */ @@ -414,11 +427,12 @@ class Chart } /** - * Set the Top Left position for the chart + * Set the Top Left position for the chart. * * @param string $cell * @param int $xOffset * @param int $yOffset + * * @return Chart */ public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) @@ -435,7 +449,7 @@ class Chart } /** - * Get the top left position of the chart + * Get the top left position of the chart. * * @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell */ @@ -449,7 +463,7 @@ class Chart } /** - * Get the cell address where the top left of the chart is fixed + * Get the cell address where the top left of the chart is fixed. * * @return string */ @@ -459,9 +473,10 @@ class Chart } /** - * Set the Top Left cell position for the chart + * Set the Top Left cell position for the chart. * * @param string $cell + * * @return Chart */ public function setTopLeftCell($cell) @@ -472,10 +487,11 @@ class Chart } /** - * Set the offset position within the Top Left cell for the chart + * Set the offset position within the Top Left cell for the chart. * * @param int $xOffset * @param int $yOffset + * * @return Chart */ public function setTopLeftOffset($xOffset = null, $yOffset = null) @@ -491,7 +507,7 @@ class Chart } /** - * Get the offset position within the Top Left cell for the chart + * Get the offset position within the Top Left cell for the chart. * * @return int[] */ @@ -528,11 +544,12 @@ class Chart } /** - * Set the Bottom Right position of the chart + * Set the Bottom Right position of the chart. * * @param string $cell * @param int $xOffset * @param int $yOffset + * * @return Chart */ public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) @@ -549,7 +566,7 @@ class Chart } /** - * Get the bottom right position of the chart + * Get the bottom right position of the chart. * * @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell */ @@ -570,7 +587,7 @@ class Chart } /** - * Get the cell address where the bottom right of the chart is fixed + * Get the cell address where the bottom right of the chart is fixed. * * @return string */ @@ -580,10 +597,11 @@ class Chart } /** - * Set the offset position within the Bottom Right cell for the chart + * Set the offset position within the Bottom Right cell for the chart. * * @param int $xOffset * @param int $yOffset + * * @return Chart */ public function setBottomRightOffset($xOffset = null, $yOffset = null) @@ -599,7 +617,7 @@ class Chart } /** - * Get the offset position within the Bottom Right cell for the chart + * Get the offset position within the Bottom Right cell for the chart. * * @return int[] */ diff --git a/src/PhpSpreadsheet/Chart/Axis.php b/src/PhpSpreadsheet/Chart/Axis.php index 5c8d0a3a..a253c1a2 100644 --- a/src/PhpSpreadsheet/Chart/Axis.php +++ b/src/PhpSpreadsheet/Chart/Axis.php @@ -6,12 +6,12 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Created by PhpStorm. * User: Wiktor Trzonkowski * Date: 6/17/14 - * Time: 12:11 PM + * Time: 12:11 PM. */ class Axis extends Properties { /** - * Axis Number + * Axis Number. * * @var array of mixed */ @@ -21,7 +21,7 @@ class Axis extends Properties ]; /** - * Axis Options + * Axis Options. * * @var array of mixed */ @@ -39,7 +39,7 @@ class Axis extends Properties ]; /** - * Fill Properties + * Fill Properties. * * @var array of mixed */ @@ -50,7 +50,7 @@ class Axis extends Properties ]; /** - * Line Properties + * Line Properties. * * @var array of mixed */ @@ -61,7 +61,7 @@ class Axis extends Properties ]; /** - * Line Style Properties + * Line Style Properties. * * @var array of mixed */ @@ -84,7 +84,7 @@ class Axis extends Properties ]; /** - * Shadow Properties + * Shadow Properties. * * @var array of mixed */ @@ -109,7 +109,7 @@ class Axis extends Properties ]; /** - * Glow Properties + * Glow Properties. * * @var array of mixed */ @@ -123,7 +123,7 @@ class Axis extends Properties ]; /** - * Soft Edge Properties + * Soft Edge Properties. * * @var array of mixed */ @@ -132,7 +132,9 @@ class Axis extends Properties ]; /** - * Get Series Data Type + * Get Series Data Type. + * + * @param mixed $format_code * * @return string */ @@ -143,7 +145,7 @@ class Axis extends Properties } /** - * Get Axis Number Format Data Type + * Get Axis Number Format Data Type. * * @return string */ @@ -153,7 +155,7 @@ class Axis extends Properties } /** - * Get Axis Number Source Linked + * Get Axis Number Source Linked. * * @return string */ @@ -163,7 +165,7 @@ class Axis extends Properties } /** - * Set Axis Options Properties + * Set Axis Options Properties. * * @param string $axis_labels * @param string $horizontal_crosses_value @@ -192,7 +194,7 @@ class Axis extends Properties } /** - * Get Axis Options Property + * Get Axis Options Property. * * @param string $property * @@ -204,7 +206,7 @@ class Axis extends Properties } /** - * Set Axis Orientation Property + * Set Axis Orientation Property. * * @param string $orientation */ @@ -214,7 +216,7 @@ class Axis extends Properties } /** - * Set Fill Property + * Set Fill Property. * * @param string $color * @param int $alpha @@ -226,7 +228,7 @@ class Axis extends Properties } /** - * Set Line Property + * Set Line Property. * * @param string $color * @param int $alpha @@ -238,7 +240,7 @@ class Axis extends Properties } /** - * Get Fill Property + * Get Fill Property. * * @param string $property * @@ -250,7 +252,7 @@ class Axis extends Properties } /** - * Get Line Property + * Get Line Property. * * @param string $property * @@ -262,7 +264,7 @@ class Axis extends Properties } /** - * Set Line Style Properties + * Set Line Style Properties. * * @param float $line_width * @param string $compound_type @@ -288,7 +290,7 @@ class Axis extends Properties } /** - * Get Line Style Property + * Get Line Style Property. * * @param array|string $elements * @@ -300,7 +302,7 @@ class Axis extends Properties } /** - * Get Line Style Arrow Excel Width + * Get Line Style Arrow Excel Width. * * @param string $arrow * @@ -312,7 +314,7 @@ class Axis extends Properties } /** - * Get Line Style Arrow Excel Length + * Get Line Style Arrow Excel Length. * * @param string $arrow * @@ -324,7 +326,7 @@ class Axis extends Properties } /** - * Set Shadow Properties + * Set Shadow Properties. * * @param int $sh_presets * @param string $sh_color_value @@ -348,7 +350,7 @@ class Axis extends Properties } /** - * Set Shadow Color + * Set Shadow Color. * * @param int $shadow_presets * @@ -363,7 +365,7 @@ class Axis extends Properties } /** - * Set Shadow Properties from Maped Values + * Set Shadow Properties from Maped Values. * * @param array $properties_map * @param * $reference @@ -394,7 +396,7 @@ class Axis extends Properties } /** - * Set Shadow Color + * Set Shadow Color. * * @param string $color * @param int $alpha @@ -410,7 +412,7 @@ class Axis extends Properties } /** - * Set Shadow Blur + * Set Shadow Blur. * * @param float $blur * @@ -426,7 +428,7 @@ class Axis extends Properties } /** - * Set Shadow Angle + * Set Shadow Angle. * * @param int $angle * @@ -442,7 +444,7 @@ class Axis extends Properties } /** - * Set Shadow Distance + * Set Shadow Distance. * * @param float $distance * @@ -458,7 +460,9 @@ class Axis extends Properties } /** - * Get Shadow Property + * Get Shadow Property. + * + * @param mixed $elements */ public function getShadowProperty($elements) { @@ -466,7 +470,7 @@ class Axis extends Properties } /** - * Set Glow Properties + * Set Glow Properties. * * @param float $size * @param string $color_value @@ -484,7 +488,7 @@ class Axis extends Properties } /** - * Get Glow Property + * Get Glow Property. * * @param array|string $property * @@ -496,7 +500,7 @@ class Axis extends Properties } /** - * Set Glow Color + * Set Glow Color. * * @param float $size * @@ -512,7 +516,7 @@ class Axis extends Properties } /** - * Set Glow Color + * Set Glow Color. * * @param string $color * @param int $alpha @@ -528,7 +532,7 @@ class Axis extends Properties } /** - * Set Soft Edges Size + * Set Soft Edges Size. * * @param float $size */ @@ -540,7 +544,7 @@ class Axis extends Properties } /** - * Get Soft Edges Size + * Get Soft Edges Size. * * @return string */ diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 9f8a5069..e7246e5a 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -60,70 +61,80 @@ class DataSeries const STYLE_FILLED = 'filled'; /** - * Series Plot Type + * Series Plot Type. * * @var string */ private $plotType; /** - * Plot Grouping Type + * Plot Grouping Type. * * @var string */ private $plotGrouping; /** - * Plot Direction + * Plot Direction. * * @var string */ private $plotDirection; /** - * Plot Style + * Plot Style. * * @var string */ private $plotStyle; /** - * Order of plots in Series + * Order of plots in Series. * * @var array of integer */ private $plotOrder = []; /** - * Plot Label + * Plot Label. * * @var array of DataSeriesValues */ private $plotLabel = []; /** - * Plot Category + * Plot Category. * * @var array of DataSeriesValues */ private $plotCategory = []; /** - * Smooth Line + * Smooth Line. * * @var bool */ private $smoothLine; /** - * Plot Values + * Plot Values. * * @var array of DataSeriesValues */ private $plotValues = []; /** - * Create a new DataSeries + * Create a new DataSeries. + * + * @param null|mixed $plotType + * @param null|mixed $plotGrouping + * @param mixed $plotOrder + * @param mixed $plotLabel + * @param mixed $plotCategory + * @param mixed $plotValues + * @param null|mixed $plotDirection + * @param null|mixed $smoothLine + * @param null|mixed $plotStyle */ public function __construct($plotType = null, $plotGrouping = null, $plotOrder = [], $plotLabel = [], $plotCategory = [], $plotValues = [], $plotDirection = null, $smoothLine = null, $plotStyle = null) { @@ -151,7 +162,7 @@ class DataSeries } /** - * Get Plot Type + * Get Plot Type. * * @return string */ @@ -161,9 +172,10 @@ class DataSeries } /** - * Set Plot Type + * Set Plot Type. * * @param string $plotType + * * @return DataSeries */ public function setPlotType($plotType = '') @@ -174,7 +186,7 @@ class DataSeries } /** - * Get Plot Grouping Type + * Get Plot Grouping Type. * * @return string */ @@ -184,9 +196,10 @@ class DataSeries } /** - * Set Plot Grouping Type + * Set Plot Grouping Type. * * @param string $groupingType + * * @return DataSeries */ public function setPlotGrouping($groupingType = null) @@ -197,7 +210,7 @@ class DataSeries } /** - * Get Plot Direction + * Get Plot Direction. * * @return string */ @@ -207,9 +220,10 @@ class DataSeries } /** - * Set Plot Direction + * Set Plot Direction. * * @param string $plotDirection + * * @return DataSeries */ public function setPlotDirection($plotDirection = null) @@ -220,7 +234,7 @@ class DataSeries } /** - * Get Plot Order + * Get Plot Order. * * @return string */ @@ -230,7 +244,7 @@ class DataSeries } /** - * Get Plot Labels + * Get Plot Labels. * * @return array of DataSeriesValues */ @@ -240,7 +254,9 @@ class DataSeries } /** - * Get Plot Label by Index + * Get Plot Label by Index. + * + * @param mixed $index * * @return DataSeriesValues */ @@ -257,7 +273,7 @@ class DataSeries } /** - * Get Plot Categories + * Get Plot Categories. * * @return array of DataSeriesValues */ @@ -267,7 +283,9 @@ class DataSeries } /** - * Get Plot Category by Index + * Get Plot Category by Index. + * + * @param mixed $index * * @return DataSeriesValues */ @@ -284,7 +302,7 @@ class DataSeries } /** - * Get Plot Style + * Get Plot Style. * * @return string */ @@ -294,9 +312,10 @@ class DataSeries } /** - * Set Plot Style + * Set Plot Style. * * @param string $plotStyle + * * @return DataSeries */ public function setPlotStyle($plotStyle = null) @@ -307,7 +326,7 @@ class DataSeries } /** - * Get Plot Values + * Get Plot Values. * * @return array of DataSeriesValues */ @@ -317,7 +336,9 @@ class DataSeries } /** - * Get Plot Values by Index + * Get Plot Values by Index. + * + * @param mixed $index * * @return DataSeriesValues */ @@ -334,7 +355,7 @@ class DataSeries } /** - * Get Number of Plot Series + * Get Number of Plot Series. * * @return int */ @@ -344,7 +365,7 @@ class DataSeries } /** - * Get Smooth Line + * Get Smooth Line. * * @return bool */ @@ -354,9 +375,10 @@ class DataSeries } /** - * Set Smooth Line + * Set Smooth Line. * * @param bool $smoothLine + * * @return DataSeries */ public function setSmoothLine($smoothLine = true) diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index bda04589..831cbd9c 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -34,50 +35,56 @@ class DataSeriesValues ]; /** - * Series Data Type + * Series Data Type. * * @var string */ private $dataType; /** - * Series Data Source + * Series Data Source. * * @var string */ private $dataSource; /** - * Format Code + * Format Code. * * @var string */ private $formatCode; /** - * Series Point Marker + * Series Point Marker. * * @var string */ private $pointMarker; /** - * Point Count (The number of datapoints in the dataseries) + * Point Count (The number of datapoints in the dataseries). * * @var int */ private $pointCount = 0; /** - * Data Values + * Data Values. * * @var array of mixed */ private $dataValues = []; /** - * Create a new DataSeriesValues object + * Create a new DataSeriesValues object. + * * @param string $dataSource + * @param mixed $dataType + * @param null|mixed $formatCode + * @param mixed $pointCount + * @param mixed $dataValues + * @param null|mixed $marker */ public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = [], $marker = null) { @@ -90,7 +97,7 @@ class DataSeriesValues } /** - * Get Series Data Type + * Get Series Data Type. * * @return string */ @@ -100,7 +107,7 @@ class DataSeriesValues } /** - * Set Series Data Type + * Set Series Data Type. * * @param string $dataType Datatype of this data series * Typical values are: @@ -108,7 +115,9 @@ class DataSeriesValues * Normally used for axis point values * \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues::DATASERIES_TYPE_NUMBER * Normally used for chart data values + * * @throws Exception + * * @return DataSeriesValues */ public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) @@ -122,7 +131,7 @@ class DataSeriesValues } /** - * Get Series Data Source (formula) + * Get Series Data Source (formula). * * @return string */ @@ -132,9 +141,11 @@ class DataSeriesValues } /** - * Set Series Data Source (formula) + * Set Series Data Source (formula). * * @param string $dataSource + * @param mixed $refreshDataValues + * * @return DataSeriesValues */ public function setDataSource($dataSource = null, $refreshDataValues = true) @@ -149,7 +160,7 @@ class DataSeriesValues } /** - * Get Point Marker + * Get Point Marker. * * @return string */ @@ -159,9 +170,10 @@ class DataSeriesValues } /** - * Set Point Marker + * Set Point Marker. * * @param string $marker + * * @return DataSeriesValues */ public function setPointMarker($marker = null) @@ -172,7 +184,7 @@ class DataSeriesValues } /** - * Get Series Format Code + * Get Series Format Code. * * @return string */ @@ -182,9 +194,10 @@ class DataSeriesValues } /** - * Set Series Format Code + * Set Series Format Code. * * @param string $formatCode + * * @return DataSeriesValues */ public function setFormatCode($formatCode = null) @@ -195,7 +208,7 @@ class DataSeriesValues } /** - * Get Series Point Count + * Get Series Point Count. * * @return int */ @@ -205,7 +218,7 @@ class DataSeriesValues } /** - * Identify if the Data Series is a multi-level or a simple series + * Identify if the Data Series is a multi-level or a simple series. * * @return bool|null */ @@ -219,7 +232,7 @@ class DataSeriesValues } /** - * Return the level count of a multi-level Data Series + * Return the level count of a multi-level Data Series. * * @return int */ @@ -234,7 +247,7 @@ class DataSeriesValues } /** - * Get Series Data Values + * Get Series Data Values. * * @return array of mixed */ @@ -244,7 +257,7 @@ class DataSeriesValues } /** - * Get the first Series Data value + * Get the first Series Data value. * * @return mixed */ @@ -261,12 +274,13 @@ class DataSeriesValues } /** - * Set Series Data Values + * Set Series Data Values. * * @param array $dataValues * @param bool $refreshDataSource * TRUE - refresh the value of dataSource based on the values of $dataValues * FALSE - don't change the value of dataSource + * * @return DataSeriesValues */ public function setDataValues($dataValues = [], $refreshDataSource = true) diff --git a/src/PhpSpreadsheet/Chart/Exception.php b/src/PhpSpreadsheet/Chart/Exception.php index 4c79d05b..8342a8c9 100644 --- a/src/PhpSpreadsheet/Chart/Exception.php +++ b/src/PhpSpreadsheet/Chart/Exception.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Exception extends \PhpOffice\PhpSpreadsheet\Exception { /** - * Error handler callback + * Error handler callback. * * @param mixed $code * @param mixed $string diff --git a/src/PhpSpreadsheet/Chart/GridLines.php b/src/PhpSpreadsheet/Chart/GridLines.php index 2cd5b203..875f1911 100644 --- a/src/PhpSpreadsheet/Chart/GridLines.php +++ b/src/PhpSpreadsheet/Chart/GridLines.php @@ -6,7 +6,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Created by PhpStorm. * User: Wiktor Trzonkowski * Date: 7/2/14 - * Time: 2:36 PM + * Time: 2:36 PM. */ class GridLines extends Properties { @@ -16,7 +16,7 @@ class GridLines extends Properties * Line Properties @var array of mixed * Shadow Properties @var array of mixed * Glow Properties @var array of mixed - * Soft Properties @var array of mixed + * Soft Properties @var array of mixed. */ private $objectState = false; @@ -79,7 +79,7 @@ class GridLines extends Properties ]; /** - * Get Object State + * Get Object State. * * @return bool */ @@ -89,7 +89,7 @@ class GridLines extends Properties } /** - * Change Object State to True + * Change Object State to True. * * @return GridLines */ @@ -101,7 +101,7 @@ class GridLines extends Properties } /** - * Set Line Color Properties + * Set Line Color Properties. * * @param string $value * @param int $alpha @@ -118,7 +118,7 @@ class GridLines extends Properties } /** - * Set Line Color Properties + * Set Line Color Properties. * * @param float $line_width * @param string $compound_type @@ -163,7 +163,7 @@ class GridLines extends Properties } /** - * Get Line Color Property + * Get Line Color Property. * * @param string $parameter * @@ -175,7 +175,7 @@ class GridLines extends Properties } /** - * Get Line Style Property + * Get Line Style Property. * * @param array|string $elements * @@ -187,7 +187,7 @@ class GridLines extends Properties } /** - * Set Glow Properties + * Set Glow Properties. * * @param float $size * @param string $color_value @@ -203,7 +203,7 @@ class GridLines extends Properties } /** - * Get Glow Color Property + * Get Glow Color Property. * * @param string $property * @@ -215,7 +215,7 @@ class GridLines extends Properties } /** - * Get Glow Size + * Get Glow Size. * * @return string */ @@ -225,7 +225,7 @@ class GridLines extends Properties } /** - * Set Glow Size + * Set Glow Size. * * @param float $size * @@ -239,7 +239,7 @@ class GridLines extends Properties } /** - * Set Glow Color + * Set Glow Color. * * @param string $color * @param int $alpha @@ -263,7 +263,7 @@ class GridLines extends Properties } /** - * Get Line Style Arrow Parameters + * Get Line Style Arrow Parameters. * * @param string $arrow_selector * @param string $property_selector @@ -276,7 +276,7 @@ class GridLines extends Properties } /** - * Set Shadow Properties + * Set Shadow Properties. * * @param int $sh_presets * @param string $sh_color_value @@ -301,7 +301,7 @@ class GridLines extends Properties } /** - * Set Shadow Presets Properties + * Set Shadow Presets Properties. * * @param int $shadow_presets * @@ -316,7 +316,7 @@ class GridLines extends Properties } /** - * Set Shadow Properties Values + * Set Shadow Properties Values. * * @param array $properties_map * @param * $reference @@ -347,11 +347,12 @@ class GridLines extends Properties } /** - * Set Shadow Color + * Set Shadow Color. * * @param string $color * @param int $alpha * @param string $type + * * @return GridLines */ private function setShadowColor($color, $alpha, $type) @@ -370,7 +371,7 @@ class GridLines extends Properties } /** - * Set Shadow Blur + * Set Shadow Blur. * * @param float $blur * @@ -386,9 +387,10 @@ class GridLines extends Properties } /** - * Set Shadow Angle + * Set Shadow Angle. * * @param int $angle + * * @return GridLines */ private function setShadowAngle($angle) @@ -401,9 +403,10 @@ class GridLines extends Properties } /** - * Set Shadow Distance + * Set Shadow Distance. * * @param float $distance + * * @return GridLines */ private function setShadowDistance($distance) @@ -416,10 +419,11 @@ class GridLines extends Properties } /** - * Get Shadow Property + * Get Shadow Property. * * @param string $elements * @param array $elements + * * @return string */ public function getShadowProperty($elements) @@ -428,7 +432,7 @@ class GridLines extends Properties } /** - * Set Soft Edges Size + * Set Soft Edges Size. * * @param float $size */ @@ -441,7 +445,7 @@ class GridLines extends Properties } /** - * Get Soft Edges Size + * Get Soft Edges Size. * * @return string */ diff --git a/src/PhpSpreadsheet/Chart/Layout.php b/src/PhpSpreadsheet/Chart/Layout.php index 340ac122..1080feda 100644 --- a/src/PhpSpreadsheet/Chart/Layout.php +++ b/src/PhpSpreadsheet/Chart/Layout.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,55 +20,56 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Layout { /** - * layoutTarget + * layoutTarget. * * @var string */ private $layoutTarget; /** - * X Mode + * X Mode. * * @var string */ private $xMode; /** - * Y Mode + * Y Mode. * * @var string */ private $yMode; /** - * X-Position + * X-Position. * * @var float */ private $xPos; /** - * Y-Position + * Y-Position. * * @var float */ private $yPos; /** - * width + * width. * * @var float */ private $width; /** - * height + * height. * * @var float */ @@ -76,7 +77,7 @@ class Layout /** * show legend key - * Specifies that legend keys should be shown in data labels + * Specifies that legend keys should be shown in data labels. * * @var bool */ @@ -115,7 +116,7 @@ class Layout private $showPercent; /** - * show bubble size + * show bubble size. * * @var bool */ @@ -130,7 +131,9 @@ class Layout private $showLeaderLines; /** - * Create a new Layout + * Create a new Layout. + * + * @param mixed $layout */ public function __construct($layout = []) { @@ -158,7 +161,7 @@ class Layout } /** - * Get Layout Target + * Get Layout Target. * * @return string */ @@ -168,10 +171,11 @@ class Layout } /** - * Set Layout Target + * Set Layout Target. * * @param Layout Target $value * @param string $value + * * @return Layout */ public function setLayoutTarget($value) @@ -182,7 +186,7 @@ class Layout } /** - * Get X-Mode + * Get X-Mode. * * @return string */ @@ -192,9 +196,10 @@ class Layout } /** - * Set X-Mode + * Set X-Mode. * * @param X-Mode $value + * * @return Layout */ public function setXMode($value) @@ -205,7 +210,7 @@ class Layout } /** - * Get Y-Mode + * Get Y-Mode. * * @return string */ @@ -215,9 +220,10 @@ class Layout } /** - * Set Y-Mode + * Set Y-Mode. * * @param Y-Mode $value + * * @return Layout */ public function setYMode($value) @@ -228,7 +234,7 @@ class Layout } /** - * Get X-Position + * Get X-Position. * * @return number */ @@ -238,9 +244,10 @@ class Layout } /** - * Set X-Position + * Set X-Position. * * @param X-Position $value + * * @return Layout */ public function setXPosition($value) @@ -251,7 +258,7 @@ class Layout } /** - * Get Y-Position + * Get Y-Position. * * @return number */ @@ -261,9 +268,10 @@ class Layout } /** - * Set Y-Position + * Set Y-Position. * * @param Y-Position $value + * * @return Layout */ public function setYPosition($value) @@ -274,7 +282,7 @@ class Layout } /** - * Get Width + * Get Width. * * @return number */ @@ -284,9 +292,10 @@ class Layout } /** - * Set Width + * Set Width. * * @param Width $value + * * @return Layout */ public function setWidth($value) @@ -297,7 +306,7 @@ class Layout } /** - * Get Height + * Get Height. * * @return number */ @@ -307,9 +316,10 @@ class Layout } /** - * Set Height + * Set Height. * * @param Height $value + * * @return Layout */ public function setHeight($value) @@ -320,7 +330,7 @@ class Layout } /** - * Get show legend key + * Get show legend key. * * @return bool */ @@ -334,6 +344,7 @@ class Layout * Specifies that legend keys should be shown in data labels. * * @param bool $value Show legend key + * * @return Layout */ public function setShowLegendKey($value) @@ -344,7 +355,7 @@ class Layout } /** - * Get show value + * Get show value. * * @return bool */ @@ -358,6 +369,7 @@ class Layout * Specifies that the value should be shown in data labels. * * @param bool $value Show val + * * @return Layout */ public function setShowVal($value) @@ -368,7 +380,7 @@ class Layout } /** - * Get show category name + * Get show category name. * * @return bool */ @@ -382,6 +394,7 @@ class Layout * Specifies that the category name should be shown in data labels. * * @param bool $value Show cat name + * * @return Layout */ public function setShowCatName($value) @@ -392,7 +405,7 @@ class Layout } /** - * Get show data series name + * Get show data series name. * * @return bool */ @@ -406,6 +419,7 @@ class Layout * Specifies that the series name should be shown in data labels. * * @param bool $value Show series name + * * @return Layout */ public function setShowSerName($value) @@ -416,7 +430,7 @@ class Layout } /** - * Get show percentage + * Get show percentage. * * @return bool */ @@ -430,6 +444,7 @@ class Layout * Specifies that the percentage should be shown in data labels. * * @param bool $value Show percentage + * * @return Layout */ public function setShowPercent($value) @@ -440,7 +455,7 @@ class Layout } /** - * Get show bubble size + * Get show bubble size. * * @return bool */ @@ -454,6 +469,7 @@ class Layout * Specifies that the bubble size should be shown in data labels. * * @param bool $value Show bubble size + * * @return Layout */ public function setShowBubbleSize($value) @@ -464,7 +480,7 @@ class Layout } /** - * Get show leader lines + * Get show leader lines. * * @return bool */ @@ -478,6 +494,7 @@ class Layout * Specifies that leader lines should be shown in data labels. * * @param bool $value Show leader lines + * * @return Layout */ public function setShowLeaderLines($value) diff --git a/src/PhpSpreadsheet/Chart/Legend.php b/src/PhpSpreadsheet/Chart/Legend.php index fe04b2b7..786a47fe 100644 --- a/src/PhpSpreadsheet/Chart/Legend.php +++ b/src/PhpSpreadsheet/Chart/Legend.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -49,7 +50,7 @@ class Legend ]; /** - * Legend position + * Legend position. * * @var string */ @@ -63,14 +64,17 @@ class Legend private $overlay = true; /** - * Legend Layout + * Legend Layout. * * @var Layout */ private $layout = null; /** - * Create a new Legend + * Create a new Legend. + * + * @param mixed $position + * @param mixed $overlay */ public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false) { @@ -80,7 +84,7 @@ class Legend } /** - * Get legend position as an excel string value + * Get legend position as an excel string value. * * @return string */ @@ -90,7 +94,7 @@ class Legend } /** - * Get legend position using an excel string value + * Get legend position using an excel string value. * * @param string $position */ @@ -106,7 +110,7 @@ class Legend } /** - * Get legend position as an Excel internal numeric value + * Get legend position as an Excel internal numeric value. * * @return number */ @@ -116,7 +120,7 @@ class Legend } /** - * Set legend position using an Excel internal numeric value + * Set legend position using an Excel internal numeric value. * * @param number $positionXL */ @@ -145,6 +149,7 @@ class Legend * Set allow overlay of other elements? * * @param bool $overlay + * * @return bool */ public function setOverlay($overlay = false) @@ -159,7 +164,7 @@ class Legend } /** - * Get Layout + * Get Layout. * * @return Layout */ diff --git a/src/PhpSpreadsheet/Chart/PlotArea.php b/src/PhpSpreadsheet/Chart/PlotArea.php index 7364a28b..1aed6bcd 100644 --- a/src/PhpSpreadsheet/Chart/PlotArea.php +++ b/src/PhpSpreadsheet/Chart/PlotArea.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,30 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class PlotArea { /** - * PlotArea Layout + * PlotArea Layout. * * @var Layout */ private $layout = null; /** - * Plot Series + * Plot Series. * * @var array of DataSeries */ private $plotSeries = []; /** - * Create a new PlotArea + * Create a new PlotArea. + * + * @param mixed $plotSeries */ public function __construct(Layout $layout = null, $plotSeries = []) { @@ -49,7 +52,7 @@ class PlotArea } /** - * Get Layout + * Get Layout. * * @return Layout */ @@ -59,7 +62,7 @@ class PlotArea } /** - * Get Number of Plot Groups + * Get Number of Plot Groups. * * @return array of DataSeries */ @@ -69,7 +72,7 @@ class PlotArea } /** - * Get Number of Plot Series + * Get Number of Plot Series. * * @return int */ @@ -84,7 +87,7 @@ class PlotArea } /** - * Get Plot Series + * Get Plot Series. * * @return array of DataSeries */ @@ -94,7 +97,9 @@ class PlotArea } /** - * Get Plot Series by Index + * Get Plot Series by Index. + * + * @param mixed $index * * @return DataSeries */ @@ -104,9 +109,11 @@ class PlotArea } /** - * Set Plot Series + * Set Plot Series. * * @param DataSeries[] + * @param mixed $plotSeries + * * @return PlotArea */ public function setPlotSeries($plotSeries = []) diff --git a/src/PhpSpreadsheet/Chart/Properties.php b/src/PhpSpreadsheet/Chart/Properties.php index 86d349f2..2a3c03d8 100644 --- a/src/PhpSpreadsheet/Chart/Properties.php +++ b/src/PhpSpreadsheet/Chart/Properties.php @@ -6,114 +6,109 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Created by PhpStorm. * User: nhw2h8s * Date: 7/2/14 - * Time: 5:45 PM + * Time: 5:45 PM. */ abstract class Properties { const - EXCEL_COLOR_TYPE_STANDARD = 'prstClr', - EXCEL_COLOR_TYPE_SCHEME = 'schemeClr', - EXCEL_COLOR_TYPE_ARGB = 'srgbClr'; + EXCEL_COLOR_TYPE_STANDARD = 'prstClr'; + const EXCEL_COLOR_TYPE_SCHEME = 'schemeClr'; + const EXCEL_COLOR_TYPE_ARGB = 'srgbClr'; const - AXIS_LABELS_LOW = 'low', - AXIS_LABELS_HIGH = 'high', - AXIS_LABELS_NEXT_TO = 'nextTo', - AXIS_LABELS_NONE = 'none'; + AXIS_LABELS_LOW = 'low'; + const AXIS_LABELS_HIGH = 'high'; + const AXIS_LABELS_NEXT_TO = 'nextTo'; + const AXIS_LABELS_NONE = 'none'; const - TICK_MARK_NONE = 'none', - TICK_MARK_INSIDE = 'in', - TICK_MARK_OUTSIDE = 'out', - TICK_MARK_CROSS = 'cross'; + TICK_MARK_NONE = 'none'; + const TICK_MARK_INSIDE = 'in'; + const TICK_MARK_OUTSIDE = 'out'; + const TICK_MARK_CROSS = 'cross'; const - HORIZONTAL_CROSSES_AUTOZERO = 'autoZero', - HORIZONTAL_CROSSES_MAXIMUM = 'max'; + HORIZONTAL_CROSSES_AUTOZERO = 'autoZero'; + const HORIZONTAL_CROSSES_MAXIMUM = 'max'; const - FORMAT_CODE_GENERAL = 'General', - FORMAT_CODE_NUMBER = '#,##0.00', - FORMAT_CODE_CURRENCY = '$#,##0.00', - FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)', - FORMAT_CODE_DATE = 'm/d/yyyy', - FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM', - FORMAT_CODE_PERCENTAGE = '0.00%', - FORMAT_CODE_FRACTION = '# ?/?', - FORMAT_CODE_SCIENTIFIC = '0.00E+00', - FORMAT_CODE_TEXT = '@', - FORMAT_CODE_SPECIAL = '00000'; + FORMAT_CODE_GENERAL = 'General'; + const FORMAT_CODE_NUMBER = '#,##0.00'; + const FORMAT_CODE_CURRENCY = '$#,##0.00'; + const FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'; + const FORMAT_CODE_DATE = 'm/d/yyyy'; + const FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM'; + const FORMAT_CODE_PERCENTAGE = '0.00%'; + const FORMAT_CODE_FRACTION = '# ?/?'; + const FORMAT_CODE_SCIENTIFIC = '0.00E+00'; + const FORMAT_CODE_TEXT = '@'; + const FORMAT_CODE_SPECIAL = '00000'; const - ORIENTATION_NORMAL = 'minMax', - ORIENTATION_REVERSED = 'maxMin'; + ORIENTATION_NORMAL = 'minMax'; + const ORIENTATION_REVERSED = 'maxMin'; const - LINE_STYLE_COMPOUND_SIMPLE = 'sng', - LINE_STYLE_COMPOUND_DOUBLE = 'dbl', - LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin', - LINE_STYLE_COMPOUND_THINTHICK = 'thinThick', - LINE_STYLE_COMPOUND_TRIPLE = 'tri', - - LINE_STYLE_DASH_SOLID = 'solid', - LINE_STYLE_DASH_ROUND_DOT = 'sysDot', - LINE_STYLE_DASH_SQUERE_DOT = 'sysDash', - LINE_STYPE_DASH_DASH = 'dash', - LINE_STYLE_DASH_DASH_DOT = 'dashDot', - LINE_STYLE_DASH_LONG_DASH = 'lgDash', - LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot', - LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot', - - LINE_STYLE_CAP_SQUARE = 'sq', - LINE_STYLE_CAP_ROUND = 'rnd', - LINE_STYLE_CAP_FLAT = 'flat', - - LINE_STYLE_JOIN_ROUND = 'bevel', - LINE_STYLE_JOIN_MITER = 'miter', - LINE_STYLE_JOIN_BEVEL = 'bevel', - - LINE_STYLE_ARROW_TYPE_NOARROW = null, - LINE_STYLE_ARROW_TYPE_ARROW = 'triangle', - LINE_STYLE_ARROW_TYPE_OPEN = 'arrow', - LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth', - LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond', - LINE_STYLE_ARROW_TYPE_OVAL = 'oval', - - LINE_STYLE_ARROW_SIZE_1 = 1, - LINE_STYLE_ARROW_SIZE_2 = 2, - LINE_STYLE_ARROW_SIZE_3 = 3, - LINE_STYLE_ARROW_SIZE_4 = 4, - LINE_STYLE_ARROW_SIZE_5 = 5, - LINE_STYLE_ARROW_SIZE_6 = 6, - LINE_STYLE_ARROW_SIZE_7 = 7, - LINE_STYLE_ARROW_SIZE_8 = 8, - LINE_STYLE_ARROW_SIZE_9 = 9; + LINE_STYLE_COMPOUND_SIMPLE = 'sng'; + const LINE_STYLE_COMPOUND_DOUBLE = 'dbl'; + const LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin'; + const LINE_STYLE_COMPOUND_THINTHICK = 'thinThick'; + const LINE_STYLE_COMPOUND_TRIPLE = 'tri'; + const LINE_STYLE_DASH_SOLID = 'solid'; + const LINE_STYLE_DASH_ROUND_DOT = 'sysDot'; + const LINE_STYLE_DASH_SQUERE_DOT = 'sysDash'; + const LINE_STYPE_DASH_DASH = 'dash'; + const LINE_STYLE_DASH_DASH_DOT = 'dashDot'; + const LINE_STYLE_DASH_LONG_DASH = 'lgDash'; + const LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot'; + const LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot'; + const LINE_STYLE_CAP_SQUARE = 'sq'; + const LINE_STYLE_CAP_ROUND = 'rnd'; + const LINE_STYLE_CAP_FLAT = 'flat'; + const LINE_STYLE_JOIN_ROUND = 'bevel'; + const LINE_STYLE_JOIN_MITER = 'miter'; + const LINE_STYLE_JOIN_BEVEL = 'bevel'; + const LINE_STYLE_ARROW_TYPE_NOARROW = null; + const LINE_STYLE_ARROW_TYPE_ARROW = 'triangle'; + const LINE_STYLE_ARROW_TYPE_OPEN = 'arrow'; + const LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth'; + const LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond'; + const LINE_STYLE_ARROW_TYPE_OVAL = 'oval'; + const LINE_STYLE_ARROW_SIZE_1 = 1; + const LINE_STYLE_ARROW_SIZE_2 = 2; + const LINE_STYLE_ARROW_SIZE_3 = 3; + const LINE_STYLE_ARROW_SIZE_4 = 4; + const LINE_STYLE_ARROW_SIZE_5 = 5; + const LINE_STYLE_ARROW_SIZE_6 = 6; + const LINE_STYLE_ARROW_SIZE_7 = 7; + const LINE_STYLE_ARROW_SIZE_8 = 8; + const LINE_STYLE_ARROW_SIZE_9 = 9; const - SHADOW_PRESETS_NOSHADOW = null, - SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1, - SHADOW_PRESETS_OUTER_BOTTOM = 2, - SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3, - SHADOW_PRESETS_OUTER_RIGHT = 4, - SHADOW_PRESETS_OUTER_CENTER = 5, - SHADOW_PRESETS_OUTER_LEFT = 6, - SHADOW_PRESETS_OUTER_TOP_RIGHT = 7, - SHADOW_PRESETS_OUTER_TOP = 8, - SHADOW_PRESETS_OUTER_TOP_LEFT = 9, - SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10, - SHADOW_PRESETS_INNER_BOTTOM = 11, - SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12, - SHADOW_PRESETS_INNER_RIGHT = 13, - SHADOW_PRESETS_INNER_CENTER = 14, - SHADOW_PRESETS_INNER_LEFT = 15, - SHADOW_PRESETS_INNER_TOP_RIGHT = 16, - SHADOW_PRESETS_INNER_TOP = 17, - SHADOW_PRESETS_INNER_TOP_LEFT = 18, - SHADOW_PRESETS_PERSPECTIVE_BELOW = 19, - SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20, - SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21, - SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22, - SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23; + SHADOW_PRESETS_NOSHADOW = null; + const SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1; + const SHADOW_PRESETS_OUTER_BOTTOM = 2; + const SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3; + const SHADOW_PRESETS_OUTER_RIGHT = 4; + const SHADOW_PRESETS_OUTER_CENTER = 5; + const SHADOW_PRESETS_OUTER_LEFT = 6; + const SHADOW_PRESETS_OUTER_TOP_RIGHT = 7; + const SHADOW_PRESETS_OUTER_TOP = 8; + const SHADOW_PRESETS_OUTER_TOP_LEFT = 9; + const SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10; + const SHADOW_PRESETS_INNER_BOTTOM = 11; + const SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12; + const SHADOW_PRESETS_INNER_RIGHT = 13; + const SHADOW_PRESETS_INNER_CENTER = 14; + const SHADOW_PRESETS_INNER_LEFT = 15; + const SHADOW_PRESETS_INNER_TOP_RIGHT = 16; + const SHADOW_PRESETS_INNER_TOP = 17; + const SHADOW_PRESETS_INNER_TOP_LEFT = 18; + const SHADOW_PRESETS_PERSPECTIVE_BELOW = 19; + const SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20; + const SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21; + const SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22; + const SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23; /** * @param float $width @@ -359,14 +354,12 @@ abstract class Properties $reference = &$properties; if (!is_array($elements)) { return $reference[$elements]; - } else { - foreach ($elements as $keys) { - $reference = &$reference[$keys]; - } - - return $reference; + } + foreach ($elements as $keys) { + $reference = &$reference[$keys]; } + return $reference; return $this; } } diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index ca97ea45..ec6e06b5 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -845,7 +846,7 @@ class JpGraph } /** - * Create a new jpgraph + * Create a new jpgraph. */ public function __construct(\PhpOffice\PhpSpreadsheet\Chart $chart) { diff --git a/src/PhpSpreadsheet/Chart/Title.php b/src/PhpSpreadsheet/Chart/Title.php index 9e2924b5..ba63fe02 100644 --- a/src/PhpSpreadsheet/Chart/Title.php +++ b/src/PhpSpreadsheet/Chart/Title.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Chart; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,30 @@ namespace PhpOffice\PhpSpreadsheet\Chart; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Title { /** - * Title Caption + * Title Caption. * * @var string */ private $caption = null; /** - * Title Layout + * Title Layout. * * @var Layout */ private $layout = null; /** - * Create a new Title + * Create a new Title. + * + * @param null|mixed $caption */ public function __construct($caption = null, Layout $layout = null) { @@ -49,7 +52,7 @@ class Title } /** - * Get caption + * Get caption. * * @return string */ @@ -59,9 +62,10 @@ class Title } /** - * Set caption + * Set caption. * * @param string $caption + * * @return Title */ public function setCaption($caption = null) @@ -72,7 +76,7 @@ class Title } /** - * Get Layout + * Get Layout. * * @return Layout */ diff --git a/src/PhpSpreadsheet/Comment.php b/src/PhpSpreadsheet/Comment.php index 37d7d638..4871d454 100644 --- a/src/PhpSpreadsheet/Comment.php +++ b/src/PhpSpreadsheet/Comment.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,76 +20,77 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Comment implements IComparable { /** - * Author + * Author. * * @var string */ private $author; /** - * Rich text comment + * Rich text comment. * * @var RichText */ private $text; /** - * Comment width (CSS style, i.e. XXpx or YYpt) + * Comment width (CSS style, i.e. XXpx or YYpt). * * @var string */ private $width = '96pt'; /** - * Left margin (CSS style, i.e. XXpx or YYpt) + * Left margin (CSS style, i.e. XXpx or YYpt). * * @var string */ private $marginLeft = '59.25pt'; /** - * Top margin (CSS style, i.e. XXpx or YYpt) + * Top margin (CSS style, i.e. XXpx or YYpt). * * @var string */ private $marginTop = '1.5pt'; /** - * Visible + * Visible. * * @var bool */ private $visible = false; /** - * Comment height (CSS style, i.e. XXpx or YYpt) + * Comment height (CSS style, i.e. XXpx or YYpt). * * @var string */ private $height = '55.5pt'; /** - * Comment fill color + * Comment fill color. * * @var Style\Color */ private $fillColor; /** - * Alignment + * Alignment. * * @var string */ private $alignment; /** - * Create a new Comment + * Create a new Comment. * * @throws Exception */ @@ -103,7 +104,7 @@ class Comment implements IComparable } /** - * Get Author + * Get Author. * * @return string */ @@ -113,9 +114,10 @@ class Comment implements IComparable } /** - * Set Author + * Set Author. * * @param string $pValue + * * @return Comment */ public function setAuthor($pValue = '') @@ -126,7 +128,7 @@ class Comment implements IComparable } /** - * Get Rich text comment + * Get Rich text comment. * * @return RichText */ @@ -136,9 +138,10 @@ class Comment implements IComparable } /** - * Set Rich text comment + * Set Rich text comment. * * @param RichText $pValue + * * @return Comment */ public function setText(RichText $pValue) @@ -149,7 +152,7 @@ class Comment implements IComparable } /** - * Get comment width (CSS style, i.e. XXpx or YYpt) + * Get comment width (CSS style, i.e. XXpx or YYpt). * * @return string */ @@ -159,9 +162,10 @@ class Comment implements IComparable } /** - * Set comment width (CSS style, i.e. XXpx or YYpt) + * Set comment width (CSS style, i.e. XXpx or YYpt). * * @param string $value + * * @return Comment */ public function setWidth($value = '96pt') @@ -172,7 +176,7 @@ class Comment implements IComparable } /** - * Get comment height (CSS style, i.e. XXpx or YYpt) + * Get comment height (CSS style, i.e. XXpx or YYpt). * * @return string */ @@ -182,9 +186,10 @@ class Comment implements IComparable } /** - * Set comment height (CSS style, i.e. XXpx or YYpt) + * Set comment height (CSS style, i.e. XXpx or YYpt). * * @param string $value + * * @return Comment */ public function setHeight($value = '55.5pt') @@ -195,7 +200,7 @@ class Comment implements IComparable } /** - * Get left margin (CSS style, i.e. XXpx or YYpt) + * Get left margin (CSS style, i.e. XXpx or YYpt). * * @return string */ @@ -205,9 +210,10 @@ class Comment implements IComparable } /** - * Set left margin (CSS style, i.e. XXpx or YYpt) + * Set left margin (CSS style, i.e. XXpx or YYpt). * * @param string $value + * * @return Comment */ public function setMarginLeft($value = '59.25pt') @@ -218,7 +224,7 @@ class Comment implements IComparable } /** - * Get top margin (CSS style, i.e. XXpx or YYpt) + * Get top margin (CSS style, i.e. XXpx or YYpt). * * @return string */ @@ -228,9 +234,10 @@ class Comment implements IComparable } /** - * Set top margin (CSS style, i.e. XXpx or YYpt) + * Set top margin (CSS style, i.e. XXpx or YYpt). * * @param string $value + * * @return Comment */ public function setMarginTop($value = '1.5pt') @@ -251,9 +258,10 @@ class Comment implements IComparable } /** - * Set comment default visibility + * Set comment default visibility. * * @param bool $value + * * @return Comment */ public function setVisible($value = false) @@ -264,7 +272,7 @@ class Comment implements IComparable } /** - * Get fill color + * Get fill color. * * @return Style\Color */ @@ -274,9 +282,10 @@ class Comment implements IComparable } /** - * Set Alignment + * Set Alignment. * * @param string $pValue + * * @return Comment */ public function setAlignment($pValue = Style\Alignment::HORIZONTAL_GENERAL) @@ -287,7 +296,7 @@ class Comment implements IComparable } /** - * Get Alignment + * Get Alignment. * * @return string */ @@ -297,7 +306,7 @@ class Comment implements IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ @@ -333,7 +342,7 @@ class Comment implements IComparable } /** - * Convert to string + * Convert to string. * * @return string */ diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 2c5f088e..edd51c93 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Document; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Document; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -34,91 +35,91 @@ class Properties const PROPERTY_TYPE_UNKNOWN = 'u'; /** - * Creator + * Creator. * * @var string */ private $creator = 'Unknown Creator'; /** - * LastModifiedBy + * LastModifiedBy. * * @var string */ private $lastModifiedBy; /** - * Created + * Created. * * @var int */ private $created; /** - * Modified + * Modified. * * @var int */ private $modified; /** - * Title + * Title. * * @var string */ private $title = 'Untitled Spreadsheet'; /** - * Description + * Description. * * @var string */ private $description = ''; /** - * Subject + * Subject. * * @var string */ private $subject = ''; /** - * Keywords + * Keywords. * * @var string */ private $keywords = ''; /** - * Category + * Category. * * @var string */ private $category = ''; /** - * Manager + * Manager. * * @var string */ private $manager = ''; /** - * Company + * Company. * * @var string */ private $company = 'Microsoft Corporation'; /** - * Custom Properties + * Custom Properties. * * @var string */ private $customProperties = []; /** - * Create a new Document Properties instance + * Create a new Document Properties instance. */ public function __construct() { @@ -129,7 +130,7 @@ class Properties } /** - * Get Creator + * Get Creator. * * @return string */ @@ -139,9 +140,10 @@ class Properties } /** - * Set Creator + * Set Creator. * * @param string $pValue + * * @return Properties */ public function setCreator($pValue = '') @@ -152,7 +154,7 @@ class Properties } /** - * Get Last Modified By + * Get Last Modified By. * * @return string */ @@ -162,9 +164,10 @@ class Properties } /** - * Set Last Modified By + * Set Last Modified By. * * @param string $pValue + * * @return Properties */ public function setLastModifiedBy($pValue = '') @@ -175,7 +178,7 @@ class Properties } /** - * Get Created + * Get Created. * * @return int */ @@ -185,9 +188,10 @@ class Properties } /** - * Set Created + * Set Created. * * @param datetime $pValue + * * @return Properties */ public function setCreated($pValue = null) @@ -196,7 +200,7 @@ class Properties $pValue = time(); } elseif (is_string($pValue)) { if (is_numeric($pValue)) { - $pValue = intval($pValue); + $pValue = (int) $pValue; } else { $pValue = strtotime($pValue); } @@ -208,7 +212,7 @@ class Properties } /** - * Get Modified + * Get Modified. * * @return int */ @@ -218,9 +222,10 @@ class Properties } /** - * Set Modified + * Set Modified. * * @param datetime $pValue + * * @return Properties */ public function setModified($pValue = null) @@ -229,7 +234,7 @@ class Properties $pValue = time(); } elseif (is_string($pValue)) { if (is_numeric($pValue)) { - $pValue = intval($pValue); + $pValue = (int) $pValue; } else { $pValue = strtotime($pValue); } @@ -241,7 +246,7 @@ class Properties } /** - * Get Title + * Get Title. * * @return string */ @@ -251,9 +256,10 @@ class Properties } /** - * Set Title + * Set Title. * * @param string $pValue + * * @return Properties */ public function setTitle($pValue = '') @@ -264,7 +270,7 @@ class Properties } /** - * Get Description + * Get Description. * * @return string */ @@ -274,9 +280,10 @@ class Properties } /** - * Set Description + * Set Description. * * @param string $pValue + * * @return Properties */ public function setDescription($pValue = '') @@ -287,7 +294,7 @@ class Properties } /** - * Get Subject + * Get Subject. * * @return string */ @@ -297,9 +304,10 @@ class Properties } /** - * Set Subject + * Set Subject. * * @param string $pValue + * * @return Properties */ public function setSubject($pValue = '') @@ -310,7 +318,7 @@ class Properties } /** - * Get Keywords + * Get Keywords. * * @return string */ @@ -320,9 +328,10 @@ class Properties } /** - * Set Keywords + * Set Keywords. * * @param string $pValue + * * @return Properties */ public function setKeywords($pValue = '') @@ -333,7 +342,7 @@ class Properties } /** - * Get Category + * Get Category. * * @return string */ @@ -343,9 +352,10 @@ class Properties } /** - * Set Category + * Set Category. * * @param string $pValue + * * @return Properties */ public function setCategory($pValue = '') @@ -356,7 +366,7 @@ class Properties } /** - * Get Company + * Get Company. * * @return string */ @@ -366,9 +376,10 @@ class Properties } /** - * Set Company + * Set Company. * * @param string $pValue + * * @return Properties */ public function setCompany($pValue = '') @@ -379,7 +390,7 @@ class Properties } /** - * Get Manager + * Get Manager. * * @return string */ @@ -389,9 +400,10 @@ class Properties } /** - * Set Manager + * Set Manager. * * @param string $pValue + * * @return Properties */ public function setManager($pValue = '') @@ -402,7 +414,7 @@ class Properties } /** - * Get a List of Custom Property Names + * Get a List of Custom Property Names. * * @return array of string */ @@ -412,9 +424,10 @@ class Properties } /** - * Check if a Custom Property is defined + * Check if a Custom Property is defined. * * @param string $propertyName + * * @return bool */ public function isCustomPropertySet($propertyName) @@ -423,9 +436,10 @@ class Properties } /** - * Get a Custom Property Value + * Get a Custom Property Value. * * @param string $propertyName + * * @return string */ public function getCustomPropertyValue($propertyName) @@ -436,9 +450,10 @@ class Properties } /** - * Get a Custom Property Type + * Get a Custom Property Type. * * @param string $propertyName + * * @return string */ public function getCustomPropertyType($propertyName) @@ -449,7 +464,7 @@ class Properties } /** - * Set a Custom Property + * Set a Custom Property. * * @param string $propertyName * @param mixed $propertyValue @@ -459,6 +474,7 @@ class Properties * 's' : String * 'd' : Date/Time * 'b' : Boolean + * * @return Properties */ public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null) diff --git a/src/PhpSpreadsheet/Document/Security.php b/src/PhpSpreadsheet/Document/Security.php index 289b84ad..86ce6cd7 100644 --- a/src/PhpSpreadsheet/Document/Security.php +++ b/src/PhpSpreadsheet/Document/Security.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Document; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,48 +20,49 @@ namespace PhpOffice\PhpSpreadsheet\Document; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Security { /** - * LockRevision + * LockRevision. * * @var bool */ private $lockRevision = false; /** - * LockStructure + * LockStructure. * * @var bool */ private $lockStructure = false; /** - * LockWindows + * LockWindows. * * @var bool */ private $lockWindows = false; /** - * RevisionsPassword + * RevisionsPassword. * * @var string */ private $revisionsPassword = ''; /** - * WorkbookPassword + * WorkbookPassword. * * @var string */ private $workbookPassword = ''; /** - * Create a new Document Security instance + * Create a new Document Security instance. */ public function __construct() { @@ -80,7 +81,7 @@ class Security } /** - * Get LockRevision + * Get LockRevision. * * @return bool */ @@ -90,9 +91,10 @@ class Security } /** - * Set LockRevision + * Set LockRevision. * * @param bool $pValue + * * @return Security */ public function setLockRevision($pValue = false) @@ -103,7 +105,7 @@ class Security } /** - * Get LockStructure + * Get LockStructure. * * @return bool */ @@ -113,9 +115,10 @@ class Security } /** - * Set LockStructure + * Set LockStructure. * * @param bool $pValue + * * @return Security */ public function setLockStructure($pValue = false) @@ -126,7 +129,7 @@ class Security } /** - * Get LockWindows + * Get LockWindows. * * @return bool */ @@ -136,9 +139,10 @@ class Security } /** - * Set LockWindows + * Set LockWindows. * * @param bool $pValue + * * @return Security */ public function setLockWindows($pValue = false) @@ -149,7 +153,7 @@ class Security } /** - * Get RevisionsPassword (hashed) + * Get RevisionsPassword (hashed). * * @return string */ @@ -159,10 +163,11 @@ class Security } /** - * Set RevisionsPassword + * Set RevisionsPassword. * * @param string $pValue * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * * @return Security */ public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) @@ -176,7 +181,7 @@ class Security } /** - * Get WorkbookPassword (hashed) + * Get WorkbookPassword (hashed). * * @return string */ @@ -186,10 +191,11 @@ class Security } /** - * Set WorkbookPassword + * Set WorkbookPassword. * * @param string $pValue * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * * @return Security */ public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) diff --git a/src/PhpSpreadsheet/Exception.php b/src/PhpSpreadsheet/Exception.php index 611c1c58..4ec48986 100644 --- a/src/PhpSpreadsheet/Exception.php +++ b/src/PhpSpreadsheet/Exception.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Exception extends \Exception { /** - * Error handler callback + * Error handler callback. * * @param mixed $code * @param mixed $string diff --git a/src/PhpSpreadsheet/HashTable.php b/src/PhpSpreadsheet/HashTable.php index 6e6695ff..f7a7b0a4 100644 --- a/src/PhpSpreadsheet/HashTable.php +++ b/src/PhpSpreadsheet/HashTable.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,29 +20,31 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class HashTable { /** - * HashTable elements + * HashTable elements. * * @var mixed[] */ protected $items = []; /** - * HashTable key map + * HashTable key map. * * @var mixed[] */ protected $keyMap = []; /** - * Create a new \PhpOffice\PhpSpreadsheet\HashTable + * Create a new \PhpOffice\PhpSpreadsheet\HashTable. * * @param IComparable[] $pSource Optional source array to create HashTable from + * * @throws Exception */ public function __construct($pSource = null) @@ -54,9 +56,10 @@ class HashTable } /** - * Add HashTable items from source + * Add HashTable items from source. * * @param IComparable[] $pSource Source array to create HashTable from + * * @throws Exception */ public function addFromSource($pSource = null) @@ -74,9 +77,10 @@ class HashTable } /** - * Add HashTable item + * Add HashTable item. * * @param IComparable $pSource Item to add + * * @throws Exception */ public function add(IComparable $pSource = null) @@ -89,9 +93,10 @@ class HashTable } /** - * Remove HashTable item + * Remove HashTable item. * * @param IComparable $pSource Item to remove + * * @throws Exception */ public function remove(IComparable $pSource = null) @@ -115,7 +120,7 @@ class HashTable } /** - * Clear HashTable + * Clear HashTable. */ public function clear() { @@ -124,7 +129,7 @@ class HashTable } /** - * Count + * Count. * * @return int */ @@ -134,9 +139,10 @@ class HashTable } /** - * Get index for hash code + * Get index for hash code. * * @param string $pHashCode + * * @return int Index */ public function getIndexForHashCode($pHashCode = '') @@ -145,9 +151,10 @@ class HashTable } /** - * Get by index + * Get by index. * * @param int $pIndex + * * @return IComparable */ public function getByIndex($pIndex = 0) @@ -160,9 +167,10 @@ class HashTable } /** - * Get by hashcode + * Get by hashcode. * * @param string $pHashCode + * * @return IComparable */ public function getByHashCode($pHashCode = '') @@ -175,7 +183,7 @@ class HashTable } /** - * HashTable to array + * HashTable to array. * * @return IComparable[] */ diff --git a/src/PhpSpreadsheet/Helper/HTML.php b/src/PhpSpreadsheet/Helper/HTML.php index 676f888d..dfb4acba 100644 --- a/src/PhpSpreadsheet/Helper/HTML.php +++ b/src/PhpSpreadsheet/Helper/HTML.php @@ -8,7 +8,7 @@ use DOMNode; use DOMText; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,7 @@ use DOMText; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ diff --git a/src/PhpSpreadsheet/Helper/Migrator.php b/src/PhpSpreadsheet/Helper/Migrator.php index 5fe0f4d5..a90e5980 100644 --- a/src/PhpSpreadsheet/Helper/Migrator.php +++ b/src/PhpSpreadsheet/Helper/Migrator.php @@ -5,7 +5,8 @@ namespace PhpOffice\PhpSpreadsheet\Helper; class Migrator { /** - * Return the ordered mapping from old PHPExcel class names to new PhpSpreadsheet one + * Return the ordered mapping from old PHPExcel class names to new PhpSpreadsheet one. + * * @return string[] */ public function getMapping() @@ -231,7 +232,8 @@ class Migrator } /** - * Search in all files in given directory + * Search in all files in given directory. + * * @param string $path */ private function recursiveReplace($path) diff --git a/src/PhpSpreadsheet/Helper/Sample.php b/src/PhpSpreadsheet/Helper/Sample.php index 1fe7f4ae..22b5079f 100644 --- a/src/PhpSpreadsheet/Helper/Sample.php +++ b/src/PhpSpreadsheet/Helper/Sample.php @@ -8,7 +8,8 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; class Sample { /** - * Returns wether we run on CLI or browser + * Returns wether we run on CLI or browser. + * * @return bool */ public function isCli() @@ -17,7 +18,8 @@ class Sample } /** - * Return the filename currently being executed + * Return the filename currently being executed. + * * @return string */ public function getScriptFilename() @@ -26,7 +28,8 @@ class Sample } /** - * Wether we are executing the index page + * Wether we are executing the index page. + * * @return bool */ public function isIndex() @@ -35,7 +38,8 @@ class Sample } /** - * Return the page title + * Return the page title. + * * @return string */ public function getPageTitle() @@ -44,7 +48,8 @@ class Sample } /** - * Return the page heading + * Return the page heading. + * * @return string */ public function getPageHeading() @@ -53,7 +58,8 @@ class Sample } /** - * Returns an array of all known samples + * Returns an array of all known samples. + * * @return string[] [$name => $path] */ public function getSamples() @@ -72,7 +78,7 @@ class Sample } /** - * Write documents + * Write documents. * * @param Spreadsheet $spreadsheet * @param string $filename @@ -100,7 +106,8 @@ class Sample } /** - * Returns the temporary directory and make sure it exists + * Returns the temporary directory and make sure it exists. + * * @return string */ private function getTemporaryFolder() @@ -114,9 +121,11 @@ class Sample } /** - * Returns the filename that should be used for sample output + * Returns the filename that should be used for sample output. + * * @param string $filename * @param string $extension + * * @return string */ public function getFilename($filename, $extension = 'xlsx') @@ -125,8 +134,10 @@ class Sample } /** - * Return a random temporary file name + * Return a random temporary file name. + * * @param string $extension + * * @return string */ public function getTemporaryFilename($extension = 'xlsx') @@ -143,7 +154,7 @@ class Sample } /** - * Log ending notes + * Log ending notes. */ public function logEndingNotes() { @@ -152,7 +163,8 @@ class Sample } /** - * Log a line about the write operation + * Log a line about the write operation. + * * @param \PhpOffice\PhpSpreadsheet\Writer\IWriter $writer * @param string $path * @param float $callStartTime @@ -169,7 +181,8 @@ class Sample } /** - * Log a line about the read operation + * Log a line about the read operation. + * * @param string $format * @param string $path * @param float $callStartTime diff --git a/src/PhpSpreadsheet/IComparable.php b/src/PhpSpreadsheet/IComparable.php index 18b08809..edefe868 100644 --- a/src/PhpSpreadsheet/IComparable.php +++ b/src/PhpSpreadsheet/IComparable.php @@ -18,13 +18,14 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ interface IComparable { /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index 34019a12..58f3d8ac 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet; use PhpOffice\PhpSpreadsheet\Shared\File; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,13 +22,14 @@ use PhpOffice\PhpSpreadsheet\Shared\File; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class IOFactory { /** - * Search locations + * Search locations. * * @var array * @static @@ -39,7 +40,7 @@ class IOFactory ]; /** - * Autoresolve classes + * Autoresolve classes. * * @var array * @static @@ -56,16 +57,17 @@ class IOFactory ]; /** - * Private constructor for IOFactory + * Private constructor for IOFactory. */ private function __construct() { } /** - * Get search locations + * Get search locations. * * @static + * * @return array */ public static function getSearchLocations() @@ -74,10 +76,12 @@ class IOFactory } /** - * Set search locations + * Set search locations. * * @static + * * @param array $value + * * @throws Reader\Exception */ public static function setSearchLocations($value) @@ -90,9 +94,10 @@ class IOFactory } /** - * Add search location + * Add search location. * * @static + * * @param string $type Example: IWriter * @param string $location Example: PhpSpreadsheet/Writer/{0}.php * @param string $classname Example: Writer\{0} @@ -103,12 +108,15 @@ class IOFactory } /** - * Create Writer\IWriter + * Create Writer\IWriter. * * @static + * * @param Spreadsheet $spreadsheet * @param string $writerType Example: Xlsx + * * @throws Writer\Exception + * * @return Writer\IWriter */ public static function createWriter(Spreadsheet $spreadsheet, $writerType = '') @@ -133,11 +141,14 @@ class IOFactory } /** - * Create Reader\IReader + * Create Reader\IReader. * * @static + * * @param string $readerType Example: Xlsx + * * @throws Reader\Exception + * * @return Reader\IReader */ public static function createReader($readerType = '') @@ -162,11 +173,14 @@ class IOFactory } /** - * Loads Spreadsheet from file using automatic Reader\IReader resolution + * Loads Spreadsheet from file using automatic Reader\IReader resolution. * * @static + * * @param string $pFilename The name of the spreadsheet file + * * @throws Reader\Exception + * * @return Spreadsheet */ public static function load($pFilename) @@ -177,11 +191,14 @@ class IOFactory } /** - * Identify file type using automatic Reader\IReader resolution + * Identify file type using automatic Reader\IReader resolution. * * @static + * * @param string $pFilename The name of the spreadsheet file to identify + * * @throws Reader\Exception + * * @return string */ public static function identify($pFilename) @@ -195,11 +212,14 @@ class IOFactory } /** - * Create Reader\IReader for file using automatic Reader\IReader resolution + * Create Reader\IReader for file using automatic Reader\IReader resolution. * * @static + * * @param string $pFilename The name of the spreadsheet file + * * @throws Reader\Exception + * * @return Reader\IReader */ public static function createReaderForFile($pFilename) diff --git a/src/PhpSpreadsheet/NamedRange.php b/src/PhpSpreadsheet/NamedRange.php index 46898dbb..607ddc9b 100644 --- a/src/PhpSpreadsheet/NamedRange.php +++ b/src/PhpSpreadsheet/NamedRange.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,54 +20,56 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class NamedRange { /** - * Range name + * Range name. * * @var string */ private $name; /** - * Worksheet on which the named range can be resolved + * Worksheet on which the named range can be resolved. * * @var Worksheet */ private $worksheet; /** - * Range of the referenced cells + * Range of the referenced cells. * * @var string */ private $range; /** - * Is the named range local? (i.e. can only be used on $this->worksheet) + * Is the named range local? (i.e. can only be used on $this->worksheet). * * @var bool */ private $localOnly; /** - * Scope + * Scope. * * @var Worksheet */ private $scope; /** - * Create a new NamedRange + * Create a new NamedRange. * * @param string $pName * @param Worksheet $pWorksheet * @param string $pRange * @param bool $pLocalOnly * @param Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. + * * @throws Exception */ public function __construct($pName, Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) @@ -86,7 +88,7 @@ class NamedRange } /** - * Get name + * Get name. * * @return string */ @@ -96,9 +98,10 @@ class NamedRange } /** - * Set name + * Set name. * * @param string $value + * * @return NamedRange */ public function setName($value = null) @@ -126,7 +129,7 @@ class NamedRange } /** - * Get worksheet + * Get worksheet. * * @return Worksheet */ @@ -136,9 +139,10 @@ class NamedRange } /** - * Set worksheet + * Set worksheet. * * @param Worksheet $value + * * @return NamedRange */ public function setWorksheet(Worksheet $value = null) @@ -151,7 +155,7 @@ class NamedRange } /** - * Get range + * Get range. * * @return string */ @@ -161,9 +165,10 @@ class NamedRange } /** - * Set range + * Set range. * * @param string $value + * * @return NamedRange */ public function setRange($value = null) @@ -176,7 +181,7 @@ class NamedRange } /** - * Get localOnly + * Get localOnly. * * @return bool */ @@ -186,9 +191,10 @@ class NamedRange } /** - * Set localOnly + * Set localOnly. * * @param bool $value + * * @return NamedRange */ public function setLocalOnly($value = false) @@ -200,7 +206,7 @@ class NamedRange } /** - * Get scope + * Get scope. * * @return Worksheet|null */ @@ -210,9 +216,10 @@ class NamedRange } /** - * Set scope + * Set scope. * * @param Worksheet|null $value + * * @return NamedRange */ public function setScope(Worksheet $value = null) @@ -224,10 +231,11 @@ class NamedRange } /** - * Resolve a named range to a regular cell range + * Resolve a named range to a regular cell range. * * @param string $pNamedRange Named range * @param Worksheet|null $pSheet Scope. Use null for global scope + * * @return NamedRange */ public static function resolveRange($pNamedRange, Worksheet $pSheet = null) diff --git a/src/PhpSpreadsheet/Reader/BaseReader.php b/src/PhpSpreadsheet/Reader/BaseReader.php index 61e796c7..587cc1e0 100644 --- a/src/PhpSpreadsheet/Reader/BaseReader.php +++ b/src/PhpSpreadsheet/Reader/BaseReader.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; use PhpOffice\PhpSpreadsheet\Shared\File; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,6 +22,7 @@ use PhpOffice\PhpSpreadsheet\Shared\File; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -30,7 +31,7 @@ abstract class BaseReader implements IReader /** * Read data only? * Identifies whether the Reader should only read data values for cells, and ignore any formatting information; - * or whether it should read both data and formatting + * or whether it should read both data and formatting. * * @var bool */ @@ -39,7 +40,7 @@ abstract class BaseReader implements IReader /** * Read empty cells? * Identifies whether the Reader should read data values for cells all cells, or should ignore cells containing - * null value or empty string + * null value or empty string. * * @var bool */ @@ -47,7 +48,7 @@ abstract class BaseReader implements IReader /** * Read charts that are defined in the workbook? - * Identifies whether the Reader should read the definitions for any charts that exist in the workbook; + * Identifies whether the Reader should read the definitions for any charts that exist in the workbook;. * * @var bool */ @@ -62,7 +63,7 @@ abstract class BaseReader implements IReader protected $loadSheetsOnly; /** - * IReadFilter instance + * IReadFilter instance. * * @var IReadFilter */ @@ -93,7 +94,7 @@ abstract class BaseReader implements IReader */ public function setReadDataOnly($pValue = false) { - $this->readDataOnly = (boolean) $pValue; + $this->readDataOnly = (bool) $pValue; return $this; } @@ -121,7 +122,7 @@ abstract class BaseReader implements IReader */ public function setReadEmptyCells($pValue = true) { - $this->readEmptyCells = (boolean) $pValue; + $this->readEmptyCells = (bool) $pValue; return $this; } @@ -151,7 +152,7 @@ abstract class BaseReader implements IReader */ public function setIncludeCharts($pValue = false) { - $this->includeCharts = (boolean) $pValue; + $this->includeCharts = (bool) $pValue; return $this; } @@ -169,7 +170,7 @@ abstract class BaseReader implements IReader } /** - * Set which sheets to load + * Set which sheets to load. * * @param mixed $value * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. @@ -202,7 +203,7 @@ abstract class BaseReader implements IReader } /** - * Read filter + * Read filter. * * @return IReadFilter */ @@ -212,9 +213,10 @@ abstract class BaseReader implements IReader } /** - * Set read filter + * Set read filter. * * @param IReadFilter $pValue + * * @return IReader */ public function setReadFilter(IReadFilter $pValue) @@ -225,10 +227,12 @@ abstract class BaseReader implements IReader } /** - * Open file for reading + * Open file for reading. * * @param string $pFilename + * * @throws Exception + * * @return resource */ protected function openFile($pFilename) @@ -243,9 +247,10 @@ abstract class BaseReader implements IReader } /** - * Scan theXML for use of attributes($namespaces['ss']); if (isset($row_ss['Index'])) { - $rowID = (integer) $row_ss['Index']; + $rowID = (int) $row_ss['Index']; } $columnID = 'A'; @@ -615,7 +629,7 @@ class Excel2003XML extends BaseReader implements IReader $type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC; $cellValue = (float) $cellValue; if (floor($cellValue) == $cellValue) { - $cellValue = (integer) $cellValue; + $cellValue = (int) $cellValue; } break; case 'Boolean': @@ -666,7 +680,7 @@ class Excel2003XML extends BaseReader implements IReader $rowReference = $rowID; } // Bracketed R references are relative to the current row - if ($rowReference{0} == '[') { + if ($rowReference[0] == '[') { $rowReference = $rowID + trim($rowReference, '[]'); } $columnReference = $cellReference[4][0]; @@ -675,7 +689,7 @@ class Excel2003XML extends BaseReader implements IReader $columnReference = $columnNumber; } // Bracketed C references are relative to the current column - if ($columnReference{0} == '[') { + if ($columnReference[0] == '[') { $columnReference = $columnNumber + trim($columnReference, '[]'); } $A1CellReference = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference; diff --git a/src/PhpSpreadsheet/Reader/Exception.php b/src/PhpSpreadsheet/Reader/Exception.php index 165ce7e4..f50f619a 100644 --- a/src/PhpSpreadsheet/Reader/Exception.php +++ b/src/PhpSpreadsheet/Reader/Exception.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Reader; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Exception extends \PhpOffice\PhpSpreadsheet\Exception { /** - * Error handler callback + * Error handler callback. * * @param mixed $code * @param mixed $string diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index b186f707..ed09f0f2 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -7,7 +7,7 @@ use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Spreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,20 +24,21 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Gnumeric extends BaseReader implements IReader { /** - * Formats + * Formats. * * @var array */ private $styles = []; /** - * Shared Expressions + * Shared Expressions. * * @var array */ @@ -46,7 +47,7 @@ class Gnumeric extends BaseReader implements IReader private $referenceHelper = null; /** - * Create a new Gnumeric + * Create a new Gnumeric. */ public function __construct() { @@ -58,7 +59,9 @@ class Gnumeric extends BaseReader implements IReader * Can the current IReader read the file? * * @param string $pFilename + * * @throws Exception + * * @return bool */ public function canRead($pFilename) @@ -83,9 +86,10 @@ class Gnumeric extends BaseReader implements IReader } /** - * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object + * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object. * * @param string $pFilename + * * @throws Exception */ public function listWorksheetNames($pFilename) @@ -111,9 +115,10 @@ class Gnumeric extends BaseReader implements IReader } /** - * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). * * @param string $pFilename + * * @throws Exception */ public function listWorksheetInfo($pFilename) @@ -175,10 +180,12 @@ class Gnumeric extends BaseReader implements IReader } /** - * Loads Spreadsheet from file + * Loads Spreadsheet from file. * * @param string $pFilename + * * @throws Exception + * * @return Spreadsheet */ public function load($pFilename) @@ -191,11 +198,13 @@ class Gnumeric extends BaseReader implements IReader } /** - * Loads from file into Spreadsheet instance + * Loads from file into Spreadsheet instance. * * @param string $pFilename * @param Spreadsheet $spreadsheet + * * @throws Exception + * * @return Spreadsheet */ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) @@ -339,7 +348,7 @@ class Gnumeric extends BaseReader implements IReader $marginSize = 72 / 100; // Default switch ($marginAttributes['PrefUnit']) { case 'mm': - $marginSize = intval($marginAttributes['Points']) / 100; + $marginSize = (int) ($marginAttributes['Points']) / 100; break; } switch ($key) { @@ -419,7 +428,7 @@ class Gnumeric extends BaseReader implements IReader $cell = ($cell == 'TRUE') ? true : false; break; case '30': // Integer - $cell = intval($cell); + $cell = (int) $cell; // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case case '40': // Float $type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC; @@ -507,7 +516,7 @@ class Gnumeric extends BaseReader implements IReader $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false; $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false; - $styleArray['alignment']['indent'] = (intval($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0; + $styleArray['alignment']['indent'] = ((int) ($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0; $RGB = self::parseGnumericColour($styleAttributes['Fore']); $styleArray['font']['color']['rgb'] = $RGB; @@ -583,7 +592,7 @@ class Gnumeric extends BaseReader implements IReader $fontAttributes = $styleRegion->Style->Font->attributes(); $styleArray['font']['name'] = (string) $styleRegion->Style->Font; - $styleArray['font']['size'] = intval($fontAttributes['Unit']); + $styleArray['font']['size'] = (int) ($fontAttributes['Unit']); $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false; $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false; $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false; diff --git a/src/PhpSpreadsheet/Reader/HTML.php b/src/PhpSpreadsheet/Reader/HTML.php index 103d0ba6..b9ec0c81 100644 --- a/src/PhpSpreadsheet/Reader/HTML.php +++ b/src/PhpSpreadsheet/Reader/HTML.php @@ -9,7 +9,7 @@ use DOMText; use PhpOffice\PhpSpreadsheet\Spreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,6 +26,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,26 +34,26 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; class HTML extends BaseReader implements IReader { /** - * Sample size to read to determine if it's HTML or not + * Sample size to read to determine if it's HTML or not. */ const TEST_SAMPLE_SIZE = 2048; /** - * Input encoding + * Input encoding. * * @var string */ protected $inputEncoding = 'ANSI'; /** - * Sheet index to read + * Sheet index to read. * * @var int */ protected $sheetIndex = 0; /** - * Formats + * Formats. * * @var array */ @@ -116,7 +117,7 @@ class HTML extends BaseReader implements IReader protected $rowspan = []; /** - * Create a new HTML Reader instance + * Create a new HTML Reader instance. */ public function __construct() { @@ -124,10 +125,12 @@ class HTML extends BaseReader implements IReader } /** - * Validate that the current file is an HTML file + * Validate that the current file is an HTML file. * * @param string $pFilename + * * @throws Exception + * * @return bool */ public function canRead($pFilename) @@ -185,10 +188,12 @@ class HTML extends BaseReader implements IReader } /** - * Loads Spreadsheet from file + * Loads Spreadsheet from file. * * @param string $pFilename + * * @throws Exception + * * @return Spreadsheet */ public function load($pFilename) @@ -201,7 +206,7 @@ class HTML extends BaseReader implements IReader } /** - * Set input encoding + * Set input encoding. * * @param string $pValue Input encoding */ @@ -213,7 +218,7 @@ class HTML extends BaseReader implements IReader } /** - * Get input encoding + * Get input encoding. * * @return string */ @@ -284,10 +289,9 @@ class HTML extends BaseReader implements IReader if (is_string($cellContent)) { // simply append the text if the cell content is a plain text string $cellContent .= $domText; - } else { + } // but if we have a rich text run instead, we need to append it correctly // TODO - } } elseif ($child instanceof DOMElement) { $attributeArray = []; foreach ($child->attributes as $attribute) { @@ -493,11 +497,13 @@ class HTML extends BaseReader implements IReader } /** - * Loads PhpSpreadsheet from file into PhpSpreadsheet instance + * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. * * @param string $pFilename * @param Spreadsheet $spreadsheet + * * @throws Exception + * * @return Spreadsheet */ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) @@ -534,7 +540,7 @@ class HTML extends BaseReader implements IReader } /** - * Get sheet index + * Get sheet index. * * @return int */ @@ -544,9 +550,10 @@ class HTML extends BaseReader implements IReader } /** - * Set sheet index + * Set sheet index. * * @param int $pValue Sheet index + * * @return HTML */ public function setSheetIndex($pValue = 0) @@ -557,9 +564,10 @@ class HTML extends BaseReader implements IReader } /** - * Scan theXML for use of data + * Size in bytes of $this->data. * * @var int */ private $dataSize; /** - * Current position in stream + * Current position in stream. * * @var int */ @@ -205,7 +206,7 @@ class Xls extends BaseReader implements IReader private $phpSheet; /** - * BIFF version + * BIFF version. * * @var int */ @@ -213,42 +214,42 @@ class Xls extends BaseReader implements IReader /** * Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95) - * For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE' + * For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE'. * * @var string */ private $codepage; /** - * Shared formats + * Shared formats. * * @var array */ private $formats; /** - * Shared fonts + * Shared fonts. * * @var array */ private $objFonts; /** - * Color palette + * Color palette. * * @var array */ private $palette; /** - * Worksheets + * Worksheets. * * @var array */ private $sheets; /** - * External books + * External books. * * @var array */ @@ -262,14 +263,14 @@ class Xls extends BaseReader implements IReader private $ref; /** - * External names + * External names. * * @var array */ private $externalNames; /** - * Defined names + * Defined names. * * @var array */ @@ -311,42 +312,42 @@ class Xls extends BaseReader implements IReader private $textObjects; /** - * Cell Annotations (BIFF8) + * Cell Annotations (BIFF8). * * @var array */ private $cellNotes; /** - * The combined MSODRAWINGGROUP data + * The combined MSODRAWINGGROUP data. * * @var string */ private $drawingGroupData; /** - * The combined MSODRAWING data (per sheet) + * The combined MSODRAWING data (per sheet). * * @var string */ private $drawingData; /** - * Keep track of XF index + * Keep track of XF index. * * @var int */ private $xfIndex; /** - * Mapping of XF index (that is a cell XF) to final index in cellXf collection + * Mapping of XF index (that is a cell XF) to final index in cellXf collection. * * @var array */ private $mapCellXfIndex; /** - * Mapping of XF index (that is a style XF) to final index in cellStyleXf collection + * Mapping of XF index (that is a style XF) to final index in cellStyleXf collection. * * @var array */ @@ -368,42 +369,42 @@ class Xls extends BaseReader implements IReader private $sharedFormulaParts; /** - * The type of encryption in use + * The type of encryption in use. * * @var int */ private $encryption = 0; /** - * The position in the stream after which contents are encrypted + * The position in the stream after which contents are encrypted. * * @var int */ private $encryptionStartPos = false; /** - * The current RC4 decryption object + * The current RC4 decryption object. * * @var Xls\RC4 */ private $rc4Key = null; /** - * The position in the stream that the RC4 decryption object was left at + * The position in the stream that the RC4 decryption object was left at. * * @var int */ private $rc4Pos = 0; /** - * The current MD5 context state + * The current MD5 context state. * * @var string */ private $md5Ctxt = null; /** - * Create a new Xls Reader instance + * Create a new Xls Reader instance. */ public function __construct() { @@ -414,7 +415,9 @@ class Xls extends BaseReader implements IReader * Can the current IReader read the file? * * @param string $pFilename + * * @throws Exception + * * @return bool */ public function canRead($pFilename) @@ -435,9 +438,10 @@ class Xls extends BaseReader implements IReader } /** - * Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object + * Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object. * * @param string $pFilename + * * @throws Exception */ public function listWorksheetNames($pFilename) @@ -488,9 +492,10 @@ class Xls extends BaseReader implements IReader } /** - * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). * * @param string $pFilename + * * @throws Exception */ public function listWorksheetInfo($pFilename) @@ -591,10 +596,12 @@ class Xls extends BaseReader implements IReader } /** - * Loads PhpSpreadsheet from file + * Loads PhpSpreadsheet from file. * * @param string $pFilename + * * @throws Exception + * * @return \PhpOffice\PhpSpreadsheet\Spreadsheet */ public function load($pFilename) @@ -1182,10 +1189,9 @@ class Xls extends BaseReader implements IReader $this->spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange((string) $definedName['name'], $docSheet, $extractedRange, $localOnly, $scope)); } - } else { + } // Named Value // TODO Provide support for named values - } } } $this->data = null; @@ -1194,7 +1200,7 @@ class Xls extends BaseReader implements IReader } /** - * Read record data from stream, decrypting as required + * Read record data from stream, decrypting as required. * * @param string $data Data stream to read from * @param int $pos Position to start reading from @@ -1250,7 +1256,7 @@ class Xls extends BaseReader implements IReader } /** - * Use OLE reader to extract the relevant data streams from the OLE file + * Use OLE reader to extract the relevant data streams from the OLE file. * * @param string $pFilename */ @@ -1269,7 +1275,7 @@ class Xls extends BaseReader implements IReader } /** - * Read summary information + * Read summary information. */ private function readSummaryInformation() { @@ -1403,7 +1409,7 @@ class Xls extends BaseReader implements IReader } /** - * Read additional document summary information + * Read additional document summary information. */ private function readDocumentSummaryInformation() { @@ -1632,7 +1638,7 @@ class Xls extends BaseReader implements IReader } /** - * Read BOF + * Read BOF. */ private function readBof() { @@ -1669,7 +1675,7 @@ class Xls extends BaseReader implements IReader } /** - * FILEPASS + * FILEPASS. * * This record is part of the File Protection Block. It * contains information about the read/write password of the @@ -1707,10 +1713,11 @@ class Xls extends BaseReader implements IReader } /** - * Make an RC4 decryptor for the given block + * Make an RC4 decryptor for the given block. * * @param int Block for which to create decrypto * @param string $valContext MD5 context state + * @param mixed $block * * @return Xls\RC4 */ @@ -1739,7 +1746,7 @@ class Xls extends BaseReader implements IReader } /** - * Verify RC4 file password + * Verify RC4 file password. * * @param string $password Password to check * @param string $docid Document id @@ -1823,7 +1830,7 @@ class Xls extends BaseReader implements IReader } /** - * CODEPAGE + * CODEPAGE. * * This record stores the text encoding used to write byte * strings, stored as MS Windows code page identifier. @@ -1846,7 +1853,7 @@ class Xls extends BaseReader implements IReader } /** - * DATEMODE + * DATEMODE. * * This record specifies the base date for displaying date * values. All dates are stored as count of days past this @@ -1867,13 +1874,13 @@ class Xls extends BaseReader implements IReader // offset: 0; size: 2; 0 = base 1900, 1 = base 1904 \PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar(\PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900); - if (ord($recordData{0}) == 1) { + if (ord($recordData[0]) == 1) { \PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar(\PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_MAC_1904); } } /** - * Read a FONT record + * Read a FONT record. */ private function readFont() { @@ -1929,7 +1936,7 @@ class Xls extends BaseReader implements IReader } // offset: 10; size: 1; underline type - $underlineType = ord($recordData{10}); + $underlineType = ord($recordData[10]); switch ($underlineType) { case 0x00: break; // no underline @@ -1963,7 +1970,7 @@ class Xls extends BaseReader implements IReader } /** - * FORMAT + * FORMAT. * * This record contains information about a number format. * All FORMAT records occur together in a sequential list. @@ -2000,7 +2007,7 @@ class Xls extends BaseReader implements IReader } /** - * XF - Extended Format + * XF - Extended Format. * * This record contains formatting information for cells, rows, columns or styles. * According to http://support.microsoft.com/kb/147732 there are always at least 15 cell style XF @@ -2064,7 +2071,7 @@ class Xls extends BaseReader implements IReader // offset: 6; size: 1; Alignment and text break // bit 2-0, mask 0x07; horizontal alignment - $horAlign = (0x07 & ord($recordData{6})) >> 0; + $horAlign = (0x07 & ord($recordData[6])) >> 0; switch ($horAlign) { case 0: $objStyle->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_GENERAL); @@ -2089,7 +2096,7 @@ class Xls extends BaseReader implements IReader break; } // bit 3, mask 0x08; wrap text - $wrapText = (0x08 & ord($recordData{6})) >> 3; + $wrapText = (0x08 & ord($recordData[6])) >> 3; switch ($wrapText) { case 0: $objStyle->getAlignment()->setWrapText(false); @@ -2099,7 +2106,7 @@ class Xls extends BaseReader implements IReader break; } // bit 6-4, mask 0x70; vertical alignment - $vertAlign = (0x70 & ord($recordData{6})) >> 4; + $vertAlign = (0x70 & ord($recordData[6])) >> 4; switch ($vertAlign) { case 0: $objStyle->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_TOP); @@ -2117,7 +2124,7 @@ class Xls extends BaseReader implements IReader if ($this->version == self::XLS_BIFF8) { // offset: 7; size: 1; XF_ROTATION: Text rotation angle - $angle = ord($recordData{7}); + $angle = ord($recordData[7]); $rotation = 0; if ($angle <= 90) { $rotation = $angle; @@ -2130,11 +2137,11 @@ class Xls extends BaseReader implements IReader // offset: 8; size: 1; Indentation, shrink to cell size, and text direction // bit: 3-0; mask: 0x0F; indent level - $indent = (0x0F & ord($recordData{8})) >> 0; + $indent = (0x0F & ord($recordData[8])) >> 0; $objStyle->getAlignment()->setIndent($indent); // bit: 4; mask: 0x10; 1 = shrink content to fit into cell - $shrinkToFit = (0x10 & ord($recordData{8})) >> 4; + $shrinkToFit = (0x10 & ord($recordData[8])) >> 4; switch ($shrinkToFit) { case 0: $objStyle->getAlignment()->setShrinkToFit(false); @@ -2214,7 +2221,7 @@ class Xls extends BaseReader implements IReader // BIFF5 // offset: 7; size: 1; Text orientation and flags - $orientationAndFlags = ord($recordData{7}); + $orientationAndFlags = ord($recordData[7]); // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation $xfOrientation = (0x03 & $orientationAndFlags) >> 0; @@ -2291,9 +2298,6 @@ class Xls extends BaseReader implements IReader } } - /** - * - */ private function readXfExt() { $length = self::getInt2d($this->data, $this->pos + 2); @@ -2337,7 +2341,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2352,7 +2356,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2367,7 +2371,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2382,7 +2386,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2397,7 +2401,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2412,7 +2416,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2427,7 +2431,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2442,7 +2446,7 @@ class Xls extends BaseReader implements IReader $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { - $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); // modify the relevant style property if (isset($this->mapCellXfIndex[$ixfe])) { @@ -2460,7 +2464,7 @@ class Xls extends BaseReader implements IReader } /** - * Read STYLE record + * Read STYLE record. */ private function readStyle() { @@ -2482,7 +2486,7 @@ class Xls extends BaseReader implements IReader if ($isBuiltIn) { // offset: 2; size: 1; identifier for built-in style - $builtInId = ord($recordData{2}); + $builtInId = ord($recordData[2]); switch ($builtInId) { case 0x00: @@ -2491,14 +2495,13 @@ class Xls extends BaseReader implements IReader default: break; } - } else { - // user-defined; not supported by PhpSpreadsheet } + // user-defined; not supported by PhpSpreadsheet } } /** - * Read PALETTE record + * Read PALETTE record. */ private function readPalette() { @@ -2521,7 +2524,7 @@ class Xls extends BaseReader implements IReader } /** - * SHEET + * SHEET. * * This record is located in the Workbook Globals * Substream and represents a sheet inside the workbook. @@ -2545,7 +2548,7 @@ class Xls extends BaseReader implements IReader $this->pos += 4 + $length; // offset: 4; size: 1; sheet state - switch (ord($recordData{4})) { + switch (ord($recordData[4])) { case 0x00: $sheetState = \PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_VISIBLE; break; @@ -2561,7 +2564,7 @@ class Xls extends BaseReader implements IReader } // offset: 5; size: 1; sheet type - $sheetType = ord($recordData{5}); + $sheetType = ord($recordData[5]); // offset: 6; size: var; sheet name if ($this->version == self::XLS_BIFF8) { @@ -2581,7 +2584,7 @@ class Xls extends BaseReader implements IReader } /** - * Read EXTERNALBOOK record + * Read EXTERNALBOOK record. */ private function readExternalBook() { @@ -2677,7 +2680,7 @@ class Xls extends BaseReader implements IReader } /** - * Read EXTERNSHEET record + * Read EXTERNSHEET record. */ private function readExternSheet() { @@ -2705,7 +2708,7 @@ class Xls extends BaseReader implements IReader } /** - * DEFINEDNAME + * DEFINEDNAME. * * This record is part of a Link Table. It contains the name * and the token array of an internal defined name. Token @@ -2735,7 +2738,7 @@ class Xls extends BaseReader implements IReader // offset: 2; size: 1; keyboard shortcut // offset: 3; size: 1; length of the name (character count) - $nlen = ord($recordData{3}); + $nlen = ord($recordData[3]); // offset: 4; size: 2; size of the formula data (it can happen that this is zero) // note: there can also be additional data, this is not included in $flen @@ -2767,7 +2770,7 @@ class Xls extends BaseReader implements IReader } /** - * Read MSODRAWINGGROUP record + * Read MSODRAWINGGROUP record. */ private function readMsoDrawingGroup() { @@ -2781,7 +2784,7 @@ class Xls extends BaseReader implements IReader } /** - * SST - Shared String Table + * SST - Shared String Table. * * This record contains a list of all strings used anywhere * in the workbook. Each string occurs only once. The @@ -2816,7 +2819,7 @@ class Xls extends BaseReader implements IReader $pos += 2; // option flags - $optionFlags = ord($recordData{$pos}); + $optionFlags = ord($recordData[$pos]); ++$pos; // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed @@ -2883,7 +2886,7 @@ class Xls extends BaseReader implements IReader // repeated option flags // OpenOffice.org documentation 5.21 - $option = ord($recordData{$pos}); + $option = ord($recordData[$pos]); ++$pos; if ($isCompressed && ($option == 0)) { @@ -2905,7 +2908,7 @@ class Xls extends BaseReader implements IReader // this fragment compressed $len = min($charsLeft, $limitpos - $pos); for ($j = 0; $j < $len; ++$j) { - $retstr .= $recordData{$pos + $j} + $retstr .= $recordData[$pos + $j] . chr(0); } $charsLeft -= $len; @@ -2967,7 +2970,7 @@ class Xls extends BaseReader implements IReader } /** - * Read PRINTGRIDLINES record + * Read PRINTGRIDLINES record. */ private function readPrintGridlines() { @@ -2985,7 +2988,7 @@ class Xls extends BaseReader implements IReader } /** - * Read DEFAULTROWHEIGHT record + * Read DEFAULTROWHEIGHT record. */ private function readDefaultRowHeight() { @@ -3002,7 +3005,7 @@ class Xls extends BaseReader implements IReader } /** - * Read SHEETPR record + * Read SHEETPR record. */ private function readSheetPr() { @@ -3028,7 +3031,7 @@ class Xls extends BaseReader implements IReader } /** - * Read HORIZONTALPAGEBREAKS record + * Read HORIZONTALPAGEBREAKS record. */ private function readHorizontalPageBreaks() { @@ -3055,7 +3058,7 @@ class Xls extends BaseReader implements IReader } /** - * Read VERTICALPAGEBREAKS record + * Read VERTICALPAGEBREAKS record. */ private function readVerticalPageBreaks() { @@ -3082,7 +3085,7 @@ class Xls extends BaseReader implements IReader } /** - * Read HEADER record + * Read HEADER record. */ private function readHeader() { @@ -3109,7 +3112,7 @@ class Xls extends BaseReader implements IReader } /** - * Read FOOTER record + * Read FOOTER record. */ private function readFooter() { @@ -3135,7 +3138,7 @@ class Xls extends BaseReader implements IReader } /** - * Read HCENTER record + * Read HCENTER record. */ private function readHcenter() { @@ -3154,7 +3157,7 @@ class Xls extends BaseReader implements IReader } /** - * Read VCENTER record + * Read VCENTER record. */ private function readVcenter() { @@ -3173,7 +3176,7 @@ class Xls extends BaseReader implements IReader } /** - * Read LEFTMARGIN record + * Read LEFTMARGIN record. */ private function readLeftMargin() { @@ -3190,7 +3193,7 @@ class Xls extends BaseReader implements IReader } /** - * Read RIGHTMARGIN record + * Read RIGHTMARGIN record. */ private function readRightMargin() { @@ -3207,7 +3210,7 @@ class Xls extends BaseReader implements IReader } /** - * Read TOPMARGIN record + * Read TOPMARGIN record. */ private function readTopMargin() { @@ -3224,7 +3227,7 @@ class Xls extends BaseReader implements IReader } /** - * Read BOTTOMMARGIN record + * Read BOTTOMMARGIN record. */ private function readBottomMargin() { @@ -3241,7 +3244,7 @@ class Xls extends BaseReader implements IReader } /** - * Read PAGESETUP record + * Read PAGESETUP record. */ private function readPageSetup() { @@ -3302,7 +3305,7 @@ class Xls extends BaseReader implements IReader /** * PROTECT - Sheet protection (BIFF2 through BIFF8) - * if this record is omitted, then it also means no sheet protection + * if this record is omitted, then it also means no sheet protection. */ private function readProtect() { @@ -3324,7 +3327,7 @@ class Xls extends BaseReader implements IReader } /** - * SCENPROTECT + * SCENPROTECT. */ private function readScenProtect() { @@ -3347,7 +3350,7 @@ class Xls extends BaseReader implements IReader } /** - * OBJECTPROTECT + * OBJECTPROTECT. */ private function readObjectProtect() { @@ -3370,7 +3373,7 @@ class Xls extends BaseReader implements IReader } /** - * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8) + * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8). */ private function readPassword() { @@ -3388,7 +3391,7 @@ class Xls extends BaseReader implements IReader } /** - * Read DEFCOLWIDTH record + * Read DEFCOLWIDTH record. */ private function readDefColWidth() { @@ -3406,7 +3409,7 @@ class Xls extends BaseReader implements IReader } /** - * Read COLINFO record + * Read COLINFO record. */ private function readColInfo() { @@ -3456,7 +3459,7 @@ class Xls extends BaseReader implements IReader } /** - * ROW + * ROW. * * This record contains the properties of a single row in a * sheet. Rows and cells in a sheet are divided into blocks @@ -3786,7 +3789,7 @@ class Xls extends BaseReader implements IReader // We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true // the formula data may be ordinary formula data, therefore we need to check // explicitly for the tExp token (0x01) - $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure{2}) == 0x01; + $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure[2]) == 0x01; if ($isPartOfSharedFormula) { // part of shared formula which means there will be a formula with a tExp token and nothing else @@ -3809,7 +3812,7 @@ class Xls extends BaseReader implements IReader $xfIndex = self::getInt2d($recordData, 4); // offset: 6; size: 8; result of the formula - if ((ord($recordData{6}) == 0) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { + if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { // String formula. Result follows in appended STRING record $dataType = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING; @@ -3821,21 +3824,21 @@ class Xls extends BaseReader implements IReader // read STRING record $value = $this->readString(); - } elseif ((ord($recordData{6}) == 1) - && (ord($recordData{12}) == 255) - && (ord($recordData{13}) == 255)) { + } elseif ((ord($recordData[6]) == 1) + && (ord($recordData[12]) == 255) + && (ord($recordData[13]) == 255)) { // Boolean formula. Result is in +2; 0=false, 1=true $dataType = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_BOOL; - $value = (bool) ord($recordData{8}); - } elseif ((ord($recordData{6}) == 2) - && (ord($recordData{12}) == 255) - && (ord($recordData{13}) == 255)) { + $value = (bool) ord($recordData[8]); + } elseif ((ord($recordData[6]) == 2) + && (ord($recordData[12]) == 255) + && (ord($recordData[13]) == 255)) { // Error formula. Error code is in +2 $dataType = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ERROR; - $value = Xls\ErrorCode::lookup(ord($recordData{8})); - } elseif ((ord($recordData{6}) == 3) - && (ord($recordData{12}) == 255) - && (ord($recordData{13}) == 255)) { + $value = Xls\ErrorCode::lookup(ord($recordData[8])); + } elseif ((ord($recordData[6]) == 3) + && (ord($recordData[12]) == 255) + && (ord($recordData[13]) == 255)) { // Formula result is a null string $dataType = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NULL; $value = ''; @@ -3897,7 +3900,7 @@ class Xls extends BaseReader implements IReader // offset: 6, size: 1; not used // offset: 7, size: 1; number of existing FORMULA records for this shared formula - $no = ord($recordData{7}); + $no = ord($recordData[7]); // offset: 8, size: var; Binary token array of the shared formula $formula = substr($recordData, 8); @@ -3909,7 +3912,7 @@ class Xls extends BaseReader implements IReader /** * Read a STRING record from current stream position and advance the stream pointer to next record * This record is used for storing result from FORMULA record when it is a string, and - * it occurs directly after the FORMULA record + * it occurs directly after the FORMULA record. * * @return string The string contents as UTF-8 */ @@ -3961,10 +3964,10 @@ class Xls extends BaseReader implements IReader $xfIndex = self::getInt2d($recordData, 4); // offset: 6; size: 1; the boolean value or error value - $boolErr = ord($recordData{6}); + $boolErr = ord($recordData[6]); // offset: 7; size: 1; 0=boolean; 1=error - $isError = ord($recordData{7}); + $isError = ord($recordData[7]); $cell = $this->phpSheet->getCell($columnString . ($row + 1)); switch ($isError) { @@ -3992,7 +3995,7 @@ class Xls extends BaseReader implements IReader /** * Read MULBLANK record * This record represents a cell range of empty cells. All - * cells are located in the same row + * cells are located in the same row. * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" @@ -4080,7 +4083,7 @@ class Xls extends BaseReader implements IReader } /** - * Read BLANK record + * Read BLANK record. */ private function readBlank() { @@ -4110,7 +4113,7 @@ class Xls extends BaseReader implements IReader } /** - * Read MSODRAWING record + * Read MSODRAWING record. */ private function readMsoDrawing() { @@ -4124,7 +4127,7 @@ class Xls extends BaseReader implements IReader } /** - * Read OBJ record + * Read OBJ record. */ private function readObj() { @@ -4164,7 +4167,7 @@ class Xls extends BaseReader implements IReader } /** - * Read WINDOW2 record + * Read WINDOW2 record. */ private function readWindow2() { @@ -4235,7 +4238,7 @@ class Xls extends BaseReader implements IReader } /** - * Read PLV Record(Created by Excel2007 or upper) + * Read PLV Record(Created by Excel2007 or upper). */ private function readPageLayoutView() { @@ -4272,7 +4275,7 @@ class Xls extends BaseReader implements IReader } /** - * Read SCL record + * Read SCL record. */ private function readScl() { @@ -4293,7 +4296,7 @@ class Xls extends BaseReader implements IReader } /** - * Read PANE record + * Read PANE record. */ private function readPane() { @@ -4313,9 +4316,8 @@ class Xls extends BaseReader implements IReader if ($this->frozen) { // frozen panes $this->phpSheet->freezePane(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($px) . ($py + 1)); - } else { - // unfrozen panes; split windows; not supported by PhpSpreadsheet core } + // unfrozen panes; split windows; not supported by PhpSpreadsheet core } } @@ -4332,7 +4334,7 @@ class Xls extends BaseReader implements IReader if (!$this->readDataOnly) { // offset: 0; size: 1; pane identifier - $paneId = ord($recordData{0}); + $paneId = ord($recordData[0]); // offset: 1; size: 2; index to row of the active cell $r = self::getInt2d($recordData, 1); @@ -4390,7 +4392,7 @@ class Xls extends BaseReader implements IReader } /** - * MERGEDCELLS + * MERGEDCELLS. * * This record contains the addresses of merged cell ranges * in the current sheet. @@ -4418,7 +4420,7 @@ class Xls extends BaseReader implements IReader } /** - * Read HYPERLINK record + * Read HYPERLINK record. */ private function readHyperLink() { @@ -4481,9 +4483,9 @@ class Xls extends BaseReader implements IReader $hyperlinkType = 'UNC'; } elseif (!$isFileLinkOrUrl) { $hyperlinkType = 'workbook'; - } elseif (ord($recordData{$offset}) == 0x03) { + } elseif (ord($recordData[$offset]) == 0x03) { $hyperlinkType = 'local'; - } elseif (ord($recordData{$offset}) == 0xE0) { + } elseif (ord($recordData[$offset]) == 0xE0) { $hyperlinkType = 'URL'; } @@ -4589,7 +4591,7 @@ class Xls extends BaseReader implements IReader } /** - * Read DATAVALIDATIONS record + * Read DATAVALIDATIONS record. */ private function readDataValidations() { @@ -4601,7 +4603,7 @@ class Xls extends BaseReader implements IReader } /** - * Read DATAVALIDATION record + * Read DATAVALIDATION record. */ private function readDataValidation() { @@ -4830,7 +4832,7 @@ class Xls extends BaseReader implements IReader } /** - * Read SHEETPROTECTION record (FEATHEADR) + * Read SHEETPROTECTION record (FEATHEADR). */ private function readSheetProtection() { @@ -4930,7 +4932,7 @@ class Xls extends BaseReader implements IReader /** * Read RANGEPROTECTION record * Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification, - * where it is referred to as FEAT record + * where it is referred to as FEAT record. */ private function readRangeProtection() { @@ -4990,7 +4992,7 @@ class Xls extends BaseReader implements IReader } /** - * Read IMDATA record + * Read IMDATA record. */ private function readImData() { @@ -5065,7 +5067,7 @@ class Xls extends BaseReader implements IReader /** * Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record * When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented. - * In this case, we must treat the CONTINUE record as a MSODRAWING record + * In this case, we must treat the CONTINUE record as a MSODRAWING record. */ private function readContinue() { @@ -5114,7 +5116,7 @@ class Xls extends BaseReader implements IReader * Reads a record from current position in data stream and continues reading data as long as CONTINUE * records are found. Splices the record data pieces and returns the combined string as if record data * is in one piece. - * Moves to next current position in data stream to start of next record different from a CONtINUE record + * Moves to next current position in data stream to start of next record different from a CONtINUE record. * * @return array */ @@ -5150,10 +5152,11 @@ class Xls extends BaseReader implements IReader } /** - * Convert formula structure into human readable Excel formula like 'A3+A5*5' + * Convert formula structure into human readable Excel formula like 'A3+A5*5'. * * @param string $formulaStructure The complete binary data for the formula * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * * @return string Human readable formula */ private function getFormulaFromStructure($formulaStructure, $baseCell = 'A1') @@ -5175,11 +5178,12 @@ class Xls extends BaseReader implements IReader } /** - * Take formula data and additional data for formula and return human readable formula + * Take formula data and additional data for formula and return human readable formula. * * @param string $formulaData The binary data for the formula itself * @param string $additionalData Additional binary data going with the formula * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * * @return string Human readable formula */ private function getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') @@ -5198,10 +5202,11 @@ class Xls extends BaseReader implements IReader } /** - * Take array of tokens together with additional data for formula and return human readable formula + * Take array of tokens together with additional data for formula and return human readable formula. * * @param array $tokens * @param string $additionalData Additional binary data going with the formula + * * @return string Human readable formula */ private function createFormulaFromTokens($tokens, $additionalData) @@ -5356,11 +5361,13 @@ class Xls extends BaseReader implements IReader } /** - * Fetch next token from binary formula data + * Fetch next token from binary formula data. * * @param string $formulaData Formula data * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * * @throws Exception + * * @return array */ private function getNextToken($formulaData, $baseCell = 'A1') @@ -6644,9 +6651,10 @@ class Xls extends BaseReader implements IReader /** * Reads a cell address in BIFF8 e.g. 'A2' or '$A$2' - * section 3.3.4 + * section 3.3.4. * * @param string $cellAddressStructure + * * @return string */ private function readBIFF8CellAddress($cellAddressStructure) @@ -6673,10 +6681,11 @@ class Xls extends BaseReader implements IReader /** * Reads a cell address in BIFF8 for shared formulas. Uses positive and negative values for row and column * to indicate offsets from a base cell - * section 3.3.4 + * section 3.3.4. * * @param string $cellAddressStructure * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * * @return string */ private function readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') @@ -6715,10 +6724,12 @@ class Xls extends BaseReader implements IReader /** * Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1' * always fixed range - * section 2.5.14 + * section 2.5.14. * * @param string $subData + * * @throws Exception + * * @return string */ private function readBIFF5CellRangeAddressFixed($subData) @@ -6730,10 +6741,10 @@ class Xls extends BaseReader implements IReader $lr = self::getInt2d($subData, 2) + 1; // offset: 4; size: 1; index to first column - $fc = ord($subData{4}); + $fc = ord($subData[4]); // offset: 5; size: 1; index to last column - $lc = ord($subData{5}); + $lc = ord($subData[5]); // check values if ($fr > $lr || $fc > $lc) { @@ -6754,10 +6765,12 @@ class Xls extends BaseReader implements IReader /** * Reads a cell range address in BIFF8 e.g. 'A2:B6' or 'A1' * always fixed range - * section 2.5.14 + * section 2.5.14. * * @param string $subData + * * @throws Exception + * * @return string */ private function readBIFF8CellRangeAddressFixed($subData) @@ -6793,9 +6806,10 @@ class Xls extends BaseReader implements IReader /** * Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6' * there are flags indicating whether column/row index is relative - * section 3.3.4 + * section 3.3.4. * * @param string $subData + * * @return string */ private function readBIFF8CellRangeAddress($subData) @@ -6845,10 +6859,11 @@ class Xls extends BaseReader implements IReader /** * Reads a cell range address in BIFF8 for shared formulas. Uses positive and negative values for row and column * to indicate offsets from a base cell - * section 3.3.4 + * section 3.3.4. * * @param string $subData * @param string $baseCell Base cell + * * @return string Cell range address */ private function readBIFF8CellRangeAddressB($subData, $baseCell = 'A1') @@ -6926,9 +6941,10 @@ class Xls extends BaseReader implements IReader /** * Read BIFF8 cell range address list - * section 2.5.15 + * section 2.5.15. * * @param string $subData + * * @return array */ private function readBIFF8CellRangeAddressList($subData) @@ -6953,9 +6969,10 @@ class Xls extends BaseReader implements IReader /** * Read BIFF5 cell range address list - * section 2.5.15 + * section 2.5.15. * * @param string $subData + * * @return array */ private function readBIFF5CellRangeAddressList($subData) @@ -6982,10 +6999,12 @@ class Xls extends BaseReader implements IReader * Get a sheet range like Sheet1:Sheet3 from REF index * Note: If there is only one sheet in the range, one gets e.g Sheet1 * It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets, - * in which case an Exception is thrown + * in which case an Exception is thrown. * * @param int $index + * * @throws Exception + * * @return string|false */ private function readSheetRangeByRefIndex($index) @@ -7037,9 +7056,10 @@ class Xls extends BaseReader implements IReader /** * read BIFF8 constant value array from array data * returns e.g. array('value' => '{1,2;3,4}', 'size' => 40} - * section 2.5.8 + * section 2.5.8. * * @param string $arrayData + * * @return array */ private static function readBIFF8ConstantArray($arrayData) @@ -7075,9 +7095,10 @@ class Xls extends BaseReader implements IReader /** * read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value' * section 2.5.7 - * returns e.g. array('value' => '5', 'size' => 9) + * returns e.g. array('value' => '5', 'size' => 9). * * @param string $valueData + * * @return array */ private static function readBIFF8Constant($valueData) @@ -7125,21 +7146,22 @@ class Xls extends BaseReader implements IReader /** * Extract RGB color - * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4 + * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4. * * @param string $rgb Encoded RGB value (4 bytes) + * * @return array */ private static function readRGB($rgb) { // offset: 0; size 1; Red component - $r = ord($rgb{0}); + $r = ord($rgb[0]); // offset: 1; size: 1; Green component - $g = ord($rgb{1}); + $g = ord($rgb[1]); // offset: 2; size: 1; Blue component - $b = ord($rgb{2}); + $b = ord($rgb[2]); // HEX notation, e.g. 'FF00FC' $rgb = sprintf('%02X%02X%02X', $r, $g, $b); @@ -7149,9 +7171,10 @@ class Xls extends BaseReader implements IReader /** * Read byte string (8-bit string length) - * OpenOffice documentation: 2.5.2 + * OpenOffice documentation: 2.5.2. * * @param string $subData + * * @return array */ private function readByteStringShort($subData) @@ -7170,9 +7193,10 @@ class Xls extends BaseReader implements IReader /** * Read byte string (16-bit string length) - * OpenOffice documentation: 2.5.2 + * OpenOffice documentation: 2.5.2. * * @param string $subData + * * @return array */ private function readByteStringLong($subData) @@ -7196,6 +7220,7 @@ class Xls extends BaseReader implements IReader * function will automatically find out where the Unicode string ends. * * @param string $subData + * * @return array */ private static function readUnicodeStringShort($subData) @@ -7216,9 +7241,10 @@ class Xls extends BaseReader implements IReader /** * Extracts an Excel Unicode long string (16-bit string length) * OpenOffice documentation: 2.5.3 - * this function is under construction, needs to support rich text, and Asian phonetic settings + * this function is under construction, needs to support rich text, and Asian phonetic settings. * * @param string $subData + * * @return array */ private static function readUnicodeStringLong($subData) @@ -7239,10 +7265,11 @@ class Xls extends BaseReader implements IReader /** * Read Unicode string with no string length field, but with known character count * this function is under construction, needs to support rich text, and Asian phonetic settings - * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3 + * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3. * * @param string $subData * @param int $characterCount + * * @return array */ private static function readUnicodeString($subData, $characterCount) @@ -7272,9 +7299,10 @@ class Xls extends BaseReader implements IReader /** * Convert UTF-8 string to string surounded by double quotes. Used for explicit string tokens in formulas. - * Example: hello"world --> "hello""world" + * Example: hello"world --> "hello""world". * * @param string $value UTF-8 encoded string + * * @return string */ private static function UTF8toExcelDoubleQuoted($value) @@ -7283,9 +7311,10 @@ class Xls extends BaseReader implements IReader } /** - * Reads first 8 bytes of a string and return IEEE 754 float + * Reads first 8 bytes of a string and return IEEE 754 float. * * @param string $data Binary string that is at least 8 bytes long + * * @return float */ private static function extractNumber($data) @@ -7341,10 +7370,11 @@ class Xls extends BaseReader implements IReader } /** - * Get UTF-8 string from (compressed or uncompressed) UTF-16 string + * Get UTF-8 string from (compressed or uncompressed) UTF-16 string. * * @param string $string * @param bool $compressed + * * @return string */ private static function encodeUTF16($string, $compressed = false) @@ -7360,6 +7390,7 @@ class Xls extends BaseReader implements IReader * Convert UTF-16 string in compressed notation to uncompressed form. Only used for BIFF8. * * @param string $string + * * @return string */ private static function uncompressByteString($string) @@ -7377,6 +7408,7 @@ class Xls extends BaseReader implements IReader * Convert string to UTF-8. Only used for BIFF5. * * @param string $string + * * @return string */ private function decodeCodepage($string) @@ -7385,10 +7417,11 @@ class Xls extends BaseReader implements IReader } /** - * Read 16-bit unsigned integer + * Read 16-bit unsigned integer. * * @param string $data * @param int $pos + * * @return int */ public static function getInt2d($data, $pos) @@ -7397,10 +7430,11 @@ class Xls extends BaseReader implements IReader } /** - * Read 32-bit signed integer + * Read 32-bit signed integer. * * @param string $data * @param int $pos + * * @return int */ public static function getInt4d($data, $pos) diff --git a/src/PhpSpreadsheet/Reader/Xls/Color.php b/src/PhpSpreadsheet/Reader/Xls/Color.php index 2db53e83..bfcfac36 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Color.php +++ b/src/PhpSpreadsheet/Reader/Xls/Color.php @@ -5,11 +5,12 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; class Color { /** - * Read color + * Read color. * * @param int $color Indexed color * @param array $palette Color palette * @param int $version + * * @return array RGB color value, example: array('rgb' => 'FF0000') */ public static function map($color, $palette, $version) @@ -20,16 +21,13 @@ class Color } elseif (isset($palette) && isset($palette[$color - 8])) { // palette color, color index 0x08 maps to pallete index 0 return $palette[$color - 8]; - } else { + } // default color table if ($version == \PhpOffice\PhpSpreadsheet\Reader\Xls::XLS_BIFF8) { return Color\BIFF8::lookup($color); - } else { + } // BIFF5 return Color\BIFF5::lookup($color); - } - } - return $color; } } diff --git a/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php b/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php index 0b91e5da..743d9387 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php +++ b/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php @@ -64,9 +64,10 @@ class BIFF5 ]; /** - * Map color array from BIFF5 built-in color index + * Map color array from BIFF5 built-in color index. * * @param int $color + * * @return array */ public static function lookup($color) diff --git a/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php b/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php index dcde954d..5c109fb0 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php +++ b/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php @@ -64,9 +64,10 @@ class BIFF8 ]; /** - * Map color array from BIFF8 built-in color index + * Map color array from BIFF8 built-in color index. * * @param int $color + * * @return array */ public static function lookup($color) diff --git a/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php b/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php index e8533482..90d50e33 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php +++ b/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php @@ -18,9 +18,10 @@ class BuiltIn ]; /** - * Map built-in color to RGB value + * Map built-in color to RGB value. * * @param int $color Indexed color + * * @return array */ public static function lookup($color) diff --git a/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php b/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php index 4ee0e19a..1b1488e3 100644 --- a/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php +++ b/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php @@ -15,9 +15,10 @@ class ErrorCode ]; /** - * Map error code, e.g. '#N/A' + * Map error code, e.g. '#N/A'. * * @param int $code + * * @return string|bool */ public static function lookup($code) diff --git a/src/PhpSpreadsheet/Reader/Xls/Escher.php b/src/PhpSpreadsheet/Reader/Xls/Escher.php index 37ea8948..d94fa883 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Escher.php +++ b/src/PhpSpreadsheet/Reader/Xls/Escher.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -45,21 +46,21 @@ class Escher const TERTIARYOPT = 0xF122; /** - * Escher stream data (binary) + * Escher stream data (binary). * * @var string */ private $data; /** - * Size in bytes of the Escher stream data + * Size in bytes of the Escher stream data. * * @var int */ private $dataSize; /** - * Current position of stream pointer in Escher stream data + * Current position of stream pointer in Escher stream data. * * @var int */ @@ -73,7 +74,7 @@ class Escher private $object; /** - * Create a new Escher instance + * Create a new Escher instance. * * @param mixed $object */ @@ -166,7 +167,7 @@ class Escher } /** - * Read a generic record + * Read a generic record. */ private function readDefault() { @@ -187,7 +188,7 @@ class Escher } /** - * Read DggContainer record (Drawing Group Container) + * Read DggContainer record (Drawing Group Container). */ private function readDggContainer() { @@ -205,7 +206,7 @@ class Escher } /** - * Read Dgg record (Drawing Group) + * Read Dgg record (Drawing Group). */ private function readDgg() { @@ -217,7 +218,7 @@ class Escher } /** - * Read BstoreContainer record (Blip Store Container) + * Read BstoreContainer record (Blip Store Container). */ private function readBstoreContainer() { @@ -235,7 +236,7 @@ class Escher } /** - * Read BSE record + * Read BSE record. */ private function readBSE() { @@ -278,16 +279,16 @@ class Escher $foDelay = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($recordData, 28); // offset: 32; size: 1; unused1 - $unused1 = ord($recordData{32}); + $unused1 = ord($recordData[32]); // offset: 33; size: 1; size of nameData in bytes (including null terminator) - $cbName = ord($recordData{33}); + $cbName = ord($recordData[33]); // offset: 34; size: 1; unused2 - $unused2 = ord($recordData{34}); + $unused2 = ord($recordData[34]); // offset: 35; size: 1; unused3 - $unused3 = ord($recordData{35}); + $unused3 = ord($recordData[35]); // offset: 36; size: $cbName; nameData $nameData = substr($recordData, 36, $cbName); @@ -301,7 +302,7 @@ class Escher } /** - * Read BlipJPEG record. Holds raw JPEG image data + * Read BlipJPEG record. Holds raw JPEG image data. */ private function readBlipJPEG() { @@ -329,7 +330,7 @@ class Escher } // offset: var; size: 1; tag - $tag = ord($recordData{$pos}); + $tag = ord($recordData[$pos]); $pos += 1; // offset: var; size: var; the raw image data @@ -342,7 +343,7 @@ class Escher } /** - * Read BlipPNG record. Holds raw PNG image data + * Read BlipPNG record. Holds raw PNG image data. */ private function readBlipPNG() { @@ -370,7 +371,7 @@ class Escher } // offset: var; size: 1; tag - $tag = ord($recordData{$pos}); + $tag = ord($recordData[$pos]); $pos += 1; // offset: var; size: var; the raw image data @@ -383,7 +384,7 @@ class Escher } /** - * Read OPT record. This record may occur within DggContainer record or SpContainer + * Read OPT record. This record may occur within DggContainer record or SpContainer. */ private function readOPT() { @@ -402,7 +403,7 @@ class Escher } /** - * Read TertiaryOPT record + * Read TertiaryOPT record. */ private function readTertiaryOPT() { @@ -419,7 +420,7 @@ class Escher } /** - * Read SplitMenuColors record + * Read SplitMenuColors record. */ private function readSplitMenuColors() { @@ -431,7 +432,7 @@ class Escher } /** - * Read DgContainer record (Drawing Container) + * Read DgContainer record (Drawing Container). */ private function readDgContainer() { @@ -449,7 +450,7 @@ class Escher } /** - * Read Dg record (Drawing) + * Read Dg record (Drawing). */ private function readDg() { @@ -461,7 +462,7 @@ class Escher } /** - * Read SpgrContainer record (Shape Group Container) + * Read SpgrContainer record (Shape Group Container). */ private function readSpgrContainer() { @@ -489,7 +490,7 @@ class Escher } /** - * Read SpContainer record (Shape Container) + * Read SpContainer record (Shape Container). */ private function readSpContainer() { @@ -509,7 +510,7 @@ class Escher } /** - * Read Spgr record (Shape Group) + * Read Spgr record (Shape Group). */ private function readSpgr() { @@ -521,7 +522,7 @@ class Escher } /** - * Read Sp record (Shape) + * Read Sp record (Shape). */ private function readSp() { @@ -538,7 +539,7 @@ class Escher } /** - * Read ClientTextbox record + * Read ClientTextbox record. */ private function readClientTextbox() { @@ -555,7 +556,7 @@ class Escher } /** - * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet + * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet. */ private function readClientAnchor() { @@ -609,7 +610,7 @@ class Escher } /** - * Read ClientData record + * Read ClientData record. */ private function readClientData() { @@ -621,7 +622,7 @@ class Escher } /** - * Read OfficeArtRGFOPTE table of property-value pairs + * Read OfficeArtRGFOPTE table of property-value pairs. * * @param string $data Binary data * @param int $n Number of properties diff --git a/src/PhpSpreadsheet/Reader/Xls/MD5.php b/src/PhpSpreadsheet/Reader/Xls/MD5.php index 85aeb5c0..70ad6e01 100644 --- a/src/PhpSpreadsheet/Reader/Xls/MD5.php +++ b/src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -32,7 +33,7 @@ class MD5 private $d; /** - * MD5 stream constructor + * MD5 stream constructor. */ public function __construct() { @@ -40,7 +41,7 @@ class MD5 } /** - * Reset the MD5 stream context + * Reset the MD5 stream context. */ public function reset() { @@ -51,7 +52,7 @@ class MD5 } /** - * Get MD5 stream context + * Get MD5 stream context. * * @return string */ @@ -70,7 +71,7 @@ class MD5 } /** - * Add data to context + * Add data to context. * * @param string $data Data to add */ diff --git a/src/PhpSpreadsheet/Reader/Xls/RC4.php b/src/PhpSpreadsheet/Reader/Xls/RC4.php index 4cad2ccf..1b169ab8 100644 --- a/src/PhpSpreadsheet/Reader/Xls/RC4.php +++ b/src/PhpSpreadsheet/Reader/Xls/RC4.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -31,7 +32,7 @@ class RC4 protected $j = 0; /** - * RC4 stream decryption/encryption constrcutor + * RC4 stream decryption/encryption constrcutor. * * @param string $key Encryption key/passphrase */ @@ -54,7 +55,7 @@ class RC4 } /** - * Symmetric decryption/encryption function + * Symmetric decryption/encryption function. * * @param string $data Data to encrypt/decrypt * diff --git a/src/PhpSpreadsheet/Reader/Xls/Style/Border.php b/src/PhpSpreadsheet/Reader/Xls/Style/Border.php index ea85a04e..91cbe36f 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Style/Border.php +++ b/src/PhpSpreadsheet/Reader/Xls/Style/Border.php @@ -25,9 +25,10 @@ class Border /** * Map border style - * OpenOffice documentation: 2.5.11 + * OpenOffice documentation: 2.5.11. * * @param int $index + * * @return string */ public static function lookup($index) diff --git a/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php b/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php index 798b29ac..7b85c088 100644 --- a/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php +++ b/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php @@ -30,9 +30,10 @@ class FillPattern /** * Get fill pattern from index - * OpenOffice documentation: 2.5.12 + * OpenOffice documentation: 2.5.12. * * @param int $index + * * @return string */ public static function lookup($index) diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 60f2c0ae..9d8b4188 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; use PhpOffice\PhpSpreadsheet\Shared\File; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,27 +22,28 @@ use PhpOffice\PhpSpreadsheet\Shared\File; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Xlsx extends BaseReader implements IReader { /** - * ReferenceHelper instance + * ReferenceHelper instance. * * @var \PhpOffice\PhpSpreadsheet\ReferenceHelper */ private $referenceHelper = null; /** - * Xlsx\Theme instance + * Xlsx\Theme instance. * * @var Xlsx\Theme */ private static $theme = null; /** - * Create a new Xlsx Reader instance + * Create a new Xlsx Reader instance. */ public function __construct() { @@ -54,7 +55,9 @@ class Xlsx extends BaseReader implements IReader * Can the current IReader read the file? * * @param string $pFilename + * * @throws Exception + * * @return bool */ public function canRead($pFilename) @@ -98,9 +101,10 @@ class Xlsx extends BaseReader implements IReader } /** - * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object + * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object. * * @param string $pFilename + * * @throws Exception */ public function listWorksheetNames($pFilename) @@ -140,9 +144,10 @@ class Xlsx extends BaseReader implements IReader } /** - * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). * * @param string $pFilename + * * @throws Exception */ public function listWorksheetInfo($pFilename) @@ -248,10 +253,9 @@ class Xlsx extends BaseReader implements IReader return false; } elseif ($value == '1') { return true; - } else { - return (bool) $c->v; } + return (bool) $c->v; return $value; } @@ -315,10 +319,12 @@ class Xlsx extends BaseReader implements IReader } /** - * Loads Spreadsheet from file + * Loads Spreadsheet from file. * * @param string $pFilename + * * @throws Exception + * * @return Spreadsheet */ public function load($pFilename) @@ -553,14 +559,14 @@ class Xlsx extends BaseReader implements IReader } $quotePrefix = false; if (isset($xf['quotePrefix'])) { - $quotePrefix = (boolean) $xf['quotePrefix']; + $quotePrefix = (bool) $xf['quotePrefix']; } $style = (object) [ 'numFmt' => $numFmt, - 'font' => $xmlStyles->fonts->font[intval($xf['fontId'])], - 'fill' => $xmlStyles->fills->fill[intval($xf['fillId'])], - 'border' => $xmlStyles->borders->border[intval($xf['borderId'])], + 'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])], + 'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])], + 'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])], 'alignment' => $xf->alignment, 'protection' => $xf->protection, 'quotePrefix' => $quotePrefix, @@ -586,9 +592,9 @@ class Xlsx extends BaseReader implements IReader $cellStyle = (object) [ 'numFmt' => $numFmt, - 'font' => $xmlStyles->fonts->font[intval($xf['fontId'])], - 'fill' => $xmlStyles->fills->fill[intval($xf['fillId'])], - 'border' => $xmlStyles->borders->border[intval($xf['borderId'])], + 'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])], + 'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])], + 'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])], 'alignment' => $xf->alignment, 'protection' => $xf->protection, 'quotePrefix' => $quotePrefix, @@ -615,11 +621,11 @@ class Xlsx extends BaseReader implements IReader // Cell Styles if ($xmlStyles->cellStyles) { foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) { - if (intval($cellStyle['builtinId']) == 0) { - if (isset($cellStyles[intval($cellStyle['xfId'])])) { + if ((int) ($cellStyle['builtinId']) == 0) { + if (isset($cellStyles[(int) ($cellStyle['xfId'])])) { // Set default style $style = new \PhpOffice\PhpSpreadsheet\Style(); - self::readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); + self::readStyle($style, $cellStyles[(int) ($cellStyle['xfId'])]); // normal style, currently not using it for anything } @@ -690,10 +696,10 @@ class Xlsx extends BaseReader implements IReader if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) { if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { - $docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale'])); + $docSheet->getSheetView()->setZoomScale((int) ($xmlSheet->sheetViews->sheetView['zoomScale'])); } if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { - $docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])); + $docSheet->getSheetView()->setZoomScaleNormal((int) ($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])); } if (isset($xmlSheet->sheetViews->sheetView['view'])) { $docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']); @@ -715,11 +721,11 @@ class Xlsx extends BaseReader implements IReader $ySplit = 0; if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) { - $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']); + $xSplit = 1 + (int) ($xmlSheet->sheetViews->sheetView->pane['xSplit']); } if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) { - $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']); + $ySplit = 1 + (int) ($xmlSheet->sheetViews->sheetView->pane['ySplit']); } $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit); @@ -786,9 +792,9 @@ class Xlsx extends BaseReader implements IReader if (isset($xmlSheet->cols) && !$this->readDataOnly) { foreach ($xmlSheet->cols->col as $col) { - for ($i = intval($col['min']) - 1; $i < intval($col['max']); ++$i) { + for ($i = (int) ($col['min']) - 1; $i < (int) ($col['max']); ++$i) { if ($col['style'] && !$this->readDataOnly) { - $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setXfIndex(intval($col['style'])); + $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setXfIndex((int) ($col['style'])); } if (self::boolean($col['hidden'])) { $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setVisible(false); @@ -797,11 +803,11 @@ class Xlsx extends BaseReader implements IReader $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setCollapsed(true); } if ($col['outlineLevel'] > 0) { - $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col['outlineLevel'])); + $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setOutlineLevel((int) ($col['outlineLevel'])); } - $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setWidth(floatval($col['width'])); + $docSheet->getColumnDimension(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($i))->setWidth((float) ($col['width'])); - if (intval($col['max']) == 16384) { + if ((int) ($col['max']) == 16384) { break; } } @@ -826,19 +832,19 @@ class Xlsx extends BaseReader implements IReader if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { foreach ($xmlSheet->sheetData->row as $row) { if ($row['ht'] && !$this->readDataOnly) { - $docSheet->getRowDimension(intval($row['r']))->setRowHeight(floatval($row['ht'])); + $docSheet->getRowDimension((int) ($row['r']))->setRowHeight((float) ($row['ht'])); } if (self::boolean($row['hidden']) && !$this->readDataOnly) { - $docSheet->getRowDimension(intval($row['r']))->setVisible(false); + $docSheet->getRowDimension((int) ($row['r']))->setVisible(false); } if (self::boolean($row['collapsed'])) { - $docSheet->getRowDimension(intval($row['r']))->setCollapsed(true); + $docSheet->getRowDimension((int) ($row['r']))->setCollapsed(true); } if ($row['outlineLevel'] > 0) { - $docSheet->getRowDimension(intval($row['r']))->setOutlineLevel(intval($row['outlineLevel'])); + $docSheet->getRowDimension((int) ($row['r']))->setOutlineLevel((int) ($row['outlineLevel'])); } if ($row['s'] && !$this->readDataOnly) { - $docSheet->getRowDimension(intval($row['r']))->setXfIndex(intval($row['s'])); + $docSheet->getRowDimension((int) ($row['r']))->setXfIndex((int) ($row['s'])); } foreach ($row->c as $c) { @@ -860,7 +866,7 @@ class Xlsx extends BaseReader implements IReader switch ($cellDataType) { case 's': if ((string) $c->v != '') { - $value = $sharedStrings[intval($c->v)]; + $value = $sharedStrings[(int) ($c->v)]; if ($value instanceof \PhpOffice\PhpSpreadsheet\RichText) { $value = clone $value; @@ -913,8 +919,8 @@ class Xlsx extends BaseReader implements IReader $value = (int) $value; } elseif ($value == (float) $value) { $value = (float) $value; - } elseif ($value == (double) $value) { - $value = (double) $value; + } elseif ($value == (float) $value) { + $value = (float) $value; } } @@ -937,8 +943,8 @@ class Xlsx extends BaseReader implements IReader // Style information? if ($c['s'] && !$this->readDataOnly) { // no style index means 0, it seems - $cell->setXfIndex(isset($styles[intval($c['s'])]) ? - intval($c['s']) : 0); + $cell->setXfIndex(isset($styles[(int) ($c['s'])]) ? + (int) ($c['s']) : 0); } } } @@ -948,8 +954,8 @@ class Xlsx extends BaseReader implements IReader if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { foreach ($xmlSheet->conditionalFormatting as $conditional) { foreach ($conditional->cfRule as $cfRule) { - if (((string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_NONE || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule['dxfId'])])) { - $conditionals[(string) $conditional['sqref']][intval($cfRule['priority'])] = $cfRule; + if (((string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_NONE || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[(int) ($cfRule['dxfId'])])) { + $conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule; } } } @@ -973,7 +979,7 @@ class Xlsx extends BaseReader implements IReader } else { $objConditional->addCondition((string) $cfRule->formula); } - $objConditional->setStyle(clone $dxfs[intval($cfRule['dxfId'])]); + $objConditional->setStyle(clone $dxfs[(int) ($cfRule['dxfId'])]); $conditionalStyles[] = $objConditional; } @@ -1009,7 +1015,7 @@ class Xlsx extends BaseReader implements IReader $autoFilter->setRange($autoFilterRange); foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) { - $column = $autoFilter->getColumnByOffset((integer) $filterColumn['colId']); + $column = $autoFilter->getColumnByOffset((int) $filterColumn['colId']); // Check for standard filters if ($filterColumn->filters) { $column->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER); @@ -1113,12 +1119,12 @@ class Xlsx extends BaseReader implements IReader if ($xmlSheet && $xmlSheet->pageMargins && !$this->readDataOnly) { $docPageMargins = $docSheet->getPageMargins(); - $docPageMargins->setLeft(floatval($xmlSheet->pageMargins['left'])); - $docPageMargins->setRight(floatval($xmlSheet->pageMargins['right'])); - $docPageMargins->setTop(floatval($xmlSheet->pageMargins['top'])); - $docPageMargins->setBottom(floatval($xmlSheet->pageMargins['bottom'])); - $docPageMargins->setHeader(floatval($xmlSheet->pageMargins['header'])); - $docPageMargins->setFooter(floatval($xmlSheet->pageMargins['footer'])); + $docPageMargins->setLeft((float) ($xmlSheet->pageMargins['left'])); + $docPageMargins->setRight((float) ($xmlSheet->pageMargins['right'])); + $docPageMargins->setTop((float) ($xmlSheet->pageMargins['top'])); + $docPageMargins->setBottom((float) ($xmlSheet->pageMargins['bottom'])); + $docPageMargins->setHeader((float) ($xmlSheet->pageMargins['header'])); + $docPageMargins->setFooter((float) ($xmlSheet->pageMargins['footer'])); } if ($xmlSheet && $xmlSheet->pageSetup && !$this->readDataOnly) { @@ -1128,20 +1134,20 @@ class Xlsx extends BaseReader implements IReader $docPageSetup->setOrientation((string) $xmlSheet->pageSetup['orientation']); } if (isset($xmlSheet->pageSetup['paperSize'])) { - $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup['paperSize'])); + $docPageSetup->setPaperSize((int) ($xmlSheet->pageSetup['paperSize'])); } if (isset($xmlSheet->pageSetup['scale'])) { - $docPageSetup->setScale(intval($xmlSheet->pageSetup['scale']), false); + $docPageSetup->setScale((int) ($xmlSheet->pageSetup['scale']), false); } - if (isset($xmlSheet->pageSetup['fitToHeight']) && intval($xmlSheet->pageSetup['fitToHeight']) >= 0) { - $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup['fitToHeight']), false); + if (isset($xmlSheet->pageSetup['fitToHeight']) && (int) ($xmlSheet->pageSetup['fitToHeight']) >= 0) { + $docPageSetup->setFitToHeight((int) ($xmlSheet->pageSetup['fitToHeight']), false); } - if (isset($xmlSheet->pageSetup['fitToWidth']) && intval($xmlSheet->pageSetup['fitToWidth']) >= 0) { - $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup['fitToWidth']), false); + if (isset($xmlSheet->pageSetup['fitToWidth']) && (int) ($xmlSheet->pageSetup['fitToWidth']) >= 0) { + $docPageSetup->setFitToWidth((int) ($xmlSheet->pageSetup['fitToWidth']), false); } if (isset($xmlSheet->pageSetup['firstPageNumber']) && isset($xmlSheet->pageSetup['useFirstPageNumber']) && self::boolean((string) $xmlSheet->pageSetup['useFirstPageNumber'])) { - $docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup['firstPageNumber'])); + $docPageSetup->setFirstPageNumber((int) ($xmlSheet->pageSetup['firstPageNumber'])); } } @@ -1693,7 +1699,6 @@ class Xlsx extends BaseReader implements IReader } $docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets)); break; - default: break; } @@ -1731,14 +1736,14 @@ class Xlsx extends BaseReader implements IReader case '_xlnm.Print_Area': break; default: - if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) { + if ($mapSheetId[(int) $definedName['localSheetId']] !== null) { $range = explode('!', (string) $definedName); if (count($range) == 2) { $range[0] = str_replace("''", "'", $range[0]); $range[0] = str_replace("'", '', $range[0]); if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { $extractedRange = str_replace('$', '', $range[1]); - $scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName['localSheetId']]); + $scope = $docSheet->getParent()->getSheet($mapSheetId[(int) $definedName['localSheetId']]); $excel->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange((string) $definedName['name'], $worksheet, $extractedRange, true, $scope)); } } @@ -1772,7 +1777,7 @@ class Xlsx extends BaseReader implements IReader if ((!$this->readDataOnly) || (!empty($this->loadSheetsOnly))) { // active sheet index - $activeTab = intval($xmlWorkbook->bookViews->workbookView['activeTab']); // refers to old sheet index + $activeTab = (int) ($xmlWorkbook->bookViews->workbookView['activeTab']); // refers to old sheet index // keep active sheet index if sheet is still loaded, else first sheet is set as the active if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) { @@ -1901,7 +1906,7 @@ class Xlsx extends BaseReader implements IReader if (!empty($gradientFill['type'])) { $docStyle->getFill()->setFillType((string) $gradientFill['type']); } - $docStyle->getFill()->setRotation(floatval($gradientFill['degree'])); + $docStyle->getFill()->setRotation((float) ($gradientFill['degree'])); $gradientFill->registerXPathNamespace('sml', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); $docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=0]'))->color)); $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=1]'))->color)); @@ -1951,11 +1956,11 @@ class Xlsx extends BaseReader implements IReader $textRotation = 90 - (int) $style->alignment['textRotation']; } - $docStyle->getAlignment()->setTextRotation(intval($textRotation)); + $docStyle->getAlignment()->setTextRotation((int) $textRotation); $docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment['wrapText'])); $docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment['shrinkToFit'])); - $docStyle->getAlignment()->setIndent(intval((string) $style->alignment['indent']) > 0 ? intval((string) $style->alignment['indent']) : 0); - $docStyle->getAlignment()->setReadorder(intval((string) $style->alignment['readingOrder']) > 0 ? intval((string) $style->alignment['readingOrder']) : 0); + $docStyle->getAlignment()->setIndent((int) ((string) $style->alignment['indent']) > 0 ? (int) ((string) $style->alignment['indent']) : 0); + $docStyle->getAlignment()->setReadorder((int) ((string) $style->alignment['readingOrder']) > 0 ? (int) ((string) $style->alignment['readingOrder']) : 0); } // protection @@ -2052,6 +2057,8 @@ class Xlsx extends BaseReader implements IReader /** * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $excel + * @param mixed $customUITarget + * @param mixed $zip */ private function readRibbon(\PhpOffice\PhpSpreadsheet\Spreadsheet $excel, $customUITarget, $zip) { diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php index b29ee936..d7eeb137 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Calculation\Functions; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,6 +22,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -39,12 +40,12 @@ class Chart if ($format == 'string') { return (string) $attributes[$name]; } elseif ($format == 'integer') { - return (integer) $attributes[$name]; + return (int) $attributes[$name]; } elseif ($format == 'boolean') { - return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true; - } else { - return (float) $attributes[$name]; + return (bool) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true; } + + return (float) $attributes[$name]; } return null; @@ -497,6 +498,7 @@ class Chart /** * @param \PhpOffice\PhpSpreadsheet\Chart\Layout $plotArea + * @param mixed $plotAttributes */ private static function setChartAttributes(\PhpOffice\PhpSpreadsheet\Chart\Layout $plotArea, $plotAttributes) { diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Theme.php b/src/PhpSpreadsheet/Reader/Xlsx/Theme.php index 6b3241bb..2bb800ee 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Theme.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Theme.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,41 +20,46 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Theme { /** - * Theme Name + * Theme Name. * * @var string */ private $themeName; /** - * Colour Scheme Name + * Colour Scheme Name. * * @var string */ private $colourSchemeName; /** - * Colour Map indexed by position + * Colour Map indexed by position. * * @var array of string */ private $colourMapValues; /** - * Colour Map + * Colour Map. * * @var array of string */ private $colourMap; /** - * Create a new Theme + * Create a new Theme. + * + * @param mixed $themeName + * @param mixed $colourSchemeName + * @param mixed $colourMap */ public function __construct($themeName, $colourSchemeName, $colourMap) { @@ -65,7 +70,7 @@ class Theme } /** - * Get Theme Name + * Get Theme Name. * * @return string */ @@ -75,7 +80,7 @@ class Theme } /** - * Get colour Scheme Name + * Get colour Scheme Name. * * @return string */ @@ -85,7 +90,9 @@ class Theme } /** - * Get colour Map Value by Position + * Get colour Map Value by Position. + * + * @param mixed $index * * @return string */ diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index e3894ef9..f80a7f33 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,14 +34,14 @@ class ReferenceHelper const REFHELPER_REGEXP_COLRANGE = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}):(\$?[a-z]{1,3})'; /** - * Instance of this class + * Instance of this class. * * @var ReferenceHelper */ private static $instance; /** - * Get an instance of this class + * Get an instance of this class. * * @return ReferenceHelper */ @@ -54,7 +55,7 @@ class ReferenceHelper } /** - * Create a new ReferenceHelper + * Create a new ReferenceHelper. */ protected function __construct() { @@ -62,10 +63,11 @@ class ReferenceHelper /** * Compare two column addresses - * Intended for use as a Callback function for sorting column addresses by column + * Intended for use as a Callback function for sorting column addresses by column. * * @param string $a First column to test (e.g. 'AA') * @param string $b Second column to test (e.g. 'Z') + * * @return int */ public static function columnSort($a, $b) @@ -75,10 +77,11 @@ class ReferenceHelper /** * Compare two column addresses - * Intended for use as a Callback function for reverse sorting column addresses by column + * Intended for use as a Callback function for reverse sorting column addresses by column. * * @param string $a First column to test (e.g. 'AA') * @param string $b Second column to test (e.g. 'Z') + * * @return int */ public static function columnReverseSort($a, $b) @@ -88,10 +91,11 @@ class ReferenceHelper /** * Compare two cell addresses - * Intended for use as a Callback function for sorting cell addresses by column and row + * Intended for use as a Callback function for sorting cell addresses by column and row. * * @param string $a First cell to test (e.g. 'AA1') * @param string $b Second cell to test (e.g. 'Z1') + * * @return int */ public static function cellSort($a, $b) @@ -108,10 +112,11 @@ class ReferenceHelper /** * Compare two cell addresses - * Intended for use as a Callback function for sorting cell addresses by column and row + * Intended for use as a Callback function for sorting cell addresses by column and row. * * @param string $a First cell to test (e.g. 'AA1') * @param string $b Second cell to test (e.g. 'Z1') + * * @return int */ public static function cellReverseSort($a, $b) @@ -127,13 +132,14 @@ class ReferenceHelper } /** - * Test whether a cell address falls within a defined range of cells + * Test whether a cell address falls within a defined range of cells. * * @param string $cellAddress Address of the cell we're testing * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * * @return bool */ private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) @@ -155,7 +161,7 @@ class ReferenceHelper } /** - * Update page breaks when inserting/deleting rows/columns + * Update page breaks when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -188,7 +194,7 @@ class ReferenceHelper } /** - * Update cell comments when inserting/deleting rows/columns + * Update cell comments when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -215,7 +221,7 @@ class ReferenceHelper } /** - * Update hyperlinks when inserting/deleting rows/columns + * Update hyperlinks when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -240,7 +246,7 @@ class ReferenceHelper } /** - * Update data validations when inserting/deleting rows/columns + * Update data validations when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -265,7 +271,7 @@ class ReferenceHelper } /** - * Update merged cells when inserting/deleting rows/columns + * Update merged cells when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -286,7 +292,7 @@ class ReferenceHelper } /** - * Update protected cells when inserting/deleting rows/columns + * Update protected cells when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -310,7 +316,7 @@ class ReferenceHelper } /** - * Update column dimensions when inserting/deleting rows/columns + * Update column dimensions when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -335,7 +341,7 @@ class ReferenceHelper } /** - * Update row dimensions when inserting/deleting rows/columns + * Update row dimensions when inserting/deleting rows/columns. * * @param Worksheet $pSheet The worksheet that we're editing * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') @@ -369,12 +375,13 @@ class ReferenceHelper } /** - * Insert a new column or row, updating all possible related data + * Insert a new column or row, updating all possible related data. * * @param string $pBefore Insert before this cell address (e.g. 'A1') * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param Worksheet $pSheet The worksheet that we're editing + * * @throws Exception */ public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, Worksheet $pSheet = null) @@ -626,14 +633,16 @@ class ReferenceHelper } /** - * Update references within formulas + * Update references within formulas. * * @param string $pFormula Formula to update * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to insert * @param int $pNumRows Number of rows to insert * @param string $sheetName Worksheet name/title + * * @throws Exception + * * @return string Updated formula */ public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') @@ -767,13 +776,15 @@ class ReferenceHelper } /** - * Update cell reference + * Update cell reference. * * @param string $pCellRange Cell range * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment + * * @throws Exception + * * @return string Updated cell range */ public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) @@ -788,14 +799,13 @@ class ReferenceHelper } elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { // Range return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); - } else { + } // Return original return $pCellRange; - } } /** - * Update named formulas (i.e. containing worksheet references / named ranges) + * Update named formulas (i.e. containing worksheet references / named ranges). * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Object to update * @param string $oldName Old name (name to replace) @@ -823,13 +833,15 @@ class ReferenceHelper } /** - * Update cell range + * Update cell range. * * @param string $pCellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3') * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment + * * @throws Exception + * * @return string Updated cell range */ private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) @@ -855,19 +867,20 @@ class ReferenceHelper // Recreate range string return Cell::buildRange($range); - } else { - throw new Exception('Only cell ranges may be passed to this method.'); } + throw new Exception('Only cell ranges may be passed to this method.'); } /** - * Update single cell reference + * Update single cell reference. * * @param string $pCellReference Single cell reference * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment + * * @throws Exception + * * @return string Updated cell reference */ private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) @@ -880,8 +893,8 @@ class ReferenceHelper list($newColumn, $newRow) = Cell::coordinateFromString($pCellReference); // Verify which parts should be updated - $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (Cell::columnIndexFromString($newColumn) >= Cell::columnIndexFromString($beforeColumn))); - $updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow); + $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Cell::columnIndexFromString($newColumn) >= Cell::columnIndexFromString($beforeColumn))); + $updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow); // Create new column reference if ($updateColumn) { @@ -895,9 +908,8 @@ class ReferenceHelper // Return new reference return $newColumn . $newRow; - } else { - throw new Exception('Only single cell references may be passed to this method.'); } + throw new Exception('Only single cell references may be passed to this method.'); } /** diff --git a/src/PhpSpreadsheet/RichText.php b/src/PhpSpreadsheet/RichText.php index 7076b1b2..8c10509a 100644 --- a/src/PhpSpreadsheet/RichText.php +++ b/src/PhpSpreadsheet/RichText.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,22 +20,24 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class RichText implements IComparable { /** - * Rich text elements + * Rich text elements. * * @var RichText\ITextElement[] */ private $richTextElements; /** - * Create a new RichText instance + * Create a new RichText instance. * * @param Cell $pCell + * * @throws Exception */ public function __construct(Cell $pCell = null) @@ -58,10 +60,12 @@ class RichText implements IComparable } /** - * Add text + * Add text. * * @param RichText\ITextElement $pText Rich text element + * * @throws Exception + * * @return RichText */ public function addText(RichText\ITextElement $pText = null) @@ -72,10 +76,12 @@ class RichText implements IComparable } /** - * Create text + * Create text. * * @param string $pText Text + * * @throws Exception + * * @return RichText\TextElement */ public function createText($pText = '') @@ -87,10 +93,12 @@ class RichText implements IComparable } /** - * Create text run + * Create text run. * * @param string $pText Text + * * @throws Exception + * * @return RichText\Run */ public function createTextRun($pText = '') @@ -102,7 +110,7 @@ class RichText implements IComparable } /** - * Get plain text + * Get plain text. * * @return string */ @@ -120,7 +128,7 @@ class RichText implements IComparable } /** - * Convert to string + * Convert to string. * * @return string */ @@ -130,7 +138,7 @@ class RichText implements IComparable } /** - * Get Rich Text elements + * Get Rich Text elements. * * @return RichText\ITextElement[] */ @@ -140,10 +148,12 @@ class RichText implements IComparable } /** - * Set Rich Text elements + * Set Rich Text elements. * * @param RichText\ITextElement[] $pElements Array of elements + * * @throws Exception + * * @return RichText */ public function setRichTextElements($pElements = null) @@ -158,7 +168,7 @@ class RichText implements IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/RichText/ITextElement.php b/src/PhpSpreadsheet/RichText/ITextElement.php index 4529ebaf..0fe38ecb 100644 --- a/src/PhpSpreadsheet/RichText/ITextElement.php +++ b/src/PhpSpreadsheet/RichText/ITextElement.php @@ -18,35 +18,37 @@ namespace PhpOffice\PhpSpreadsheet\RichText; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ interface ITextElement { /** - * Get text + * Get text. * * @return string Text */ public function getText(); /** - * Set text + * Set text. * * @param $pText string Text + * * @return ITextElement */ public function setText($pText = ''); /** - * Get font + * Get font. * * @return \PhpOffice\PhpSpreadsheet\Style\Font */ public function getFont(); /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/RichText/Run.php b/src/PhpSpreadsheet/RichText/Run.php index 71f03f1d..f2913014 100644 --- a/src/PhpSpreadsheet/RichText/Run.php +++ b/src/PhpSpreadsheet/RichText/Run.php @@ -18,20 +18,21 @@ namespace PhpOffice\PhpSpreadsheet\RichText; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Run extends TextElement implements ITextElement { /** - * Font + * Font. * * @var \PhpOffice\PhpSpreadsheet\Style\Font */ private $font; /** - * Create a new Run instance + * Create a new Run instance. * * @param string $pText Text */ @@ -43,7 +44,7 @@ class Run extends TextElement implements ITextElement } /** - * Get font + * Get font. * * @return \PhpOffice\PhpSpreadsheet\Style\Font */ @@ -53,10 +54,12 @@ class Run extends TextElement implements ITextElement } /** - * Set font + * Set font. * * @param \PhpOffice\PhpSpreadsheet\Style\Font $pFont Font + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return ITextElement */ public function setFont(\PhpOffice\PhpSpreadsheet\Style\Font $pFont = null) @@ -67,7 +70,7 @@ class Run extends TextElement implements ITextElement } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/RichText/TextElement.php b/src/PhpSpreadsheet/RichText/TextElement.php index 393c192b..7da666b0 100644 --- a/src/PhpSpreadsheet/RichText/TextElement.php +++ b/src/PhpSpreadsheet/RichText/TextElement.php @@ -18,20 +18,21 @@ namespace PhpOffice\PhpSpreadsheet\RichText; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class TextElement implements ITextElement { /** - * Text + * Text. * * @var string */ private $text; /** - * Create a new TextElement instance + * Create a new TextElement instance. * * @param string $pText Text */ @@ -42,7 +43,7 @@ class TextElement implements ITextElement } /** - * Get text + * Get text. * * @return string Text */ @@ -52,9 +53,10 @@ class TextElement implements ITextElement } /** - * Set text + * Set text. * * @param $pText string Text + * * @return ITextElement */ public function setText($pText = '') @@ -65,7 +67,7 @@ class TextElement implements ITextElement } /** - * Get font + * Get font. * * @return \PhpOffice\PhpSpreadsheet\Style\Font */ @@ -75,7 +77,7 @@ class TextElement implements ITextElement } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Settings.php b/src/PhpSpreadsheet/Settings.php index 28c263fb..68c7d567 100644 --- a/src/PhpSpreadsheet/Settings.php +++ b/src/PhpSpreadsheet/Settings.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -51,7 +52,7 @@ class Settings /** * Name of the class used for Zip file management * e.g. - * ZipArchive + * ZipArchive. * * @var string */ @@ -60,14 +61,14 @@ class Settings /** * Name of the external Library used for rendering charts * e.g. - * jpgraph + * jpgraph. * * @var string */ private static $chartRendererName; /** - * Directory Path to the external Library used for rendering charts + * Directory Path to the external Library used for rendering charts. * * @var string */ @@ -76,31 +77,32 @@ class Settings /** * Name of the external Library used for rendering PDF files * e.g. - * mPDF + * mPDF. * * @var string */ private static $pdfRendererName; /** - * Directory Path to the external Library used for rendering PDF files + * Directory Path to the external Library used for rendering PDF files. * * @var string */ private static $pdfRendererPath; /** - * Default options for libxml loader + * Default options for libxml loader. * * @var int */ private static $libXmlLoaderOptions = null; /** - * Set the Zip handler Class that PhpSpreadsheet should use for Zip file management (PCLZip or ZipArchive) + * Set the Zip handler Class that PhpSpreadsheet should use for Zip file management (PCLZip or ZipArchive). * * @param string $zipClass The Zip handler class that PhpSpreadsheet should use for Zip file management * e.g. \PhpOffice\PhpSpreadsheet\Settings::PCLZIP or \PhpOffice\PhpSpreadsheet\Settings::ZIPARCHIVE + * * @return bool Success or failure */ public static function setZipClass($zipClass) @@ -117,7 +119,7 @@ class Settings /** * Return the name of the Zip handler Class that PhpSpreadsheet is configured to use (PCLZip or ZipArchive) - * or Zip file management + * or Zip file management. * * @return string Name of the Zip handler Class that PhpSpreadsheet is configured to use * for Zip file management @@ -129,7 +131,7 @@ class Settings } /** - * Return the name of the method that is currently configured for cell cacheing + * Return the name of the method that is currently configured for cell cacheing. * * @return string Name of the cacheing method */ @@ -139,7 +141,7 @@ class Settings } /** - * Return the name of the class that is currently being used for cell cacheing + * Return the name of the class that is currently being used for cell cacheing. * * @return string Name of the class currently being used for cacheing */ @@ -149,10 +151,11 @@ class Settings } /** - * Set the method that should be used for cell caching + * Set the method that should be used for cell caching. * * @param string $method Name of the caching method * @param array $arguments Optional configuration arguments for the caching method + * * @return bool Success or failure */ public static function setCacheStorageMethod($method = CachedObjectStorageFactory::CACHE_IN_MEMORY, $arguments = []) @@ -161,9 +164,10 @@ class Settings } /** - * Set the locale code to use for formula translations and any special formatting + * Set the locale code to use for formula translations and any special formatting. * * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") + * * @return bool Success or failure */ public static function setLocale($locale = 'en_us') @@ -172,7 +176,7 @@ class Settings } /** - * Set details of the external library that PhpSpreadsheet should use for rendering charts + * Set details of the external library that PhpSpreadsheet should use for rendering charts. * * @param string $libraryName Internal reference name of the library * e.g. \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH @@ -190,7 +194,7 @@ class Settings } /** - * Identify to PhpSpreadsheet the external library to use for rendering charts + * Identify to PhpSpreadsheet the external library to use for rendering charts. * * @param string $libraryName Internal reference name of the library * e.g. \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH @@ -208,9 +212,10 @@ class Settings } /** - * Tell PhpSpreadsheet where to find the external library to use for rendering charts + * Tell PhpSpreadsheet where to find the external library to use for rendering charts. * * @param string $libraryBaseDir Directory path to the library's base folder + * * @return bool Success or failure */ public static function setChartRendererPath($libraryBaseDir) @@ -224,7 +229,7 @@ class Settings } /** - * Return the Chart Rendering Library that PhpSpreadsheet is currently configured to use (e.g. jpgraph) + * Return the Chart Rendering Library that PhpSpreadsheet is currently configured to use (e.g. jpgraph). * * @return string|null Internal reference name of the Chart Rendering Library that PhpSpreadsheet is * currently configured to use @@ -236,7 +241,7 @@ class Settings } /** - * Return the directory path to the Chart Rendering Library that PhpSpreadsheet is currently configured to use + * Return the directory path to the Chart Rendering Library that PhpSpreadsheet is currently configured to use. * * @return string|null Directory Path to the Chart Rendering Library that PhpSpreadsheet is * currently configured to use @@ -247,7 +252,7 @@ class Settings } /** - * Set details of the external library that PhpSpreadsheet should use for rendering PDF files + * Set details of the external library that PhpSpreadsheet should use for rendering PDF files. * * @param string $libraryName Internal reference name of the library * e.g. \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF, @@ -267,7 +272,7 @@ class Settings } /** - * Identify to PhpSpreadsheet the external library to use for rendering PDF files + * Identify to PhpSpreadsheet the external library to use for rendering PDF files. * * @param string $libraryName Internal reference name of the library * e.g. \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF, @@ -287,9 +292,10 @@ class Settings } /** - * Tell PhpSpreadsheet where to find the external library to use for rendering PDF files + * Tell PhpSpreadsheet where to find the external library to use for rendering PDF files. * * @param string $libraryBaseDir Directory path to the library's base folder + * * @return bool Success or failure */ public static function setPdfRendererPath($libraryBaseDir) @@ -303,7 +309,7 @@ class Settings } /** - * Return the PDF Rendering Library that PhpSpreadsheet is currently configured to use (e.g. dompdf) + * Return the PDF Rendering Library that PhpSpreadsheet is currently configured to use (e.g. dompdf). * * @return string|null Internal reference name of the PDF Rendering Library that PhpSpreadsheet is * currently configured to use @@ -317,7 +323,7 @@ class Settings } /** - * Return the directory path to the PDF Rendering Library that PhpSpreadsheet is currently configured to use + * Return the directory path to the PDF Rendering Library that PhpSpreadsheet is currently configured to use. * * @return string|null Directory Path to the PDF Rendering Library that PhpSpreadsheet is * currently configured to use @@ -328,7 +334,7 @@ class Settings } /** - * Set default options for libxml loader + * Set default options for libxml loader. * * @param int $options Default options for libxml loader */ diff --git a/src/PhpSpreadsheet/Shared/CodePage.php b/src/PhpSpreadsheet/Shared/CodePage.php index ad4b15bb..c06f8793 100644 --- a/src/PhpSpreadsheet/Shared/CodePage.php +++ b/src/PhpSpreadsheet/Shared/CodePage.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -27,10 +28,12 @@ class CodePage { /** * Convert Microsoft Code Page Identifier to Code Page Name which iconv - * and mbstring understands + * and mbstring understands. * * @param int $codePage Microsoft Code Page Indentifier + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return string Code Page Name */ public static function numberToName($codePage = 1252) diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index 98ed8bbd..361bfc0a 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -80,9 +81,10 @@ class Date protected static $defaultTimeZone; /** - * Set the Excel calendar (Windows 1900 or Mac 1904) + * Set the Excel calendar (Windows 1900 or Mac 1904). * * @param int $baseDate Excel base date (1900 or 1904) + * * @return bool Success or failure */ public static function setExcelCalendar($baseDate) @@ -98,7 +100,7 @@ class Date } /** - * Return the Excel calendar (Windows 1900 or Mac 1904) + * Return the Excel calendar (Windows 1900 or Mac 1904). * * @return int Excel base date (1900 or 1904) */ @@ -108,10 +110,12 @@ class Date } /** - * Set the Default timezone to use for dates + * Set the Default timezone to use for dates. * * @param string|\DateTimeZone $timeZone The timezone to set for all Excel datetimestamp to PHP DateTime Object conversions + * * @throws \Exception + * * @return bool Success or failure * @return bool Success or failure */ @@ -127,7 +131,7 @@ class Date } /** - * Return the Default timezone being used for dates + * Return the Default timezone being used for dates. * * @return \DateTimeZone The timezone being used as default for Excel timestamp to PHP DateTime object */ @@ -141,10 +145,12 @@ class Date } /** - * Validate a timezone + * Validate a timezone. * * @param string|\DateTimeZone $timeZone The timezone to validate, either as a timezone string or object + * * @throws \Exception + * * @return \DateTimeZone The timezone as a timezone object * @return \DateTimeZone The timezone as a timezone object */ @@ -159,13 +165,15 @@ class Date } /** - * Convert a MS serialized datetime value from Excel to a PHP Date/Time object + * Convert a MS serialized datetime value from Excel to a PHP Date/Time object. * * @param int|float $excelTimestamp MS Excel serialized date/time value * @param \DateTimeZone|string|null $timeZone The timezone to assume for the Excel timestamp, * if you don't want to treat it as a UTC value * Use the default (UST) unless you absolutely need a conversion + * * @throws \Exception + * * @return \DateTime PHP date/time object */ public static function excelToDateTimeObject($excelTimestamp = 0, $timeZone = null) @@ -198,13 +206,15 @@ class Date } /** - * Convert a MS serialized datetime value from Excel to a unix timestamp + * Convert a MS serialized datetime value from Excel to a unix timestamp. * * @param int|float $excelTimestamp MS Excel serialized date/time value * @param \DateTimeZone|string|null $timeZone The timezone to assume for the Excel timestamp, * if you don't want to treat it as a UTC value * Use the default (UST) unless you absolutely need a conversion + * * @throws \Exception + * * @return int Unix timetamp for this date/time */ public static function excelToTimestamp($excelTimestamp = 0, $timeZone = null) @@ -214,9 +224,10 @@ class Date } /** - * Convert a date from PHP to an MS Excel serialized date/time value + * Convert a date from PHP to an MS Excel serialized date/time value. * * @param mixed $dateValue Unix Timestamp or PHP DateTime object or a string + * * @return float|bool Excel date/time value * or boolean FALSE on failure */ @@ -234,9 +245,10 @@ class Date } /** - * Convert a PHP DateTime object to an MS Excel serialized date/time value + * Convert a PHP DateTime object to an MS Excel serialized date/time value. * * @param \DateTimeInterface $dateValue PHP DateTime object + * * @return float MS Excel serialized date/time value */ public static function dateTimeToExcel(\DateTimeInterface $dateValue = null) @@ -252,9 +264,10 @@ class Date } /** - * Convert a Unix timestamp to an MS Excel serialized date/time value + * Convert a Unix timestamp to an MS Excel serialized date/time value. * * @param \DateTimeInterface $dateValue Unix Timestamp + * * @return float MS Excel serialized date/time value */ public static function timestampToExcel($dateValue = 0) @@ -267,7 +280,7 @@ class Date } /** - * formattedPHPToExcel + * formattedPHPToExcel. * * @param int $year * @param int $month @@ -275,6 +288,7 @@ class Date * @param int $hours * @param int $minutes * @param int $seconds + * * @return float Excel date/time value */ public static function formattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0) @@ -316,6 +330,7 @@ class Date * Is a given cell a date/time? * * @param \PhpOffice\PhpSpreadsheet\Cell $pCell + * * @return bool */ public static function isDateTime(\PhpOffice\PhpSpreadsheet\Cell $pCell) @@ -331,6 +346,7 @@ class Date * Is a given number format a date/time? * * @param \PhpOffice\PhpSpreadsheet\Style\NumberFormat $pFormat + * * @return bool */ public static function isDateTimeFormat(\PhpOffice\PhpSpreadsheet\Style\NumberFormat $pFormat) @@ -344,6 +360,7 @@ class Date * Is a given number format code a date/time? * * @param string $pFormatCode + * * @return bool */ public static function isDateTimeFormatCode($pFormatCode = '') @@ -414,9 +431,10 @@ class Date } /** - * Convert a date/time string to Excel time + * Convert a date/time string to Excel time. * * @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10' + * * @return float|false Excel date/time serial value */ public static function stringToExcel($dateValue = '') @@ -446,9 +464,10 @@ class Date } /** - * Converts a month name (either a long or a short name) to a month number + * Converts a month name (either a long or a short name) to a month number. * * @param string $month Month name or abbreviation + * * @return int|string Month number (1 - 12), or the original string argument if it isn't a valid month name */ public static function monthStringToNumber($month) @@ -465,16 +484,17 @@ class Date } /** - * Strips an ordinal froma numeric value + * Strips an ordinal froma numeric value. * * @param string $day Day number with an ordinal + * * @return int|string The integer value with any ordinal stripped, or the original string argument if it isn't a valid numeric */ public static function dayStringToNumber($day) { $strippedDayValue = (str_replace(self::$numberSuffixes, '', $day)); if (is_numeric($strippedDayValue)) { - return (integer) $strippedDayValue; + return (int) $strippedDayValue; } return $day; diff --git a/src/PhpSpreadsheet/Shared/Drawing.php b/src/PhpSpreadsheet/Shared/Drawing.php index 81cd5f88..9b347622 100644 --- a/src/PhpSpreadsheet/Shared/Drawing.php +++ b/src/PhpSpreadsheet/Shared/Drawing.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,17 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Drawing { /** - * Convert pixels to EMU + * Convert pixels to EMU. * * @param int $pValue Value in pixels + * * @return int Value in EMU */ public static function pixelsToEMU($pValue = 0) @@ -37,18 +39,19 @@ class Drawing } /** - * Convert EMU to pixels + * Convert EMU to pixels. * * @param int $pValue Value in EMU + * * @return int Value in pixels */ public static function EMUToPixels($pValue = 0) { if ($pValue != 0) { return round($pValue / 9525); - } else { - return 0; } + + return 0; } /** @@ -58,6 +61,7 @@ class Drawing * * @param int $pValue Value in pixels * @param \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont Default font of the workbook + * * @return int Value in cell dimension */ public static function pixelsToCellDimension($pValue, \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont) @@ -79,10 +83,11 @@ class Drawing } /** - * Convert column width from (intrinsic) Excel units to pixels + * Convert column width from (intrinsic) Excel units to pixels. * * @param float $pValue Value in cell dimension * @param \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont Default font of the workbook + * * @return int Value in pixels */ public static function cellDimensionToPixels($pValue, \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont) @@ -107,9 +112,10 @@ class Drawing } /** - * Convert pixels to points + * Convert pixels to points. * * @param int $pValue Value in pixels + * * @return float Value in points */ public static function pixelsToPoints($pValue = 0) @@ -118,24 +124,26 @@ class Drawing } /** - * Convert points to pixels + * Convert points to pixels. * * @param int $pValue Value in points + * * @return int Value in pixels */ public static function pointsToPixels($pValue = 0) { if ($pValue != 0) { return (int) ceil($pValue * 1.333333333); - } else { - return 0; } + + return 0; } /** - * Convert degrees to angle + * Convert degrees to angle. * * @param int $pValue Degrees + * * @return int Angle */ public static function degreesToAngle($pValue = 0) @@ -144,25 +152,28 @@ class Drawing } /** - * Convert angle to degrees + * Convert angle to degrees. * * @param int $pValue Angle + * * @return int Degrees */ public static function angleToDegrees($pValue = 0) { if ($pValue != 0) { return round($pValue / 60000); - } else { - return 0; } + + return 0; } /** - * Create a new image from file. By alexander at alexauto dot nl + * Create a new image from file. By alexander at alexauto dot nl. + * + * @see http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214 * - * @link http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214 * @param string $p_sFile Path to Windows DIB (BMP) image + * * @return resource */ public static function imagecreatefrombmp($p_sFile) diff --git a/src/PhpSpreadsheet/Shared/Escher.php b/src/PhpSpreadsheet/Shared/Escher.php index fd3ca429..973a692c 100644 --- a/src/PhpSpreadsheet/Shared/Escher.php +++ b/src/PhpSpreadsheet/Shared/Escher.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Escher { /** - * Drawing Group Container + * Drawing Group Container. * * @var \DggContainer */ private $dggContainer; /** - * Drawing Container + * Drawing Container. * * @var Escher\DgContainer */ private $dgContainer; /** - * Get Drawing Group Container + * Get Drawing Group Container. * * @return Escher\DgContainer */ @@ -50,7 +51,7 @@ class Escher } /** - * Set Drawing Group Container + * Set Drawing Group Container. * * @param Escher\DggContainer $dggContainer */ @@ -60,7 +61,7 @@ class Escher } /** - * Get Drawing Container + * Get Drawing Container. * * @return Escher\DgContainer */ @@ -70,7 +71,7 @@ class Escher } /** - * Set Drawing Container + * Set Drawing Container. * * @param Escher\DgContainer $dgContainer */ diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php index fb84afbb..5572c940 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,7 +34,7 @@ class DgContainer private $dgId; /** - * Last shape index in this drawing + * Last shape index in this drawing. * * @var int */ diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php index dfda4a04..f32565d3 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class SpgrContainer { /** - * Parent Shape Group Container + * Parent Shape Group Container. * * @var \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer */ private $parent; /** - * Shape Container collection + * Shape Container collection. * * @var array */ private $children = []; /** - * Set parent Shape Group Container + * Set parent Shape Group Container. * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer $parent */ @@ -50,7 +51,7 @@ class SpgrContainer } /** - * Get the parent Shape Group Container if any + * Get the parent Shape Group Container if any. * * @return \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer|null */ @@ -60,7 +61,7 @@ class SpgrContainer } /** - * Add a child. This will be either spgrContainer or spContainer + * Add a child. This will be either spgrContainer or spContainer. * * @param mixed $child */ @@ -71,7 +72,7 @@ class SpgrContainer } /** - * Get collection of Shape Containers + * Get collection of Shape Containers. */ public function getChildren() { @@ -79,7 +80,7 @@ class SpgrContainer } /** - * Recursively get all spContainers within this spgrContainer + * Recursively get all spContainers within this spgrContainer. * * @return SpgrContainer\SpContainer[] */ diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php index 849ef8af..a00dfe2c 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class SpContainer { /** - * Parent Shape Group Container + * Parent Shape Group Container. * * @var \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer */ @@ -40,77 +41,77 @@ class SpContainer private $spgr = false; /** - * Shape type + * Shape type. * * @var int */ private $spType; /** - * Shape flag + * Shape flag. * * @var int */ private $spFlag; /** - * Shape index (usually group shape has index 0, and the rest: 1,2,3...) + * Shape index (usually group shape has index 0, and the rest: 1,2,3...). * * @var int */ private $spId; /** - * Array of options + * Array of options. * * @var array */ private $OPT; /** - * Cell coordinates of upper-left corner of shape, e.g. 'A1' + * Cell coordinates of upper-left corner of shape, e.g. 'A1'. * * @var string */ private $startCoordinates; /** - * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width + * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width. * * @var int */ private $startOffsetX; /** - * Vertical offset of upper-left corner of shape measured in 1/256 of row height + * Vertical offset of upper-left corner of shape measured in 1/256 of row height. * * @var int */ private $startOffsetY; /** - * Cell coordinates of bottom-right corner of shape, e.g. 'B2' + * Cell coordinates of bottom-right corner of shape, e.g. 'B2'. * * @var string */ private $endCoordinates; /** - * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width + * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width. * * @var int */ private $endOffsetX; /** - * Vertical offset of bottom-right corner of shape measured in 1/256 of row height + * Vertical offset of bottom-right corner of shape measured in 1/256 of row height. * * @var int */ private $endOffsetY; /** - * Set parent Shape Group Container + * Set parent Shape Group Container. * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer $parent */ @@ -120,7 +121,7 @@ class SpContainer } /** - * Get the parent Shape Group Container + * Get the parent Shape Group Container. * * @return \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer */ @@ -130,7 +131,7 @@ class SpContainer } /** - * Set whether this is a group shape + * Set whether this is a group shape. * * @param bool $value */ @@ -140,7 +141,7 @@ class SpContainer } /** - * Get whether this is a group shape + * Get whether this is a group shape. * * @return bool */ @@ -150,7 +151,7 @@ class SpContainer } /** - * Set the shape type + * Set the shape type. * * @param int $value */ @@ -160,7 +161,7 @@ class SpContainer } /** - * Get the shape type + * Get the shape type. * * @return int */ @@ -170,7 +171,7 @@ class SpContainer } /** - * Set the shape flag + * Set the shape flag. * * @param int $value */ @@ -180,7 +181,7 @@ class SpContainer } /** - * Get the shape flag + * Get the shape flag. * * @return int */ @@ -190,7 +191,7 @@ class SpContainer } /** - * Set the shape index + * Set the shape index. * * @param int $value */ @@ -200,7 +201,7 @@ class SpContainer } /** - * Get the shape index + * Get the shape index. * * @return int */ @@ -210,7 +211,7 @@ class SpContainer } /** - * Set an option for the Shape Group Container + * Set an option for the Shape Group Container. * * @param int $property The number specifies the option * @param mixed $value @@ -221,9 +222,10 @@ class SpContainer } /** - * Get an option for the Shape Group Container + * Get an option for the Shape Group Container. * * @param int $property The number specifies the option + * * @return mixed */ public function getOPT($property) @@ -236,7 +238,7 @@ class SpContainer } /** - * Get the collection of options + * Get the collection of options. * * @return array */ @@ -246,7 +248,7 @@ class SpContainer } /** - * Set cell coordinates of upper-left corner of shape + * Set cell coordinates of upper-left corner of shape. * * @param string $value */ @@ -256,7 +258,7 @@ class SpContainer } /** - * Get cell coordinates of upper-left corner of shape + * Get cell coordinates of upper-left corner of shape. * * @return string */ @@ -266,7 +268,7 @@ class SpContainer } /** - * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width + * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width. * * @param int $startOffsetX */ @@ -276,7 +278,7 @@ class SpContainer } /** - * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width + * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width. * * @return int */ @@ -286,7 +288,7 @@ class SpContainer } /** - * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height + * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height. * * @param int $startOffsetY */ @@ -296,7 +298,7 @@ class SpContainer } /** - * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height + * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height. * * @return int */ @@ -306,7 +308,7 @@ class SpContainer } /** - * Set cell coordinates of bottom-right corner of shape + * Set cell coordinates of bottom-right corner of shape. * * @param string $value */ @@ -316,7 +318,7 @@ class SpContainer } /** - * Get cell coordinates of bottom-right corner of shape + * Get cell coordinates of bottom-right corner of shape. * * @return string */ @@ -326,7 +328,7 @@ class SpContainer } /** - * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width + * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width. * * @param int $endOffsetX */ @@ -336,7 +338,7 @@ class SpContainer } /** - * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width + * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width. * * @return int */ @@ -346,7 +348,7 @@ class SpContainer } /** - * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height + * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height. * * @param int $endOffsetY */ @@ -356,7 +358,7 @@ class SpContainer } /** - * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height + * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height. * * @return int */ @@ -368,7 +370,7 @@ class SpContainer /** * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and * the dgContainer. A value of 1 = immediately within first spgrContainer - * Higher nesting level occurs if and only if spContainer is part of a shape group + * Higher nesting level occurs if and only if spContainer is part of a shape group. * * @return int Nesting level */ diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer.php index 5138260f..f0e8b287 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,55 +20,56 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class DggContainer { /** - * Maximum shape index of all shapes in all drawings increased by one + * Maximum shape index of all shapes in all drawings increased by one. * * @var int */ private $spIdMax; /** - * Total number of drawings saved + * Total number of drawings saved. * * @var int */ private $cDgSaved; /** - * Total number of shapes saved (including group shapes) + * Total number of shapes saved (including group shapes). * * @var int */ private $cSpSaved; /** - * BLIP Store Container + * BLIP Store Container. * * @var DggContainer\BstoreContainer */ private $bstoreContainer; /** - * Array of options for the drawing group + * Array of options for the drawing group. * * @var array */ private $OPT = []; /** - * Array of identifier clusters containg information about the maximum shape identifiers + * Array of identifier clusters containg information about the maximum shape identifiers. * * @var array */ private $IDCLs = []; /** - * Get maximum shape index of all shapes in all drawings (plus one) + * Get maximum shape index of all shapes in all drawings (plus one). * * @return int */ @@ -78,9 +79,10 @@ class DggContainer } /** - * Set maximum shape index of all shapes in all drawings (plus one) + * Set maximum shape index of all shapes in all drawings (plus one). * * @param int + * @param mixed $value */ public function setSpIdMax($value) { @@ -88,7 +90,7 @@ class DggContainer } /** - * Get total number of drawings saved + * Get total number of drawings saved. * * @return int */ @@ -98,9 +100,10 @@ class DggContainer } /** - * Set total number of drawings saved + * Set total number of drawings saved. * * @param int + * @param mixed $value */ public function setCDgSaved($value) { @@ -108,7 +111,7 @@ class DggContainer } /** - * Get total number of shapes saved (including group shapes) + * Get total number of shapes saved (including group shapes). * * @return int */ @@ -118,9 +121,10 @@ class DggContainer } /** - * Set total number of shapes saved (including group shapes) + * Set total number of shapes saved (including group shapes). * * @param int + * @param mixed $value */ public function setCSpSaved($value) { @@ -128,7 +132,7 @@ class DggContainer } /** - * Get BLIP Store Container + * Get BLIP Store Container. * * @return DggContainer\BstoreContainer */ @@ -138,7 +142,7 @@ class DggContainer } /** - * Set BLIP Store Container + * Set BLIP Store Container. * * @param DggContainer\BstoreContainer $bstoreContainer */ @@ -148,7 +152,7 @@ class DggContainer } /** - * Set an option for the drawing group + * Set an option for the drawing group. * * @param int $property The number specifies the option * @param mixed $value @@ -159,9 +163,10 @@ class DggContainer } /** - * Get an option for the drawing group + * Get an option for the drawing group. * * @param int $property The number specifies the option + * * @return mixed */ public function getOPT($property) @@ -174,7 +179,7 @@ class DggContainer } /** - * Get identifier clusters + * Get identifier clusters. * * @return array */ @@ -184,7 +189,7 @@ class DggContainer } /** - * Set identifier clusters. array( => , ...) + * Set identifier clusters. array( => , ...). * * @param array $pValue */ diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php index 876d3d40..0e3f07a5 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class BstoreContainer { /** - * BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture) + * BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture). * * @var array */ private $BSECollection = []; /** - * Add a BLIP Store Entry + * Add a BLIP Store Entry. * * @param BstoreContainer\BSE $BSE */ @@ -44,7 +45,7 @@ class BstoreContainer } /** - * Get the collection of BLIP Store Entries + * Get the collection of BLIP Store Entries. * * @return BstoreContainer\BSE[] */ diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php index f7a382b9..d236ef53 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -37,28 +38,28 @@ class BSE const BLIPTYPE_CMYKJPEG = 0x12; /** - * The parent BLIP Store Entry Container + * The parent BLIP Store Entry Container. * * @var \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer */ private $parent; /** - * The BLIP (Big Large Image or Picture) + * The BLIP (Big Large Image or Picture). * * @var BSE\Blip */ private $blip; /** - * The BLIP type + * The BLIP type. * * @var int */ private $blipType; /** - * Set parent BLIP Store Entry Container + * Set parent BLIP Store Entry Container. * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer $parent */ @@ -68,7 +69,7 @@ class BSE } /** - * Get the BLIP + * Get the BLIP. * * @return BSE\Blip */ @@ -78,7 +79,7 @@ class BSE } /** - * Set the BLIP + * Set the BLIP. * * @param BSE\Blip $blip */ @@ -89,7 +90,7 @@ class BSE } /** - * Get the BLIP type + * Get the BLIP type. * * @return int */ @@ -99,9 +100,10 @@ class BSE } /** - * Set the BLIP type + * Set the BLIP type. * * @param int + * @param mixed $blipType */ public function setBlipType($blipType) { diff --git a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php index 6def6d54..9884ea70 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php +++ b/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BS * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Blip { /** - * The parent BSE + * The parent BSE. * * @var \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE */ private $parent; /** - * Raw image data + * Raw image data. * * @var string */ private $data; /** - * Get the raw image data + * Get the raw image data. * * @return string */ @@ -50,9 +51,10 @@ class Blip } /** - * Set the raw image data + * Set the raw image data. * * @param string + * @param mixed $data */ public function setData($data) { @@ -60,7 +62,7 @@ class Blip } /** - * Set parent BSE + * Set parent BSE. * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE $parent */ @@ -70,7 +72,7 @@ class Blip } /** - * Get parent BSE + * Get parent BSE. * * @return \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE $parent */ diff --git a/src/PhpSpreadsheet/Shared/File.php b/src/PhpSpreadsheet/Shared/File.php index e0eacab7..b4c96f17 100644 --- a/src/PhpSpreadsheet/Shared/File.php +++ b/src/PhpSpreadsheet/Shared/File.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -35,17 +36,17 @@ class File protected static $useUploadTempDirectory = false; /** - * Set the flag indicating whether the File Upload Temp directory should be used for temporary files + * Set the flag indicating whether the File Upload Temp directory should be used for temporary files. * * @param bool $useUploadTempDir Use File Upload Temporary directory (true or false) */ public static function setUseUploadTempDirectory($useUploadTempDir = false) { - self::$useUploadTempDirectory = (boolean) $useUploadTempDir; + self::$useUploadTempDirectory = (bool) $useUploadTempDir; } /** - * Get the flag indicating whether the File Upload Temp directory should be used for temporary files + * Get the flag indicating whether the File Upload Temp directory should be used for temporary files. * * @return bool Use File Upload Temporary directory (true or false) */ @@ -55,9 +56,10 @@ class File } /** - * Verify if a file exists + * Verify if a file exists. * * @param string $pFilename Filename + * * @return bool */ public static function fileExists($pFilename) @@ -77,19 +79,19 @@ class File $zip->close(); return $returnValue; - } else { - return false; } - } else { + + return false; + } // Regular file_exists return file_exists($pFilename); - } } /** - * Returns canonicalized absolute pathname, also for ZIP archives + * Returns canonicalized absolute pathname, also for ZIP archives. * * @param string $pFilename + * * @return string */ public static function realpath($pFilename) @@ -108,8 +110,8 @@ class File while (in_array('..', $pathArray) && $pathArray[0] != '..') { for ($i = 0; $i < count($pathArray); ++$i) { if ($pathArray[$i] == '..' && $i > 0) { - unset($pathArray[$i]); - unset($pathArray[$i - 1]); + unset($pathArray[$i], $pathArray[$i - 1]); + break; } } @@ -178,8 +180,10 @@ class File } /** - * Assert that given path is an existing file and is readable, otherwise throw exception + * Assert that given path is an existing file and is readable, otherwise throw exception. + * * @param string $filename + * * @throws \InvalidArgumentException */ public static function assertFile($filename) diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 0521336c..ea31b817 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -118,14 +119,14 @@ class Font const VERDANA_BOLD_ITALIC = 'verdanaz.ttf'; /** - * AutoSize method + * AutoSize method. * * @var string */ private static $autoSizeMethod = self::AUTOSIZE_METHOD_APPROX; /** - * Path to folder containing TrueType font .ttf files + * Path to folder containing TrueType font .ttf files. * * @var string */ @@ -179,9 +180,10 @@ class Font ]; /** - * Set autoSize method + * Set autoSize method. * * @param string $pValue + * * @return bool Success or failure */ public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX) @@ -195,7 +197,7 @@ class Font } /** - * Get autoSize method + * Get autoSize method. * * @return string */ @@ -211,7 +213,7 @@ class Font *
  • C:/Windows/Fonts/
  • *
  • /usr/share/fonts/truetype/
  • *
  • ~/.fonts/
  • - * + * . * * @param string $pValue */ @@ -231,12 +233,13 @@ class Font } /** - * Calculate an (approximate) OpenXML column width, based on font size and text contained + * Calculate an (approximate) OpenXML column width, based on font size and text contained. * * @param \PhpOffice\PhpSpreadsheet\Style\Font $font Font object * @param \PhpOffice\PhpSpreadsheet\RichText|string $cellText Text to calculate width * @param int $rotation Rotation angle * @param \PhpOffice\PhpSpreadsheet\Style\Font|null $defaultFont Font object + * * @return int Column width */ public static function calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, $cellText = '', $rotation = 0, \PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null) @@ -285,12 +288,14 @@ class Font } /** - * Get GD text width in pixels for a string of text in a certain font at a certain rotation angle + * Get GD text width in pixels for a string of text in a certain font at a certain rotation angle. * * @param string $text * @param \PhpOffice\PhpSpreadsheet\Style\Font * @param int $rotation + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return int */ public static function getTextWidthPixelsExact($text, \PhpOffice\PhpSpreadsheet\Style\Font $font, $rotation = 0) @@ -317,11 +322,12 @@ class Font } /** - * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle + * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle. * * @param string $columnText * @param \PhpOffice\PhpSpreadsheet\Style\Font $font * @param int $rotation + * * @return int Text width in pixels (no padding added) */ public static function getTextWidthPixelsApprox($columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font = null, $rotation = 0) @@ -336,19 +342,16 @@ class Font $columnWidth = (int) (8.26 * StringHelper::countCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size break; - case 'Arial': // value 8 was set because of experience in different exports at Arial 10 font. $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size break; - case 'Verdana': // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font. $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size break; - default: // just assume Calibri $columnWidth = (int) (8.26 * StringHelper::countCharacters($columnText)); @@ -373,9 +376,10 @@ class Font } /** - * Calculate an (approximate) pixel size, based on a font points size + * Calculate an (approximate) pixel size, based on a font points size. * * @param int $fontSizeInPoints Font size (in points) + * * @return int Font size (in pixels) */ public static function fontSizeToPixels($fontSizeInPoints = 11) @@ -384,9 +388,10 @@ class Font } /** - * Calculate an (approximate) pixel size, based on inch size + * Calculate an (approximate) pixel size, based on inch size. * * @param int $sizeInInch Font size (in inch) + * * @return int Size (in pixels) */ public static function inchSizeToPixels($sizeInInch = 1) @@ -395,9 +400,10 @@ class Font } /** - * Calculate an (approximate) pixel size, based on centimeter size + * Calculate an (approximate) pixel size, based on centimeter size. * * @param int $sizeInCm Font size (in centimeters) + * * @return float Size (in pixels) */ public static function centimeterSizeToPixels($sizeInCm = 1) @@ -406,9 +412,10 @@ class Font } /** - * Returns the font path given the font + * Returns the font path given the font. * * @param \PhpOffice\PhpSpreadsheet\Style\Font $font + * * @return string Path to TrueType font file */ public static function getTrueTypeFontFileFromFont($font) @@ -521,6 +528,7 @@ class Font * Returns the associated charset for the font name. * * @param string $name Font name + * * @return int Character set code */ public static function getCharsetFromFontName($name) @@ -542,10 +550,11 @@ class Font /** * Get the effective column width for columns without a column dimension or column with width -1 - * For example, for Calibri 11 this is 9.140625 (64 px) + * For example, for Calibri 11 this is 9.140625 (64 px). * * @param \PhpOffice\PhpSpreadsheet\Style\Font $font The workbooks default font * @param bool $pPixels true = return column width in pixels, false = return in OOXML units + * * @return mixed Column width */ public static function getDefaultColumnWidthByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font, $pPixels = false) @@ -574,9 +583,10 @@ class Font /** * Get the effective row height for rows without a row dimension or rows with height -1 - * For example, for Calibri 11 this is 15 points + * For example, for Calibri 11 this is 15 points. * * @param \PhpOffice\PhpSpreadsheet\Style\Font $font The workbooks default font + * * @return float Row height in points */ public static function getDefaultRowHeightByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) @@ -624,7 +634,6 @@ class Font break; } break; - case 'Calibri': switch ($font->getSize()) { case 11: @@ -671,7 +680,6 @@ class Font break; } break; - case 'Verdana': switch ($font->getSize()) { case 10: diff --git a/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php index 65152a57..0fda6144 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; /** - * Cholesky decomposition class + * Cholesky decomposition class. * * For a symmetric, positive definite matrix A, the Cholesky decomposition * is an lower triangular matrix L so that A = L*L'. @@ -14,33 +14,39 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; * * @author Paul Meagher * @author Michael Bommarito + * * @version 1.2 */ class CholeskyDecomposition { /** - * Decomposition storage + * Decomposition storage. + * * @var array */ private $L = []; /** - * Matrix row and column dimension + * Matrix row and column dimension. + * * @var int */ private $m; /** - * Symmetric positive definite flag + * Symmetric positive definite flag. + * * @var bool */ private $isspd = true; /** - * CholeskyDecomposition + * CholeskyDecomposition. * * Class constructor - decomposes symmetric positive definite matrix + * * @param mixed Matrix square symmetric positive definite matrix + * @param null|mixed $A */ public function __construct($A = null) { @@ -73,7 +79,9 @@ class CholeskyDecomposition } else { throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION)); } - } // function __construct() + } + + // function __construct() /** * Is the matrix symmetric and positive definite? @@ -83,23 +91,29 @@ class CholeskyDecomposition public function isSPD() { return $this->isspd; - } // function isSPD() + } + + // function isSPD() /** - * getL + * getL. * * Return triangular factor. + * * @return Matrix Lower triangular matrix */ public function getL() { return new Matrix($this->L); - } // function getL() + } + + // function getL() /** - * Solve A*X = B + * Solve A*X = B. * * @param $B Row-equal matrix + * * @return Matrix L * L' * X = B */ public function solve($B = null) @@ -133,14 +147,13 @@ class CholeskyDecomposition } return new Matrix($X, $this->m, $nx); - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixSPDException)); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MATRIX_DIMENSION_EXCEPTION)); + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixSPDException)); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION)); + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MATRIX_DIMENSION_EXCEPTION)); } - } // function solve() + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION)); + } + + // function solve() } diff --git a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php index ad69ec48..bbbd3797 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php @@ -20,24 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; * * @author Paul Meagher * @license PHP v3.0 + * * @version 1.1 */ class EigenvalueDecomposition { /** * Row and column dimension (square matrix). + * * @var int */ private $n; /** * Internal symmetry flag. + * * @var int */ private $issymmetric; /** * Arrays for internal storage of eigenvalues. + * * @var array */ private $d = []; @@ -45,24 +49,28 @@ class EigenvalueDecomposition /** * Array for internal storage of eigenvectors. + * * @var array */ private $V = []; /** * Array for internal storage of nonsymmetric Hessenberg form. + * * @var array */ private $H = []; /** * Working storage for nonsymmetric algorithm. + * * @var array */ private $ort; /** * Used for complex scalar division. + * * @var float */ private $cdivr; @@ -364,6 +372,11 @@ class EigenvalueDecomposition /** * Performs complex division. + * + * @param mixed $xr + * @param mixed $xi + * @param mixed $yr + * @param mixed $yi */ private function cdiv($xr, $xi, $yr, $yi) { @@ -763,13 +776,17 @@ class EigenvalueDecomposition $this->V[$i][$j] = $z; } } - } // end hqr2 + } + + // end hqr2 /** - * Constructor: Check for symmetry, then construct the eigenvalue decomposition + * Constructor: Check for symmetry, then construct the eigenvalue decomposition. * * @param A Square matrix - * @return Structure to access D and V. + * @param mixed $Arg + * + * @return Structure to access D and V */ public function __construct($Arg) { @@ -800,7 +817,7 @@ class EigenvalueDecomposition } /** - * Return the eigenvector matrix + * Return the eigenvector matrix. * * @return V */ @@ -810,7 +827,7 @@ class EigenvalueDecomposition } /** - * Return the real parts of the eigenvalues + * Return the real parts of the eigenvalues. * * @return real(diag(D)) */ @@ -820,7 +837,7 @@ class EigenvalueDecomposition } /** - * Return the imaginary parts of the eigenvalues + * Return the imaginary parts of the eigenvalues. * * @return imag(diag(D)) */ @@ -830,7 +847,7 @@ class EigenvalueDecomposition } /** - * Return the block diagonal eigenvalue matrix + * Return the block diagonal eigenvalue matrix. * * @return D */ diff --git a/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php index 73f15e33..996fe317 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php @@ -16,7 +16,9 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; * @author Paul Meagher * @author Bartosz Matosiuk * @author Michael Bommarito + * * @version 1.1 + * * @license PHP v3.0 */ class LUDecomposition @@ -25,31 +27,36 @@ class LUDecomposition const MATRIX_SQUARE_EXCEPTION = 'Mismatched Row dimension'; /** - * Decomposition storage + * Decomposition storage. + * * @var array */ private $LU = []; /** * Row dimension. + * * @var int */ private $m; /** * Column dimension. + * * @var int */ private $n; /** * Pivot sign. + * * @var int */ private $pivsign; /** * Internal storage of pivot vector. + * * @var array */ private $piv = []; @@ -58,7 +65,8 @@ class LUDecomposition * LU Decomposition constructor. * * @param Matrix $A Rectangular matrix - * @return Structure to access L, U and piv. + * + * @return Structure to access L, U and piv */ public function __construct($A) { @@ -118,7 +126,9 @@ class LUDecomposition } else { throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(Matrix::ARGUMENT_TYPE_EXCEPTION); } - } // function __construct() + } + + // function __construct() /** * Get lower triangular factor. @@ -140,7 +150,9 @@ class LUDecomposition } return new Matrix($L); - } // function getL() + } + + // function getL() /** * Get upper triangular factor. @@ -160,7 +172,9 @@ class LUDecomposition } return new Matrix($U); - } // function getU() + } + + // function getU() /** * Return pivot permutation vector. @@ -170,22 +184,26 @@ class LUDecomposition public function getPivot() { return $this->piv; - } // function getPivot() + } + + // function getPivot() /** - * Alias for getPivot + * Alias for getPivot. * * @see getPivot */ public function getDoublePivot() { return $this->getPivot(); - } // function getDoublePivot() + } + + // function getDoublePivot() /** * Is the matrix nonsingular? * - * @return bool true if U, and hence A, is nonsingular. + * @return bool true if U, and hence A, is nonsingular */ public function isNonsingular() { @@ -196,10 +214,12 @@ class LUDecomposition } return true; - } // function isNonsingular() + } + + // function isNonsingular() /** - * Count determinants + * Count determinants. * * @return array d matrix deterninat */ @@ -212,17 +232,20 @@ class LUDecomposition } return $d; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(Matrix::MATRIX_DIMENSION_EXCEPTION); } - } // function det() + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(Matrix::MATRIX_DIMENSION_EXCEPTION); + } + + // function det() /** - * Solve A*X = B + * Solve A*X = B. + * + * @param $B a Matrix with as many rows as A and any number of columns + * + * @throws \PhpOffice\PhpSpreadsheet\Calculation\Exception illegalArgumentException Matrix row dimensions must agree + * @throws \PhpOffice\PhpSpreadsheet\Calculation\Exception runtimeException Matrix is singular * - * @param $B A Matrix with as many rows as A and any number of columns. - * @throws \PhpOffice\PhpSpreadsheet\Calculation\Exception IllegalArgumentException Matrix row dimensions must agree. - * @throws \PhpOffice\PhpSpreadsheet\Calculation\Exception RuntimeException Matrix is singular. * @return X so that L*U*X = B(piv,:) */ public function solve($B) @@ -253,11 +276,9 @@ class LUDecomposition } return $X; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_SINGULAR_EXCEPTION); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_SQUARE_EXCEPTION); + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_SINGULAR_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_SQUARE_EXCEPTION); } } diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index b8860a95..21242360 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -22,28 +22,28 @@ class Matrix const ARRAY_LENGTH_EXCEPTION = 'Array length must be a multiple of m.'; /** - * Matrix storage + * Matrix storage. * * @var array */ public $A = []; /** - * Matrix row dimension + * Matrix row dimension. * * @var int */ private $m; /** - * Matrix column dimension + * Matrix column dimension. * * @var int */ private $n; /** - * Polymorphic constructor + * Polymorphic constructor. * * As PHP has no support for polymorphic constructors, we use tricks to make our own sort of polymorphism using func_num_args, func_get_arg, and gettype. In essence, we're just implementing a simple RTTI filter and calling the appropriate constructor. */ @@ -100,7 +100,7 @@ class Matrix } /** - * getArray + * getArray. * * @return array Matrix array */ @@ -110,7 +110,7 @@ class Matrix } /** - * getRowDimension + * getRowDimension. * * @return int Row dimension */ @@ -120,7 +120,7 @@ class Matrix } /** - * getColumnDimension + * getColumnDimension. * * @return int Column dimension */ @@ -130,11 +130,13 @@ class Matrix } /** - * get + * get. * * Get the i,j-th element of the matrix. + * * @param int $i Row position * @param int $j Column position + * * @return mixed Element (int/float/double) */ public function get($i = null, $j = null) @@ -143,13 +145,15 @@ class Matrix } /** - * getMatrix + * getMatrix. * * Get a submatrix + * * @param int $i0 Initial row index * @param int $iF Final row index * @param int $j0 Initial column index * @param int $jF Final column index + * * @return Matrix Submatrix */ public function getMatrix() @@ -279,10 +283,12 @@ class Matrix } /** - * checkMatrixDimensions + * checkMatrixDimensions. * * Is matrix B the same size? + * * @param Matrix $B Matrix B + * * @return bool */ public function checkMatrixDimensions($B = null) @@ -290,35 +296,41 @@ class Matrix if ($B instanceof self) { if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) { return true; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_DIMENSION_EXCEPTION); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_DIMENSION_EXCEPTION); } - } // function checkMatrixDimensions() + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); + } + + // function checkMatrixDimensions() /** - * set + * set. * * Set the i,j-th element of the matrix. + * * @param int $i Row position * @param int $j Column position * @param mixed $c Int/float/double value + * * @return mixed Element (int/float/double) */ public function set($i = null, $j = null, $c = null) { // Optimized set version just has this $this->A[$i][$j] = $c; - } // function set() + } + + // function set() /** - * identity + * identity. * * Generate an identity matrix. + * * @param int $m Row dimension * @param int $n Column dimension + * * @return Matrix Identity matrix */ public function identity($m = null, $n = null) @@ -327,12 +339,14 @@ class Matrix } /** - * diagonal + * diagonal. * * Generate a diagonal matrix + * * @param int $m Row dimension * @param int $n Column dimension * @param mixed $c Diagonal value + * * @return Matrix Diagonal matrix */ public function diagonal($m = null, $n = null, $c = 1) @@ -346,11 +360,13 @@ class Matrix } /** - * getMatrixByRow + * getMatrixByRow. * * Get a submatrix by row index/range + * * @param int $i0 Initial row index * @param int $iF Final row index + * * @return Matrix Submatrix */ public function getMatrixByRow($i0 = null, $iF = null) @@ -358,20 +374,21 @@ class Matrix if (is_int($i0)) { if (is_int($iF)) { return $this->getMatrix($i0, 0, $iF + 1, $this->n); - } else { - return $this->getMatrix($i0, 0, $i0 + 1, $this->n); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); + + return $this->getMatrix($i0, 0, $i0 + 1, $this->n); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } /** - * getMatrixByCol + * getMatrixByCol. * * Get a submatrix by column index/range + * * @param int $j0 Initial column index * @param int $jF Final column index + * * @return Matrix Submatrix */ public function getMatrixByCol($j0 = null, $jF = null) @@ -379,18 +396,18 @@ class Matrix if (is_int($j0)) { if (is_int($jF)) { return $this->getMatrix(0, $j0, $this->m, $jF + 1); - } else { - return $this->getMatrix(0, $j0, $this->m, $j0 + 1); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); + + return $this->getMatrix(0, $j0, $this->m, $j0 + 1); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } /** - * transpose + * transpose. * * Tranpose matrix + * * @return Matrix Transposed matrix */ public function transpose() @@ -403,12 +420,15 @@ class Matrix } return $R; - } // function transpose() + } + + // function transpose() /** - * trace + * trace. * * Sum of diagonal elements + * * @return float Sum of diagonal elements */ public function trace() @@ -423,9 +443,10 @@ class Matrix } /** - * uminus + * uminus. * * Unary minus matrix -A + * * @return Matrix Unary minus matrix */ public function uminus() @@ -433,10 +454,12 @@ class Matrix } /** - * plus + * plus. * * A + B + * * @param mixed $B Matrix/Array + * * @return Matrix Sum */ public function plus() @@ -468,16 +491,17 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * plusEquals + * plusEquals. * * A = A + B + * * @param mixed $B Matrix/Array + * * @return Matrix Sum */ public function plusEquals() @@ -523,16 +547,17 @@ class Matrix } return $this; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * minus + * minus. * * A - B + * * @param mixed $B Matrix/Array + * * @return Matrix Sum */ public function minus() @@ -564,16 +589,17 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * minusEquals + * minusEquals. * * A = A - B + * * @param mixed $B Matrix/Array + * * @return Matrix Sum */ public function minusEquals() @@ -619,17 +645,18 @@ class Matrix } return $this; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * arrayTimes + * arrayTimes. * * Element-by-element multiplication * Cij = Aij * Bij + * * @param mixed $B Matrix/Array + * * @return Matrix Matrix Cij */ public function arrayTimes() @@ -661,17 +688,18 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * arrayTimesEquals + * arrayTimesEquals. * * Element-by-element multiplication * Aij = Aij * Bij + * * @param mixed $B Matrix/Array + * * @return Matrix Matrix Aij */ public function arrayTimesEquals() @@ -717,17 +745,18 @@ class Matrix } return $this; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * arrayRightDivide + * arrayRightDivide. * * Element-by-element right division * A / B + * * @param Matrix $B Matrix B + * * @return Matrix Division result */ public function arrayRightDivide() @@ -778,17 +807,18 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * arrayRightDivideEquals + * arrayRightDivideEquals. * * Element-by-element right division * Aij = Aij / Bij + * * @param mixed $B Matrix/Array + * * @return Matrix Matrix Aij */ public function arrayRightDivideEquals() @@ -820,17 +850,18 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * arrayLeftDivide + * arrayLeftDivide. * * Element-by-element Left division * A / B + * * @param Matrix $B Matrix B + * * @return Matrix Division result */ public function arrayLeftDivide() @@ -862,17 +893,18 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * arrayLeftDivideEquals + * arrayLeftDivideEquals. * * Element-by-element Left division * Aij = Aij / Bij + * * @param mixed $B Matrix/Array + * * @return Matrix Matrix Aij */ public function arrayLeftDivideEquals() @@ -904,16 +936,17 @@ class Matrix } return $M; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * times + * times. * * Matrix multiplication + * * @param mixed $n Matrix/Array/Scalar + * * @return Matrix Product */ public function times() @@ -946,9 +979,8 @@ class Matrix } return $C; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); break; case 'array': $B = new self($args[0]); @@ -965,10 +997,8 @@ class Matrix } return $C; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); } - + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); return $M; break; case 'integer': @@ -1011,10 +1041,12 @@ class Matrix } /** - * power + * power. * * A = A ^ B + * * @param mixed $B Matrix/Array + * * @return Matrix Sum */ public function power() @@ -1060,16 +1092,17 @@ class Matrix } return $this; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** - * concat + * concat. * * A = A & B + * * @param mixed $B Matrix/Array + * * @return Matrix Sum */ public function concat() @@ -1101,15 +1134,15 @@ class Matrix } return $this; - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } /** * Solve A*X = B. * * @param Matrix $B Right hand side + * * @return Matrix ... Solution if A is square, least squares solution otherwise */ public function solve($B) @@ -1118,11 +1151,10 @@ class Matrix $LU = new LUDecomposition($this); return $LU->solve($B); - } else { - $QR = new QRDecomposition($this); - - return $QR->solve($B); } + $QR = new QRDecomposition($this); + + return $QR->solve($B); } /** @@ -1136,9 +1168,10 @@ class Matrix } /** - * det + * det. * * Calculate determinant + * * @return float Determinant */ public function det() diff --git a/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php index b2447040..c664e77a 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php @@ -15,6 +15,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; * * @author Paul Meagher * @license PHP v3.0 + * * @version 1.1 */ class QRDecomposition @@ -23,24 +24,28 @@ class QRDecomposition /** * Array for internal storage of decomposition. + * * @var array */ private $QR = []; /** * Row dimension. + * * @var int */ private $m; /** * Column dimension. + * * @var int */ private $n; /** * Array for internal storage of diagonal of R. + * * @var array */ private $Rdiag = []; @@ -49,7 +54,8 @@ class QRDecomposition * QR Decomposition computed by Householder reflections. * * @param matrix $A Rectangular matrix - * @return Structure to access R and the Householder vectors and compute Q. + * + * @return Structure to access R and the Householder vectors and compute Q */ public function __construct($A) { @@ -91,12 +97,14 @@ class QRDecomposition } else { throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(Matrix::ARGUMENT_TYPE_EXCEPTION); } - } // function __construct() + } + + // function __construct() /** * Is the matrix full rank? * - * @return bool true if R, and hence A, has full rank, else false. + * @return bool true if R, and hence A, has full rank, else false */ public function isFullRank() { @@ -107,10 +115,12 @@ class QRDecomposition } return true; - } // function isFullRank() + } + + // function isFullRank() /** - * Return the Householder vectors + * Return the Householder vectors. * * @return Matrix Lower trapezoidal matrix whose columns define the reflections */ @@ -127,10 +137,12 @@ class QRDecomposition } return new Matrix($H); - } // function getH() + } + + // function getH() /** - * Return the upper triangular factor + * Return the upper triangular factor. * * @return Matrix upper triangular factor */ @@ -149,10 +161,12 @@ class QRDecomposition } return new Matrix($R); - } // function getR() + } + + // function getR() /** - * Generate and return the (economy-sized) orthogonal factor + * Generate and return the (economy-sized) orthogonal factor. * * @return Matrix orthogonal factor */ @@ -186,13 +200,16 @@ class QRDecomposition } */ return new Matrix($Q); - } // function getQ() + } + + // function getQ() /** - * Least squares solution of A*X = B + * Least squares solution of A*X = B. * - * @param Matrix $B A Matrix with as many rows as A and any number of columns. - * @return Matrix Matrix that minimizes the two norm of Q*R*X-B. + * @param Matrix $B a Matrix with as many rows as A and any number of columns + * + * @return Matrix matrix that minimizes the two norm of Q*R*X-B */ public function solve($B) { @@ -228,11 +245,9 @@ class QRDecomposition $X = new Matrix($X); return $X->getMatrix(0, $this->n - 1, 0, $nx); - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_RANK_EXCEPTION); } - } else { - throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(Matrix::MATRIX_DIMENSION_EXCEPTION); + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::MATRIX_RANK_EXCEPTION); } + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(Matrix::MATRIX_DIMENSION_EXCEPTION); } } diff --git a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php index 3c53cd14..c78d0b25 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php @@ -16,47 +16,55 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; * * @author Paul Meagher * @license PHP v3.0 + * * @version 1.1 */ class SingularValueDecomposition { /** * Internal storage of U. + * * @var array */ private $U = []; /** * Internal storage of V. + * * @var array */ private $V = []; /** * Internal storage of singular values. + * * @var array */ private $s = []; /** * Row dimension. + * * @var int */ private $m; /** * Column dimension. + * * @var int */ private $n; /** - * Construct the singular value decomposition + * Construct the singular value decomposition. * * Derived from LINPACK code. * * @param $A Rectangular matrix - * @return Structure to access U, S and V. + * @param mixed $Arg + * + * @return Structure to access U, S and V */ public function __construct($Arg) { @@ -426,10 +434,12 @@ class SingularValueDecomposition break; } // end switch } // end while - } // end constructor + } + + // end constructor /** - * Return the left singular vectors + * Return the left singular vectors. * * @return U */ @@ -439,7 +449,7 @@ class SingularValueDecomposition } /** - * Return the right singular vectors + * Return the right singular vectors. * * @return V */ @@ -449,9 +459,9 @@ class SingularValueDecomposition } /** - * Return the one-dimensional array of singular values + * Return the one-dimensional array of singular values. * - * @return diagonal of S. + * @return diagonal of S */ public function getSingularValues() { @@ -459,7 +469,7 @@ class SingularValueDecomposition } /** - * Return the diagonal matrix of singular values + * Return the diagonal matrix of singular values. * * @return S */ @@ -476,7 +486,7 @@ class SingularValueDecomposition } /** - * Two norm + * Two norm. * * @return max(S) */ @@ -486,7 +496,7 @@ class SingularValueDecomposition } /** - * Two norm condition number + * Two norm condition number. * * @return max(S)/min(S) */ @@ -496,9 +506,9 @@ class SingularValueDecomposition } /** - * Effective numerical matrix rank + * Effective numerical matrix rank. * - * @return Number of nonnegligible singular values. + * @return Number of nonnegligible singular values */ public function rank() { diff --git a/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php b/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php index 3ea82186..f2950631 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php +++ b/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php @@ -1,7 +1,9 @@ * @author Christian Schmidt + * * @category PhpSpreadsheet */ class OLE @@ -45,43 +46,50 @@ class OLE const OLE_PPS_SIZE = 0x80; /** - * The file handle for reading an OLE container + * The file handle for reading an OLE container. + * * @var resource */ public $_file_handle; /** - * Array of PPS's found on the OLE container + * Array of PPS's found on the OLE container. + * * @var array */ public $_list = []; /** - * Root directory of OLE container + * Root directory of OLE container. + * * @var OLE_PPS_Root */ public $root; /** - * Big Block Allocation Table + * Big Block Allocation Table. + * * @var array (blockId => nextBlockId) */ public $bbat; /** - * Short Block Allocation Table + * Short Block Allocation Table. + * * @var array (blockId => nextBlockId) */ public $sbat; /** * Size of big blocks. This is usually 512. - * @var int number of octets per block. + * + * @var int number of octets per block */ public $bigBlockSize; /** * Size of small blocks. This is usually 64. + * * @var int number of octets per block */ public $smallBlockSize; @@ -90,8 +98,11 @@ class OLE * Reads an OLE container from the contents of the file given. * * @acces public + * * @param string $file + * * @throws \PhpOffice\PhpSpreadsheet\Reader\Exception + * * @return bool true on success, PEAR_Error on failure */ public function read($file) @@ -181,6 +192,7 @@ class OLE /** * @param int block id * @param int byte offset from beginning of file + * @param mixed $blockId */ public function _getBlockOffset($blockId) { @@ -190,7 +202,10 @@ class OLE /** * Returns a stream for use with fread() etc. External callers should * use \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File::getStream(). + * * @param int|PPS block id or PPS + * @param mixed $blockIdOrPps + * * @return resource read-only stream */ public function getStream($blockIdOrPps) @@ -220,7 +235,9 @@ class OLE /** * Reads a signed char. + * * @param resource $fh file handle + * * @return int */ private static function _readInt1($fh) @@ -232,7 +249,9 @@ class OLE /** * Reads an unsigned short (2 octets). + * * @param resource $fh file handle + * * @return int */ private static function _readInt2($fh) @@ -244,7 +263,9 @@ class OLE /** * Reads an unsigned long (4 octets). + * * @param resource $fh file handle + * * @return int */ private static function _readInt4($fh) @@ -259,12 +280,13 @@ class OLE * creates an OLE_PPS object for each one. * * @param int $blockId the block id of the first block + * * @return bool true on success, PEAR_Error on failure */ public function _readPpsWks($blockId) { $fh = $this->getStream($blockId); - for ($pos = 0;; $pos += 128) { + for ($pos = 0; ; $pos += 128) { fseek($fh, $pos, SEEK_SET); $nameUtf16 = fread($fh, 64); $nameLength = self::_readInt2($fh); @@ -329,9 +351,10 @@ class OLE /** * It checks whether the PPS tree is complete (all PPS's read) - * starting with the given PPS (not necessarily root) + * starting with the given PPS (not necessarily root). * * @param int $index The index of the PPS from which we are checking + * * @return bool Whether the PPS tree for the given PPS is complete */ public function _ppsTreeComplete($index) @@ -351,6 +374,7 @@ class OLE * If there is no PPS for the index given, it will return false. * * @param int $index The index for the PPS + * * @return bool true if it's a File PPS, false otherwise */ public function isFile($index) @@ -366,7 +390,8 @@ class OLE * Checks whether a PPS is a Root PPS or not. * If there is no PPS for the index given, it will return false. * - * @param int $index The index for the PPS. + * @param int $index the index for the PPS + * * @return bool true if it's a Root PPS, false otherwise */ public function isRoot($index) @@ -396,7 +421,9 @@ class OLE * @param int $position The position from which to start reading * (relative to the PPS) * @param int $length The amount of bytes to read (at most) + * * @return string The binary string containing the data requested + * * @see OLE_PPS_File::getStream() */ public function getData($index, $position, $length) @@ -417,6 +444,7 @@ class OLE * If there is no PPS for the index given, it will return 0. * * @param int $index The index for the PPS + * * @return int The amount of bytes in data the PPS has */ public function getDataLength($index) @@ -429,17 +457,19 @@ class OLE } /** - * Utility function to transform ASCII text to Unicode + * Utility function to transform ASCII text to Unicode. * * @static + * * @param string $ascii The ASCII string to transform + * * @return string The string in Unicode */ public static function ascToUcs($ascii) { $rawname = ''; for ($i = 0; $i < strlen($ascii); ++$i) { - $rawname .= $ascii{$i} + $rawname .= $ascii[$i] . "\x00"; } @@ -448,10 +478,12 @@ class OLE /** * Utility function - * Returns a string for the OLE container with the date given + * Returns a string for the OLE container with the date given. * * @static + * * @param int $date A timestamp + * * @return string The string for the OLE container */ public static function localDateToOLE($date = null) @@ -492,10 +524,12 @@ class OLE } /** - * Returns a timestamp from an OLE container's date + * Returns a timestamp from an OLE container's date. * * @static + * * @param int $string A binary string with the encoded date + * * @return string The timestamp corresponding to the string */ public static function OLE2LocalDate($string) diff --git a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php index ded7c48b..a5813b7c 100644 --- a/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php +++ b/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\OLE; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\OLE; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2007 Christian Schmidt * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -27,24 +28,28 @@ class ChainedBlockStream { /** * The OLE container of the file that is being read. + * * @var OLE */ public $ole; /** * Parameters specified by fopen(). + * * @var array */ public $params; /** * The binary data of the file. + * * @var string */ public $data; /** * The file pointer. + * * @var int byte offset */ public $pos; @@ -58,6 +63,7 @@ class ChainedBlockStream * @param string $mode only "r" is supported * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH * @param string &$openedPath absolute path of the opened stream (out parameter) + * * @return bool true on success */ public function stream_open($path, $mode, $options, &$openedPath) // @codingStandardsIgnoreLine @@ -125,6 +131,7 @@ class ChainedBlockStream * Implements support for fread(), fgets() etc. * * @param int $count maximum number of bytes to read + * * @return string */ public function stream_read($count) // @codingStandardsIgnoreLine @@ -164,6 +171,7 @@ class ChainedBlockStream * * @param int $offset byte offset * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END + * * @return bool */ public function stream_seek($offset, $whence) // @codingStandardsIgnoreLine @@ -172,7 +180,7 @@ class ChainedBlockStream $this->pos = $offset; } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) { $this->pos += $offset; - } elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) { + } elseif ($whence == SEEK_END && -$offset <= count($this->data)) { $this->pos = strlen($this->data) + $offset; } else { return false; @@ -184,6 +192,7 @@ class ChainedBlockStream /** * Implements support for fstat(). Currently the only supported field is * "size". + * * @return array */ public function stream_stat() // @codingStandardsIgnoreLine diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS.php b/src/PhpSpreadsheet/Shared/OLE/PPS.php index 38fd2bce..da46d3e2 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS.php @@ -22,93 +22,107 @@ namespace PhpOffice\PhpSpreadsheet\Shared\OLE; // /** - * Class for creating PPS's for OLE containers + * Class for creating PPS's for OLE containers. * * @author Xavier Noguer + * * @category PhpSpreadsheet */ class PPS { /** - * The PPS index + * The PPS index. + * * @var int */ public $No; /** - * The PPS name (in Unicode) + * The PPS name (in Unicode). + * * @var string */ public $Name; /** - * The PPS type. Dir, Root or File + * The PPS type. Dir, Root or File. + * * @var int */ public $Type; /** - * The index of the previous PPS + * The index of the previous PPS. + * * @var int */ public $PrevPps; /** - * The index of the next PPS + * The index of the next PPS. + * * @var int */ public $NextPps; /** - * The index of it's first child if this is a Dir or Root PPS + * The index of it's first child if this is a Dir or Root PPS. + * * @var int */ public $DirPps; /** - * A timestamp + * A timestamp. + * * @var int */ public $Time1st; /** - * A timestamp + * A timestamp. + * * @var int */ public $Time2nd; /** - * Starting block (small or big) for this PPS's data inside the container + * Starting block (small or big) for this PPS's data inside the container. + * * @var int */ public $startBlock; /** - * The size of the PPS's data (in bytes) + * The size of the PPS's data (in bytes). + * * @var int */ public $Size; /** - * The PPS's data (only used if it's not using a temporary file) + * The PPS's data (only used if it's not using a temporary file). + * * @var string */ public $_data; /** - * Array of child PPS's (only used by Root and Dir PPS's) + * Array of child PPS's (only used by Root and Dir PPS's). + * * @var array */ public $children = []; /** - * Pointer to OLE container + * Pointer to OLE container. + * * @var OLE */ public $ole; /** - * The constructor + * The constructor. * * @param int $No The PPS index * @param string $name The PPS name @@ -141,7 +155,7 @@ class PPS } /** - * Returns the amount of data saved for this PPS + * Returns the amount of data saved for this PPS. * * @return int The amount of data (in bytes) */ @@ -155,7 +169,7 @@ class PPS } /** - * Returns a string with the PPS's WK (What is a WK?) + * Returns a string with the PPS's WK (What is a WK?). * * @return string The binary string */ @@ -188,6 +202,9 @@ class PPS * * @param array &$raList Reference to the array of PPS's for the whole OLE * container + * @param mixed $to_save + * @param mixed $depth + * * @return int The index for this PPS */ public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0) diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/File.php b/src/PhpSpreadsheet/Shared/OLE/PPS/File.php index 6e674904..71c07d2f 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/File.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/File.php @@ -22,17 +22,19 @@ namespace PhpOffice\PhpSpreadsheet\Shared\OLE\PPS; // /** - * Class for creating File PPS's for OLE containers + * Class for creating File PPS's for OLE containers. * * @author Xavier Noguer + * * @category PhpSpreadsheet */ class File extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS { /** - * The constructor + * The constructor. * * @param string $name The name of the file (in Unicode) + * * @see OLE::ascToUcs() */ public function __construct($name) @@ -51,7 +53,7 @@ class File extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Append data to PPS + * Append data to PPS. * * @param string $data The data to append */ @@ -62,6 +64,7 @@ class File extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS /** * Returns a stream for reading this file using fread() etc. + * * @return resource a read-only stream */ public function getStream() diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php index 052554c6..00b5710e 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -22,15 +22,17 @@ namespace PhpOffice\PhpSpreadsheet\Shared\OLE\PPS; // /** - * Class for creating Root PPS's for OLE containers + * Class for creating Root PPS's for OLE containers. * * @author Xavier Noguer + * * @category PhpSpreadsheet */ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS { /** - * Directory for temporary files + * Directory for temporary files. + * * @var string */ protected $tempDirectory = null; @@ -54,8 +56,10 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS * If a resource pointer to a stream created by fopen() is passed * it will be used, but you have to close such stream by yourself. * - * @param string|resource $filename The name of the file or stream where to save the OLE container. + * @param string|resource $filename the name of the file or stream where to save the OLE container + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return bool true on success */ public function save($filename) @@ -113,9 +117,10 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Calculate some numbers + * Calculate some numbers. * * @param array $raList Reference to an array of PPS's + * * @return float[] The array of numbers */ public function _calcSize(&$raList) @@ -150,10 +155,12 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Helper function for caculating a magic value for block sizes + * Helper function for caculating a magic value for block sizes. * * @param int $i2 The argument + * * @see save() + * * @return float */ private static function adjust2($i2) @@ -164,7 +171,7 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Save OLE header + * Save OLE header. * * @param int $iSBDcnt * @param int $iBBcnt @@ -244,7 +251,7 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Saving big data (PPS's with data bigger than \PhpOffice\PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) + * Saving big data (PPS's with data bigger than \PhpOffice\PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL). * * @param int $iStBlk * @param array &$raList Reference to array of PPS's @@ -275,7 +282,7 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * get small data (PPS's with data smaller than \PhpOffice\PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) + * get small data (PPS's with data smaller than \PhpOffice\PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL). * * @param array &$raList Reference to array of PPS's */ @@ -325,7 +332,7 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Saves all the PPS's WKs + * Saves all the PPS's WKs. * * @param array $raList Reference to an array with all PPS's */ @@ -345,7 +352,7 @@ class Root extends \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS } /** - * Saving Big Block Depot + * Saving Big Block Depot. * * @param int $iSbdSize * @param int $iBsize diff --git a/src/PhpSpreadsheet/Shared/OLERead.php b/src/PhpSpreadsheet/Shared/OLERead.php index 97f9937d..7276d113 100644 --- a/src/PhpSpreadsheet/Shared/OLERead.php +++ b/src/PhpSpreadsheet/Shared/OLERead.php @@ -67,9 +67,10 @@ class OLERead public $documentSummaryInformation = null; /** - * Read the file + * Read the file. * * @param $pFilename string Filename + * * @throws \PhpOffice\PhpSpreadsheet\Reader\Exception */ public function read($pFilename) @@ -162,9 +163,10 @@ class OLERead } /** - * Extract binary stream data + * Extract binary stream data. * * @param int $stream + * * @return string */ public function getStream($stream) @@ -187,33 +189,33 @@ class OLERead $block = self::getInt4d($this->smallBlockChain, $block * 4); } - return $streamData; - } else { - $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; - if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { - ++$numBlocks; - } - - if ($numBlocks == 0) { - return ''; - } - - $block = $this->props[$stream]['startBlock']; - - while ($block != -2) { - $pos = ($block + 1) * self::BIG_BLOCK_SIZE; - $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::getInt4d($this->bigBlockChain, $block * 4); - } - return $streamData; } + $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; + if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { + ++$numBlocks; + } + + if ($numBlocks == 0) { + return ''; + } + + $block = $this->props[$stream]['startBlock']; + + while ($block != -2) { + $pos = ($block + 1) * self::BIG_BLOCK_SIZE; + $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); + $block = self::getInt4d($this->bigBlockChain, $block * 4); + } + + return $streamData; } /** - * Read a standard stream (by joining sectors using information from SAT) + * Read a standard stream (by joining sectors using information from SAT). * * @param int $bl Sector ID where the stream starts + * * @return string Data for standard stream */ private function _readData($bl) @@ -290,10 +292,11 @@ class OLERead } /** - * Read 4 bytes of data at specified position + * Read 4 bytes of data at specified position. * * @param string $data * @param int $pos + * * @return int */ private static function getInt4d($data, $pos) diff --git a/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php b/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php index 4f80f459..3b16db2c 100644 --- a/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php +++ b/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php @@ -219,7 +219,6 @@ class PclZip */ public function __construct($p_zipname) { - // ----- Tests the zlib if (!function_exists('gzopen')) { die('Abort ' . basename(__FILE__) . ' : Missing zlib extensions'); @@ -231,8 +230,8 @@ class PclZip $this->magic_quotes_status = -1; // ----- Return - return; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -296,7 +295,7 @@ class PclZip --$v_size; // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + if ((is_int($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { // ----- Parse the options $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, [ PCLZIP_OPT_REMOVE_PATH => 'optional', @@ -363,11 +362,10 @@ class PclZip } // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { + if (count($v_string_list) != 0) { foreach ($v_string_list as $v_string) { if ($v_string != '') { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } else { } } } @@ -403,6 +401,7 @@ class PclZip // ----- Return return $p_result_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -464,7 +463,7 @@ class PclZip --$v_size; // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + if ((is_int($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { // ----- Parse the options $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, [ PCLZIP_OPT_REMOVE_PATH => 'optional', @@ -535,7 +534,7 @@ class PclZip } // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { + if (count($v_string_list) != 0) { foreach ($v_string_list as $v_string) { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; } @@ -572,6 +571,7 @@ class PclZip // ----- Return return $p_result_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -638,6 +638,7 @@ class PclZip // ----- Return return $p_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -702,7 +703,7 @@ class PclZip $v_arg_list = func_get_args(); // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + if ((is_int($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { // ----- Parse the options $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, [ PCLZIP_OPT_PATH => 'optional', @@ -783,6 +784,7 @@ class PclZip // ----- Return return $p_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -856,7 +858,7 @@ class PclZip --$v_size; // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + if ((is_int($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { // ----- Parse the options $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, [ PCLZIP_OPT_PATH => 'optional', @@ -897,7 +899,6 @@ class PclZip } if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; - } else { } } else { // ----- Look for 2 args @@ -927,7 +928,7 @@ class PclZip // with privParseOptions() $v_arg_trick = [PCLZIP_OPT_BY_INDEX, $p_index]; $v_options_trick = []; - $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, [PCLZIP_OPT_BY_INDEX => 'optional']); + $v_result = $this->privParseOptions($v_arg_trick, count($v_arg_trick), $v_options_trick, [PCLZIP_OPT_BY_INDEX => 'optional']); if ($v_result != 1) { return 0; } @@ -944,6 +945,7 @@ class PclZip // ----- Return return $p_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1017,6 +1019,7 @@ class PclZip // ----- Return return $v_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1032,6 +1035,7 @@ class PclZip // ----- Return return $p_list; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1050,7 +1054,6 @@ class PclZip // -------------------------------------------------------------------------------- public function properties() { - // ----- Reset the error handler $this->privErrorReset(); @@ -1106,6 +1109,7 @@ class PclZip // ----- Return return $v_prop; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1153,6 +1157,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1202,6 +1207,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1213,10 +1219,11 @@ class PclZip { if (PCLZIP_ERROR_EXTERNAL == 1) { return PclErrorCode(); - } else { - return $this->error_code; } + + return $this->error_code; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1258,10 +1265,11 @@ class PclZip if ($p_with_code) { return $v_value . ' (' . $this->error_code . ')'; - } else { - return $v_value; } + + return $v_value; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1273,14 +1281,14 @@ class PclZip { if (PCLZIP_ERROR_EXTERNAL == 1) { return PclErrorString(); - } else { - if ($p_full) { - return $this->errorName(true) . ' : ' . $this->error_string; - } else { - return $this->error_string . ' [code ' . $this->error_code . ']'; - } } + if ($p_full) { + return $this->errorName(true) . ' : ' . $this->error_string; + } + + return $this->error_string . ' [code ' . $this->error_code . ']'; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1341,6 +1349,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1393,7 +1402,6 @@ class PclZip $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); ++$i; break; - case PCLZIP_OPT_TEMP_FILE_THRESHOLD: // ----- Check the number of parameters if (($i + 1) >= $p_size) { @@ -1411,7 +1419,7 @@ class PclZip // ----- Check the value $v_value = $p_options_list[$i + 1]; - if ((!is_integer($v_value)) || ($v_value < 0)) { + if ((!is_int($v_value)) || ($v_value < 0)) { self::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); return self::errorCode(); @@ -1421,7 +1429,6 @@ class PclZip $v_result_list[$p_options_list[$i]] = $v_value * 1048576; ++$i; break; - case PCLZIP_OPT_TEMP_FILE_ON: // ----- Check for incompatible options if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { @@ -1432,7 +1439,6 @@ class PclZip $v_result_list[$p_options_list[$i]] = true; break; - case PCLZIP_OPT_TEMP_FILE_OFF: // ----- Check for incompatible options if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { @@ -1448,7 +1454,6 @@ class PclZip } $v_result_list[$p_options_list[$i]] = true; break; - case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION: // ----- Check the number of parameters if (($i + 1) >= $p_size) { @@ -1462,8 +1467,8 @@ class PclZip if (is_string($p_options_list[$i + 1]) && ($p_options_list[$i + 1] != '')) { $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); ++$i; - } else { } + break; // ----- Look for options that request an array of string for value case PCLZIP_OPT_BY_NAME: @@ -1515,7 +1520,6 @@ class PclZip } ++$i; break; - // ----- Look for options that takes a string case PCLZIP_OPT_COMMENT: case PCLZIP_OPT_ADD_COMMENT: @@ -1541,7 +1545,6 @@ class PclZip } ++$i; break; - // ----- Look for options that request an array of index case PCLZIP_OPT_BY_INDEX: // ----- Check the number of parameters @@ -1561,7 +1564,7 @@ class PclZip // ----- Parse items $v_work_list = explode(',', $p_options_list[$i + 1]); - } elseif (is_integer($p_options_list[$i + 1])) { + } elseif (is_int($p_options_list[$i + 1])) { $v_work_list[0] = $p_options_list[$i + 1] . '-' . $p_options_list[$i + 1]; } elseif (is_array($p_options_list[$i + 1])) { $v_work_list = $p_options_list[$i + 1]; @@ -1579,10 +1582,10 @@ class PclZip // ----- Check the format of each item $v_sort_flag = false; $v_sort_value = 0; - for ($j = 0; $j < sizeof($v_work_list); ++$j) { + for ($j = 0; $j < count($v_work_list); ++$j) { // ----- Explode the item $v_item_list = explode('-', $v_work_list[$j]); - $v_size_item_list = sizeof($v_item_list); + $v_size_item_list = count($v_item_list); // ----- TBC : Here we might check that each item is a // real integer ... @@ -1647,7 +1650,6 @@ class PclZip $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; ++$i; break; - // ----- Look for options that request a call-back case PCLZIP_CB_PRE_EXTRACT: case PCLZIP_CB_POST_EXTRACT: @@ -1718,6 +1720,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1761,6 +1764,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1843,7 +1847,7 @@ class PclZip $p_filedescr['comment'] = $v_value; break; case PCLZIP_ATT_FILE_MTIME: - if (!is_integer($v_value)) { + if (!is_int($v_value)) { self::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, 'Invalid type ' . gettype($v_value) . ". Integer expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); return self::errorCode(); @@ -1880,6 +1884,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1904,7 +1909,7 @@ class PclZip $v_result_list = []; // ----- Look each entry - for ($i = 0; $i < sizeof($p_filedescr_list); ++$i) { + for ($i = 0; $i < count($p_filedescr_list); ++$i) { // ----- Get filedescr $v_descr = $p_filedescr_list[$i]; @@ -1941,7 +1946,7 @@ class PclZip $this->privCalculateStoredFilename($v_descr, $p_options); // ----- Add the descriptor in result list - $v_result_list[sizeof($v_result_list)] = $v_descr; + $v_result_list[count($v_result_list)] = $v_descr; // ----- Look for folder if ($v_descr['type'] == 'folder') { @@ -1973,9 +1978,8 @@ class PclZip } @closedir($v_folder_handler); - } else { - // TBC : unable to open folder in read mode } + // TBC : unable to open folder in read mode // ----- Expand each element of the list if ($v_dirlist_nb != 0) { @@ -1999,6 +2003,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2033,6 +2038,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2134,7 +2140,7 @@ class PclZip } // ----- Create the Central Dir files header - for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); ++$i) { + for ($i = 0, $v_count = 0; $i < count($v_header_list); ++$i) { // ----- Create the file header if ($v_header_list[$i]['status'] == 'ok') { if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { @@ -2204,6 +2210,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2236,6 +2243,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2255,6 +2263,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2286,7 +2295,7 @@ class PclZip $v_offset = @ftell($this->zip_fd); // ----- Create the Central Dir files header - for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); ++$i) { + for ($i = 0, $v_count = 0; $i < count($v_header_list); ++$i) { // ----- Create the file header if ($v_header_list[$i]['status'] == 'ok') { if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { @@ -2321,6 +2330,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2338,10 +2348,10 @@ class PclZip $v_header = []; // ----- Recuperate the current number of elt in list - $v_nb = sizeof($p_result_list); + $v_nb = count($p_result_list); // ----- Loop on the files - for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); ++$j) { + for ($j = 0; ($j < count($p_filedescr_list)) && ($v_result == 1); ++$j) { // ----- Format the filename $p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); @@ -2377,6 +2387,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2624,6 +2635,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2735,6 +2747,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2835,6 +2848,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2859,19 +2873,20 @@ class PclZip $v_binary_data = pack('VvvvvvVVVvv', 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); // ----- Write the first 148 bytes of the header in the archive - fputs($this->zip_fd, $v_binary_data, 30); + fwrite($this->zip_fd, $v_binary_data, 30); // ----- Write the variable fields if (strlen($p_header['stored_filename']) != 0) { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + fwrite($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + fwrite($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2897,22 +2912,23 @@ class PclZip $v_binary_data = pack('VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); // ----- Write the 42 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 46); + fwrite($this->zip_fd, $v_binary_data, 46); // ----- Write the variable fields if (strlen($p_header['stored_filename']) != 0) { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + fwrite($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + fwrite($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } if ($p_header['comment_len'] != 0) { - fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); + fwrite($this->zip_fd, $p_header['comment'], $p_header['comment_len']); } // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -2929,16 +2945,17 @@ class PclZip $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); // ----- Write the 22 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 22); + fwrite($this->zip_fd, $v_binary_data, 22); // ----- Write the variable fields if (strlen($p_comment) != 0) { - fputs($this->zip_fd, $p_comment, strlen($p_comment)); + fwrite($this->zip_fd, $p_comment, strlen($p_comment)); } // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3010,6 +3027,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3052,6 +3070,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3155,7 +3174,7 @@ class PclZip // ----- Look for extract by name rule if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { // ----- Look if the filename is in the list - for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); ++$j) { + for ($j = 0; ($j < count($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); ++$j) { // ----- Look for a directory if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == '/') { // ----- Look if the directory is in the filename path @@ -3175,7 +3194,7 @@ class PclZip } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { // ----- Look for extract by index rule // ----- Look if the index is in the list - for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); ++$j) { + for ($j = $j_start; ($j < count($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); ++$j) { if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { $v_extract = true; } @@ -3339,6 +3358,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3454,7 +3474,7 @@ class PclZip return self::errorCode(); } - } elseif (!is_writeable($p_entry['filename'])) { + } elseif (!is_writable($p_entry['filename'])) { // ----- Look if file is write protected // ----- Change the file status $p_entry['status'] = 'write_protected'; @@ -3483,7 +3503,6 @@ class PclZip return self::errorCode(); } } - } else { } } else { // ----- Check the directory availability and create it if necessary @@ -3622,6 +3641,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3644,7 +3664,7 @@ class PclZip } // ----- Write gz file format header - $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); + $v_binary_data = pack('va1a1Va1a1', 0x8b1f, chr($p_entry['compression']), chr(0x00), time(), chr(0x00), chr(3)); @fwrite($v_dest_file, $v_binary_data, 10); // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks @@ -3697,6 +3717,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3801,6 +3822,7 @@ class PclZip return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -3873,9 +3895,8 @@ class PclZip } } // ----- Trace - } else { - // TBC : error : can not extract a folder in a string } + // TBC : error : can not extract a folder in a string } // ----- Change abort status @@ -3910,6 +3931,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4005,6 +4027,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4106,6 +4129,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4145,6 +4169,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4219,7 +4244,7 @@ class PclZip //$v_bytes = ($v_bytes << 8) | Ord($v_byte); // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. - $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); + $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | ord($v_byte); // ----- Compare the bytes if ($v_bytes == 0x504b0506) { @@ -4291,6 +4316,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4358,7 +4384,7 @@ class PclZip // ----- Look for extract by name rule if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { // ----- Look if the filename is in the list - for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); ++$j) { + for ($j = 0; ($j < count($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); ++$j) { // ----- Look for a directory if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == '/') { // ----- Look if the directory is in the filename path @@ -4380,7 +4406,7 @@ class PclZip } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { // ----- Look for extract by index rule // ----- Look if the index is in the list - for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); ++$j) { + for ($j = $j_start; ($j < count($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); ++$j) { if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { $v_found = true; } @@ -4420,7 +4446,7 @@ class PclZip } // ----- Look which file need to be kept - for ($i = 0; $i < sizeof($v_header_list); ++$i) { + for ($i = 0; $i < count($v_header_list); ++$i) { // ----- Calculate the position of the header @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { @@ -4481,7 +4507,7 @@ class PclZip $v_offset = @ftell($v_temp_zip->zip_fd); // ----- Re-Create the Central Dir files header - for ($i = 0; $i < sizeof($v_header_list); ++$i) { + for ($i = 0; $i < count($v_header_list); ++$i) { // ----- Create the file header if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { $v_temp_zip->privCloseFd(); @@ -4506,7 +4532,7 @@ class PclZip $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; // ----- Create the central dir footer - if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { + if (($v_result = $v_temp_zip->privWriteCentralHeader(count($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { // ----- Reset the file list unset($v_header_list); $v_temp_zip->privCloseFd(); @@ -4550,6 +4576,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4602,6 +4629,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4775,6 +4803,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4831,6 +4860,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4847,6 +4877,7 @@ class PclZip $this->error_string = $p_error_string; } } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4863,6 +4894,7 @@ class PclZip $this->error_string = ''; } } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4896,6 +4928,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -4926,6 +4959,7 @@ class PclZip // ----- Return return $v_result; } + // -------------------------------------------------------------------------------- } // End of class @@ -4948,7 +4982,7 @@ function PclZipUtilPathReduction($p_dir) // ----- Study directories from last to first $v_skip = 0; - for ($i = sizeof($v_list) - 1; $i >= 0; --$i) { + for ($i = count($v_list) - 1; $i >= 0; --$i) { // ----- Look for current path if ($v_list[$i] == '.') { // ----- Ignore this directory @@ -4965,20 +4999,19 @@ function PclZipUtilPathReduction($p_dir) $v_result = $p_dir; $v_skip = 0; } - } elseif ($i == (sizeof($v_list) - 1)) { + } elseif ($i == (count($v_list) - 1)) { // ----- Last '/' i.e. indicates a directory $v_result = $v_list[$i]; - } else { + } // ----- Double '/' inside the path // ----- Ignore only the double '//' in path, // but not the first and last '/' - } } else { // ----- Look for item to skip if ($v_skip > 0) { --$v_skip; } else { - $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? '/' . $v_result : ''); + $v_result = $v_list[$i] . ($i != (count($v_list) - 1) ? '/' . $v_result : ''); } } } @@ -5026,9 +5059,9 @@ function PclZipUtilPathInclusion($p_dir, $p_path) // ----- Explode dir and path by directory separator $v_list_dir = explode('/', $p_dir); - $v_list_dir_size = sizeof($v_list_dir); + $v_list_dir_size = count($v_list_dir); $v_list_path = explode('/', $p_path); - $v_list_path_size = sizeof($v_list_path); + $v_list_path_size = count($v_list_path); // ----- Study directories paths $i = 0; diff --git a/src/PhpSpreadsheet/Shared/PasswordHasher.php b/src/PhpSpreadsheet/Shared/PasswordHasher.php index bee696f4..c24f37f0 100644 --- a/src/PhpSpreadsheet/Shared/PasswordHasher.php +++ b/src/PhpSpreadsheet/Shared/PasswordHasher.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,6 +34,7 @@ class PasswordHasher * Spreadsheet_Excel_Writer by Xavier Noguer . * * @param string $pPassword Password to hash + * * @return string Hashed password */ public static function hashPassword($pPassword = '') diff --git a/src/PhpSpreadsheet/Shared/StringHelper.php b/src/PhpSpreadsheet/Shared/StringHelper.php index 4e3a5d56..0307ab5f 100644 --- a/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/src/PhpSpreadsheet/Shared/StringHelper.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,46 +20,47 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class StringHelper { /** Constants */ -/** Regular Expressions */ + /** Regular Expressions */ // Fraction const STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)'; /** - * Control characters array + * Control characters array. * * @var string[] */ private static $controlCharacters = []; /** - * SYLK Characters array + * SYLK Characters array. * * @var array */ private static $SYLKCharacters = []; /** - * Decimal separator + * Decimal separator. * * @var string */ private static $decimalSeparator; /** - * Thousands separator + * Thousands separator. * * @var string */ private static $thousandsSeparator; /** - * Currency code + * Currency code. * * @var string */ @@ -80,7 +81,7 @@ class StringHelper private static $isIconvEnabled; /** - * Build control characters array + * Build control characters array. */ private static function buildControlCharacters() { @@ -94,7 +95,7 @@ class StringHelper } /** - * Build SYLK characters array + * Build SYLK characters array. */ private static function buildSYLKCharacters() { @@ -259,7 +260,7 @@ class StringHelper } /** - * Get whether mbstring extension is available + * Get whether mbstring extension is available. * * @return bool */ @@ -276,7 +277,7 @@ class StringHelper } /** - * Get whether iconv extension is available + * Get whether iconv extension is available. * * @return bool */ @@ -332,7 +333,7 @@ class StringHelper } /** - * Convert from OpenXML escaped control character to PHP control character + * Convert from OpenXML escaped control character to PHP control character. * * Excel 2007 team: * ---------------- @@ -343,6 +344,7 @@ class StringHelper * element or in the shared string element. * * @param string $value Value to unescape + * * @return string */ public static function controlCharacterOOXML2PHP($value = '') @@ -351,7 +353,7 @@ class StringHelper } /** - * Convert from PHP control character to OpenXML escaped control character + * Convert from PHP control character to OpenXML escaped control character. * * Excel 2007 team: * ---------------- @@ -362,6 +364,7 @@ class StringHelper * element or in the shared string element. * * @param string $value Value to escape + * * @return string */ public static function controlCharacterPHP2OOXML($value = '') @@ -373,6 +376,7 @@ class StringHelper * Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters. * * @param string $value + * * @return string */ public static function sanitizeUTF8($value) @@ -394,9 +398,10 @@ class StringHelper } /** - * Check if a string contains UTF8 data + * Check if a string contains UTF8 data. * * @param string $value + * * @return bool */ public static function isUTF8($value = '') @@ -409,6 +414,7 @@ class StringHelper * point as decimal separator in case locale is other than English. * * @param mixed $value + * * @return string */ public static function formatNumber($value) @@ -425,10 +431,11 @@ class StringHelper * Writes the string using uncompressed notation, no rich text, no Asian phonetics * If mbstring extension is not available, ASCII is assumed, and compressed notation is used * although this will give wrong results for non-ASCII strings - * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3 + * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3. * * @param string $value UTF-8 encoded string * @param mixed[] $arrcRuns Details of rich text runs in $value + * * @return string */ public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = []) @@ -461,9 +468,10 @@ class StringHelper * Writes the string using uncompressed notation, no rich text, no Asian phonetics * If mbstring extension is not available, ASCII is assumed, and compressed notation is used * although this will give wrong results for non-ASCII strings - * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3 + * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3. * * @param string $value UTF-8 encoded string + * * @return string */ public static function UTF8toBIFF8UnicodeLong($value) @@ -484,11 +492,12 @@ class StringHelper } /** - * Convert string from one encoding to another. First try mbstring, then iconv, finally strlen + * Convert string from one encoding to another. First try mbstring, then iconv, finally strlen. * * @param string $value * @param string $to Encoding to convert to, e.g. 'UTF-8' * @param string $from Encoding to convert from, e.g. 'UTF-16LE' + * * @return string */ public static function convertEncoding($value, $to, $from) @@ -518,9 +527,13 @@ class StringHelper * This function was taken from http://php.net/manual/en/function.utf8-decode.php * and $bom_be parameter added. * - * @param string $str UTF-16 encoded data to decode. - * @return string UTF-8 / ISO encoded data. + * @param string $str uTF-16 encoded data to decode + * @param mixed $bom_be + * + * @return string uTF-8 / ISO encoded data + * * @version 0.2 / 2010-05-13 + * * @author Rasmus Andersson {@link http://rasmusandersson.se/} * @author vadik56 */ @@ -529,8 +542,8 @@ class StringHelper if (strlen($str) < 2) { return $str; } - $c0 = ord($str{0}); - $c1 = ord($str{1}); + $c0 = ord($str[0]); + $c1 = ord($str[1]); if ($c0 == 0xfe && $c1 == 0xff) { $str = substr($str, 2); } elseif ($c0 == 0xff && $c1 == 0xfe) { @@ -541,11 +554,11 @@ class StringHelper $newstr = ''; for ($i = 0; $i < $len; $i += 2) { if ($bom_be) { - $val = ord($str{$i}) << 4; - $val += ord($str{$i + 1}); + $val = ord($str[$i]) << 4; + $val += ord($str[$i + 1]); } else { - $val = ord($str{$i + 1}) << 4; - $val += ord($str{$i}); + $val = ord($str[$i + 1]) << 4; + $val += ord($str[$i]); } $newstr .= ($val == 0x228) ? "\n" : chr($val); } @@ -554,10 +567,11 @@ class StringHelper } /** - * Get character count. First try mbstring, then iconv, finally strlen + * Get character count. First try mbstring, then iconv, finally strlen. * * @param string $value * @param string $enc Encoding + * * @return int Character count */ public static function countCharacters($value, $enc = 'UTF-8') @@ -575,11 +589,12 @@ class StringHelper } /** - * Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen + * Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen. * * @param string $pValue UTF-8 encoded string * @param int $pStart Start offset * @param int $pLength Maximum number of characters in substring + * * @return string */ public static function substring($pValue = '', $pStart = 0, $pLength = 0) @@ -597,9 +612,10 @@ class StringHelper } /** - * Convert a UTF-8 encoded string to upper case + * Convert a UTF-8 encoded string to upper case. * * @param string $pValue UTF-8 encoded string + * * @return string */ public static function strToUpper($pValue = '') @@ -612,9 +628,10 @@ class StringHelper } /** - * Convert a UTF-8 encoded string to lower case + * Convert a UTF-8 encoded string to lower case. * * @param string $pValue UTF-8 encoded string + * * @return string */ public static function strToLower($pValue = '') @@ -628,9 +645,10 @@ class StringHelper /** * Convert a UTF-8 encoded string to title/proper case - * (uppercase every first character in each word, lower case all other characters) + * (uppercase every first character in each word, lower case all other characters). * * @param string $pValue UTF-8 encoded string + * * @return string */ public static function strToTitle($pValue = '') @@ -649,16 +667,17 @@ class StringHelper public static function mbStrSplit($string) { - # Split at all position not after the start: ^ - # and not before the end: $ + // Split at all position not after the start: ^ + // and not before the end: $ return preg_split('/(?tempFileName == '') { return $this->outputMemory(true); - } else { - $this->flush(); - - return file_get_contents($this->tempFileName); } + $this->flush(); + + return file_get_contents($this->tempFileName); } /** - * Fallback method for writeRaw, introduced in PHP 5.2 + * Fallback method for writeRaw, introduced in PHP 5.2. * * @param string $text + * * @return bool */ public function writeRawData($text) diff --git a/src/PhpSpreadsheet/Shared/Xls.php b/src/PhpSpreadsheet/Shared/Xls.php index c861ed01..d3bdaf32 100644 --- a/src/PhpSpreadsheet/Shared/Xls.php +++ b/src/PhpSpreadsheet/Shared/Xls.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -28,10 +29,11 @@ class Xls /** * Get the width of a column in pixels. We use the relationship y = ceil(7x) where * x is the width in intrinsic Excel units (measuring width in number of normal characters) - * This holds for Arial 10 + * This holds for Arial 10. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $sheet The sheet * @param string $col The column + * * @return int The width in pixels */ public static function sizeCol($sheet, $col = 'A') @@ -74,6 +76,7 @@ class Xls * * @param \PhpOffice\PhpSpreadsheet\Worksheet $sheet The sheet * @param int $row The row index (1-based) + * * @return int The width in pixels */ public static function sizeRow($sheet, $row = 1) @@ -112,13 +115,14 @@ class Xls /** * Get the horizontal distance in pixels between two anchors - * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets + * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $sheet * @param string $startColumn * @param int $startOffsetX Offset within start cell measured in 1/1024 of the cell width * @param string $endColumn * @param int $endOffsetX Offset within end cell measured in 1/1024 of the cell width + * * @return int Horizontal measured in pixels */ public static function getDistanceX(\PhpOffice\PhpSpreadsheet\Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) @@ -143,13 +147,14 @@ class Xls /** * Get the vertical distance in pixels between two anchors - * The distanceY is found as sum of all the spanning rows minus two offsets + * The distanceY is found as sum of all the spanning rows minus two offsets. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $sheet * @param int $startRow (1-based) * @param int $startOffsetY Offset within start cell measured in 1/256 of the cell height * @param int $endRow (1-based) * @param int $endOffsetY Offset within end cell measured in 1/256 of the cell height + * * @return int Vertical distance measured in pixels */ public static function getDistanceY(\PhpOffice\PhpSpreadsheet\Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) @@ -172,7 +177,7 @@ class Xls /** * Convert 1-cell anchor coordinates to 2-cell anchor coordinates - * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications + * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications. * * Calculate the vertices that define the position of the image as required by * the OBJ record. @@ -220,6 +225,7 @@ class Xls * @param int $offsetY Vertical offset in pixels * @param int $width Width in pixels * @param int $height Height in pixels + * * @return array */ public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) diff --git a/src/PhpSpreadsheet/Shared/ZipArchive.php b/src/PhpSpreadsheet/Shared/ZipArchive.php index 2d0e3747..dab97b61 100644 --- a/src/PhpSpreadsheet/Shared/ZipArchive.php +++ b/src/PhpSpreadsheet/Shared/ZipArchive.php @@ -9,7 +9,7 @@ if (!defined('PCLZIP_TEMPORARY_DIR')) { use PhpOffice\PhpSpreadsheet\Shared\PCLZip\PclZip; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,6 +26,7 @@ use PhpOffice\PhpSpreadsheet\Shared\PCLZip\PclZip; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -36,23 +37,24 @@ class ZipArchive const CREATE = 'CREATE'; /** - * Temporary storage directory + * Temporary storage directory. * * @var string */ private $tempDir; /** - * Zip Archive Stream Handle + * Zip Archive Stream Handle. * * @var string */ private $zip; /** - * Open a new zip archive + * Open a new zip archive. * * @param string $fileName Filename for the zip archive + * * @return bool */ public function open($fileName) @@ -64,7 +66,7 @@ class ZipArchive } /** - * Close this zip archive + * Close this zip archive. */ public function close() { @@ -75,6 +77,7 @@ class ZipArchive * * @param string $localname Directory/Name of the file to add to the zip archive * @param string $contents String of data to add to the zip archive + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function addFromString($localname, $contents) @@ -94,9 +97,10 @@ class ZipArchive } /** - * Find if given fileName exist in archive (Emulate ZipArchive locateName()) + * Find if given fileName exist in archive (Emulate ZipArchive locateName()). * * @param string $fileName Filename for the file in zip archive + * * @return bool */ public function locateName($fileName) @@ -118,9 +122,10 @@ class ZipArchive } /** - * Extract file from archive by given fileName (Emulate ZipArchive getFromName()) + * Extract file from archive by given fileName (Emulate ZipArchive getFromName()). * * @param string $fileName Filename for the file in zip archive + * * @return string $contents File string contents */ public function getFromName($fileName) diff --git a/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php b/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php index 2128d3cc..b3ff5903 100644 --- a/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php +++ b/src/PhpSpreadsheet/Shared/ZipStreamWrapper.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,41 +20,42 @@ namespace PhpOffice\PhpSpreadsheet\Shared; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class ZipStreamWrapper { /** - * Internal ZipAcrhive + * Internal ZipAcrhive. * * @var ZipArchive */ private $archive; /** - * Filename in ZipAcrhive + * Filename in ZipAcrhive. * * @var string */ private $fileNameInArchive = ''; /** - * Position in file + * Position in file. * * @var int */ private $position = 0; /** - * Data + * Data. * * @var mixed */ private $data = ''; /** - * Register wrapper + * Register wrapper. */ public static function register() { @@ -69,13 +70,15 @@ class ZipStreamWrapper * @param string $mode only "r" is supported * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH * @param string &$openedPath absolute path of the opened stream (out parameter) + * * @throws \PhpOffice\PhpSpreadsheet\Reader\Exception + * * @return bool true on success */ public function stream_open($path, $mode, $options, &$opened_path) // @codingStandardsIgnoreLine { // Check for mode - if ($mode{0} != 'r') { + if ($mode[0] != 'r') { throw new \PhpOffice\PhpSpreadsheet\Reader\Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); } @@ -129,6 +132,7 @@ class ZipStreamWrapper * Implements support for fread(), fgets() etc. * * @param int $count maximum number of bytes to read + * * @return string */ public function stream_read($count) // @codingStandardsIgnoreLine @@ -151,7 +155,7 @@ class ZipStreamWrapper } /** - * EOF stream + * EOF stream. * * @return bool */ @@ -161,10 +165,11 @@ class ZipStreamWrapper } /** - * Seek stream + * Seek stream. * * @param int $offset byte offset * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END + * * @return bool */ public function stream_seek($offset, $whence) // @codingStandardsIgnoreLine @@ -175,27 +180,27 @@ class ZipStreamWrapper $this->position = $offset; return true; - } else { - return false; } + + return false; break; case SEEK_CUR: if ($offset >= 0) { $this->position += $offset; return true; - } else { - return false; } + + return false; break; case SEEK_END: if (strlen($this->data) + $offset >= 0) { $this->position = strlen($this->data) + $offset; return true; - } else { - return false; } + + return false; break; default: return false; diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index 5cf8c2c8..5d4e155a 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * PhpSpreadsheet + * PhpSpreadsheet. * * Copyright (c) 2006 - 2016 PhpSpreadsheet * @@ -22,76 +22,77 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPSpreadsheet + * * @copyright Copyright (c) 2006 PHPOffice (http://www.github.com/PHPOffice) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Spreadsheet { /** - * Unique ID + * Unique ID. * * @var string */ private $uniqueID; /** - * Document properties + * Document properties. * * @var Document\Properties */ private $properties; /** - * Document security + * Document security. * * @var Document\Security */ private $security; /** - * Collection of Worksheet objects + * Collection of Worksheet objects. * * @var Worksheet[] */ private $workSheetCollection = []; /** - * Calculation Engine + * Calculation Engine. * * @var Calculation */ private $calculationEngine; /** - * Active sheet index + * Active sheet index. * * @var int */ private $activeSheetIndex = 0; /** - * Named ranges + * Named ranges. * * @var NamedRange[] */ private $namedRanges = []; /** - * CellXf supervisor + * CellXf supervisor. * * @var Style */ private $cellXfSupervisor; /** - * CellXf collection + * CellXf collection. * * @var Style[] */ private $cellXfCollection = []; /** - * CellStyleXf collection + * CellStyleXf collection. * * @var Style[] */ @@ -105,20 +106,20 @@ class Spreadsheet private $hasMacros = false; /** - * macrosCode : all macros code (the vbaProject.bin file, this include form, code, etc.), null if no macro + * macrosCode : all macros code (the vbaProject.bin file, this include form, code, etc.), null if no macro. * * @var binary */ private $macrosCode; /** - * macrosCertificate : if macros are signed, contains vbaProjectSignature.bin file, null if not signed + * macrosCertificate : if macros are signed, contains vbaProjectSignature.bin file, null if not signed. * * @var binary */ private $macrosCertificate; /** - * ribbonXMLData : null if workbook is'nt Excel 2007 or not contain a customized UI + * ribbonXMLData : null if workbook is'nt Excel 2007 or not contain a customized UI. * * @var null|string */ @@ -126,7 +127,7 @@ class Spreadsheet /** * ribbonBinObjects : null if workbook is'nt Excel 2007 or not contain embedded objects (picture(s)) for Ribbon Elements - * ignored if $ribbonXMLData is null + * ignored if $ribbonXMLData is null. * * @var null|array */ @@ -143,7 +144,7 @@ class Spreadsheet } /** - * Define if a workbook has macros + * Define if a workbook has macros. * * @param bool $hasMacros true|false */ @@ -153,7 +154,7 @@ class Spreadsheet } /** - * Set the macros code + * Set the macros code. * * @param string $macroCode string|null */ @@ -164,7 +165,7 @@ class Spreadsheet } /** - * Return the macros code + * Return the macros code. * * @return string|null */ @@ -174,7 +175,7 @@ class Spreadsheet } /** - * Set the macros certificate + * Set the macros certificate. * * @param string|null $certificate */ @@ -194,7 +195,7 @@ class Spreadsheet } /** - * Return the macros certificate + * Return the macros certificate. * * @return string|null */ @@ -204,7 +205,7 @@ class Spreadsheet } /** - * Remove all macros, certificate from spreadsheet + * Remove all macros, certificate from spreadsheet. */ public function discardMacros() { @@ -214,7 +215,10 @@ class Spreadsheet } /** - * set ribbon XML data + * set ribbon XML data. + * + * @param null|mixed $target + * @param null|mixed $xmlData */ public function setRibbonXMLData($target = null, $xmlData = null) { @@ -226,9 +230,12 @@ class Spreadsheet } /** - * retrieve ribbon XML Data + * retrieve ribbon XML Data. * * return string|null|array + * + * @param mixed $what + * * @return string */ public function getRibbonXMLData($what = 'all') //we need some constants here... @@ -251,7 +258,10 @@ class Spreadsheet } /** - * store binaries ribbon objects (pictures) + * store binaries ribbon objects (pictures). + * + * @param null|mixed $BinObjectsNames + * @param null|mixed $BinObjectsData */ public function setRibbonBinObjects($BinObjectsNames = null, $BinObjectsData = null) { @@ -261,8 +271,11 @@ class Spreadsheet $this->ribbonBinObjects = null; } } + /** - * return the extension of a filename. Internal use for a array_map callback (php<5.3 don't like lambda function) + * return the extension of a filename. Internal use for a array_map callback (php<5.3 don't like lambda function). + * + * @param mixed $ThePath */ private function getExtensionOnly($ThePath) { @@ -270,7 +283,9 @@ class Spreadsheet } /** - * retrieve Binaries Ribbon Objects + * retrieve Binaries Ribbon Objects. + * + * @param mixed $What */ public function getRibbonBinObjects($What = 'all') { @@ -321,9 +336,10 @@ class Spreadsheet } /** - * Check if a sheet with a specified code name already exists + * Check if a sheet with a specified code name already exists. * * @param string $pSheetCodeName Name of the worksheet to check + * * @return bool */ public function sheetCodeNameExists($pSheetCodeName) @@ -335,6 +351,7 @@ class Spreadsheet * Get sheet by code name. Warning : sheet don't have always a code name ! * * @param string $pName Sheet name + * * @return Worksheet */ public function getSheetByCodeName($pName = '') @@ -350,7 +367,7 @@ class Spreadsheet } /** - * Create a new PhpSpreadsheet with one Worksheet + * Create a new PhpSpreadsheet with one Worksheet. */ public function __construct() { @@ -381,7 +398,7 @@ class Spreadsheet } /** - * Code to execute when this worksheet is unset() + * Code to execute when this worksheet is unset(). */ public function __destruct() { @@ -391,7 +408,7 @@ class Spreadsheet /** * Disconnect all worksheets from this PhpSpreadsheet workbook object, - * typically so that the PhpSpreadsheet object can be unset + * typically so that the PhpSpreadsheet object can be unset. */ public function disconnectWorksheets() { @@ -405,17 +422,19 @@ class Spreadsheet } /** - * Return the calculation engine for this worksheet + * Return the calculation engine for this worksheet. * * @return Calculation */ public function getCalculationEngine() { return $this->calculationEngine; - } // function getCellCacheController() + } + + // function getCellCacheController() /** - * Get properties + * Get properties. * * @return Document\Properties */ @@ -425,7 +444,7 @@ class Spreadsheet } /** - * Set properties + * Set properties. * * @param Document\Properties $pValue */ @@ -435,7 +454,7 @@ class Spreadsheet } /** - * Get security + * Get security. * * @return Document\Security */ @@ -445,7 +464,7 @@ class Spreadsheet } /** - * Set security + * Set security. * * @param Document\Security $pValue */ @@ -455,9 +474,10 @@ class Spreadsheet } /** - * Get active sheet + * Get active sheet. * * @throws Exception + * * @return Worksheet */ public function getActiveSheet() @@ -466,10 +486,12 @@ class Spreadsheet } /** - * Create sheet and add it to this workbook + * Create sheet and add it to this workbook. * * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * * @throws Exception + * * @return Worksheet */ public function createSheet($iSheetIndex = null) @@ -481,9 +503,10 @@ class Spreadsheet } /** - * Check if a sheet with a specified name already exists + * Check if a sheet with a specified name already exists. * * @param string $pSheetName Name of the worksheet to check + * * @return bool */ public function sheetNameExists($pSheetName) @@ -492,11 +515,13 @@ class Spreadsheet } /** - * Add sheet + * Add sheet. * * @param Worksheet $pSheet * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * * @throws Exception + * * @return Worksheet */ public function addSheet(Worksheet $pSheet, $iSheetIndex = null) @@ -535,9 +560,10 @@ class Spreadsheet } /** - * Remove sheet by index + * Remove sheet by index. * * @param int $pIndex Active sheet index + * * @throws Exception */ public function removeSheetByIndex($pIndex = 0) @@ -547,9 +573,9 @@ class Spreadsheet throw new Exception( "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." ); - } else { - array_splice($this->workSheetCollection, $pIndex, 1); } + array_splice($this->workSheetCollection, $pIndex, 1); + // Adjust active sheet index if necessary if (($this->activeSheetIndex >= $pIndex) && ($pIndex > count($this->workSheetCollection) - 1)) { @@ -558,10 +584,12 @@ class Spreadsheet } /** - * Get sheet by index + * Get sheet by index. * * @param int $pIndex Sheet index + * * @throws Exception + * * @return Worksheet */ public function getSheet($pIndex = 0) @@ -577,7 +605,7 @@ class Spreadsheet } /** - * Get all sheets + * Get all sheets. * * @return Worksheet[] */ @@ -587,9 +615,10 @@ class Spreadsheet } /** - * Get sheet by name + * Get sheet by name. * * @param string $pName Sheet name + * * @return Worksheet */ public function getSheetByName($pName = '') @@ -605,10 +634,12 @@ class Spreadsheet } /** - * Get index for sheet + * Get index for sheet. * * @param Worksheet $pSheet + * * @throws Exception + * * @return int index */ public function getIndex(Worksheet $pSheet) @@ -627,7 +658,9 @@ class Spreadsheet * * @param string $sheetName Sheet name to modify index for * @param int $newIndex New index for the sheet + * * @throws Exception + * * @return int New sheet index */ public function setIndexByName($sheetName, $newIndex) @@ -649,7 +682,7 @@ class Spreadsheet } /** - * Get sheet count + * Get sheet count. * * @return int */ @@ -659,7 +692,7 @@ class Spreadsheet } /** - * Get active sheet index + * Get active sheet index. * * @return int Active sheet index */ @@ -669,10 +702,12 @@ class Spreadsheet } /** - * Set active sheet index + * Set active sheet index. * * @param int $pIndex Active sheet index + * * @throws Exception + * * @return Worksheet */ public function setActiveSheetIndex($pIndex = 0) @@ -683,18 +718,19 @@ class Spreadsheet throw new Exception( "You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." ); - } else { - $this->activeSheetIndex = $pIndex; } + $this->activeSheetIndex = $pIndex; return $this->getActiveSheet(); } /** - * Set active sheet index by name + * Set active sheet index by name. * * @param string $pValue Sheet title + * * @throws Exception + * * @return Worksheet */ public function setActiveSheetIndexByName($pValue = '') @@ -709,7 +745,7 @@ class Spreadsheet } /** - * Get sheet names + * Get sheet names. * * @return string[] */ @@ -725,11 +761,13 @@ class Spreadsheet } /** - * Add external sheet + * Add external sheet. * * @param Worksheet $pSheet External sheet to add * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * * @throws Exception + * * @return Worksheet */ public function addExternalSheet(Worksheet $pSheet, $iSheetIndex = null) @@ -759,7 +797,7 @@ class Spreadsheet } /** - * Get named ranges + * Get named ranges. * * @return NamedRange[] */ @@ -769,9 +807,10 @@ class Spreadsheet } /** - * Add named range + * Add named range. * * @param NamedRange $namedRange + * * @return bool */ public function addNamedRange(NamedRange $namedRange) @@ -788,10 +827,11 @@ class Spreadsheet } /** - * Get named range + * Get named range. * * @param string $namedRange * @param Worksheet|null $pSheet Scope. Use null for global scope + * * @return NamedRange|null */ public function getNamedRange($namedRange, Worksheet $pSheet = null) @@ -814,10 +854,11 @@ class Spreadsheet } /** - * Remove named range + * Remove named range. * * @param string $namedRange - * @param Worksheet|null $pSheet Scope: use null for global scope. + * @param Worksheet|null $pSheet scope: use null for global scope + * * @return Spreadsheet */ public function removeNamedRange($namedRange, Worksheet $pSheet = null) @@ -836,7 +877,7 @@ class Spreadsheet } /** - * Get worksheet iterator + * Get worksheet iterator. * * @return Worksheet\Iterator */ @@ -846,7 +887,7 @@ class Spreadsheet } /** - * Copy workbook (!= clone!) + * Copy workbook (!= clone!). * * @return Spreadsheet */ @@ -876,7 +917,7 @@ class Spreadsheet } /** - * Get the workbook collection of cellXfs + * Get the workbook collection of cellXfs. * * @return Style[] */ @@ -886,9 +927,10 @@ class Spreadsheet } /** - * Get cellXf by index + * Get cellXf by index. * * @param int $pIndex + * * @return Style */ public function getCellXfByIndex($pIndex = 0) @@ -897,9 +939,10 @@ class Spreadsheet } /** - * Get cellXf by hash code + * Get cellXf by hash code. * * @param string $pValue + * * @return Style|false */ public function getCellXfByHashCode($pValue = '') @@ -914,9 +957,10 @@ class Spreadsheet } /** - * Check if style exists in style collection + * Check if style exists in style collection. * * @param Style $pCellStyle + * * @return bool */ public function cellXfExists($pCellStyle = null) @@ -925,9 +969,10 @@ class Spreadsheet } /** - * Get default style + * Get default style. * * @throws Exception + * * @return Style */ public function getDefaultStyle() @@ -939,7 +984,7 @@ class Spreadsheet } /** - * Add a cellXf to the workbook + * Add a cellXf to the workbook. * * @param Style $style */ @@ -953,13 +998,14 @@ class Spreadsheet * Remove cellXf by index. It is ensured that all cells get their xf index updated. * * @param int $pIndex Index to cellXf + * * @throws Exception */ public function removeCellXfByIndex($pIndex = 0) { if ($pIndex > count($this->cellXfCollection) - 1) { throw new Exception('CellXf index is out of bounds.'); - } else { + } // first remove the cellXf array_splice($this->cellXfCollection, $pIndex, 1); @@ -977,11 +1023,10 @@ class Spreadsheet } } } - } } /** - * Get the cellXf supervisor + * Get the cellXf supervisor. * * @return Style */ @@ -991,7 +1036,7 @@ class Spreadsheet } /** - * Get the workbook collection of cellStyleXfs + * Get the workbook collection of cellStyleXfs. * * @return Style[] */ @@ -1001,9 +1046,10 @@ class Spreadsheet } /** - * Get cellStyleXf by index + * Get cellStyleXf by index. * * @param int $pIndex Index to cellXf + * * @return Style */ public function getCellStyleXfByIndex($pIndex = 0) @@ -1012,9 +1058,10 @@ class Spreadsheet } /** - * Get cellStyleXf by hash code + * Get cellStyleXf by hash code. * * @param string $pValue + * * @return Style|false */ public function getCellStyleXfByHashCode($pValue = '') @@ -1029,7 +1076,7 @@ class Spreadsheet } /** - * Add a cellStyleXf to the workbook + * Add a cellStyleXf to the workbook. * * @param Style $pStyle */ @@ -1040,23 +1087,23 @@ class Spreadsheet } /** - * Remove cellStyleXf by index + * Remove cellStyleXf by index. * * @param int $pIndex Index to cellXf + * * @throws Exception */ public function removeCellStyleXfByIndex($pIndex = 0) { if ($pIndex > count($this->cellStyleXfCollection) - 1) { throw new Exception('CellStyleXf index is out of bounds.'); - } else { - array_splice($this->cellStyleXfCollection, $pIndex, 1); } + array_splice($this->cellStyleXfCollection, $pIndex, 1); } /** * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells - * and columns in the workbook + * and columns in the workbook. */ public function garbageCollect() { @@ -1135,7 +1182,7 @@ class Spreadsheet } /** - * Return the unique ID value assigned to this spreadsheet workbook + * Return the unique ID value assigned to this spreadsheet workbook. * * @return string */ diff --git a/src/PhpSpreadsheet/Style.php b/src/PhpSpreadsheet/Style.php index 55adf0ba..6db5e267 100644 --- a/src/PhpSpreadsheet/Style.php +++ b/src/PhpSpreadsheet/Style.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,55 +20,56 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Style extends Style\Supervisor implements IComparable { /** - * Font + * Font. * * @var Style\Font */ protected $font; /** - * Fill + * Fill. * * @var Style\Fill */ protected $fill; /** - * Borders + * Borders. * * @var Style\Borders */ protected $borders; /** - * Alignment + * Alignment. * * @var Style\Alignment */ protected $alignment; /** - * Number Format + * Number Format. * * @var Style\NumberFormat */ protected $numberFormat; /** - * Conditional styles + * Conditional styles. * * @var Style\Conditional[] */ protected $conditionalStyles; /** - * Protection + * Protection. * * @var Style\Protection */ @@ -89,7 +90,7 @@ class Style extends Style\Supervisor implements IComparable protected $quotePrefix = false; /** - * Create a new Style + * Create a new Style. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -125,7 +126,7 @@ class Style extends Style\Supervisor implements IComparable /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Style */ @@ -144,7 +145,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get parent. Only used for style supervisor + * Get parent. Only used for style supervisor. * * @return Spreadsheet */ @@ -154,9 +155,10 @@ class Style extends Style\Supervisor implements IComparable } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -165,7 +167,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray( @@ -200,8 +202,10 @@ class Style extends Style\Supervisor implements IComparable * * * @param array $pStyles Array containing style information - * @param bool $pAdvanced Advanced mode for setting borders. + * @param bool $pAdvanced advanced mode for setting borders + * * @throws Exception + * * @return Style */ public function applyFromArray($pStyles = null, $pAdvanced = true) @@ -417,7 +421,6 @@ class Style extends Style\Supervisor implements IComparable $columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]); } break; - case 'ROW': for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { $rowDimension = $this->getActiveSheet()->getRowDimension($row); @@ -426,7 +429,6 @@ class Style extends Style\Supervisor implements IComparable $rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]); } break; - case 'CELL': for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { @@ -469,7 +471,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get Fill + * Get Fill. * * @return Style\Fill */ @@ -479,7 +481,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get Font + * Get Font. * * @return Style\Font */ @@ -489,9 +491,10 @@ class Style extends Style\Supervisor implements IComparable } /** - * Set font + * Set font. * * @param Style\Font $font + * * @return Style */ public function setFont(Style\Font $font) @@ -502,7 +505,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get Borders + * Get Borders. * * @return Style\Borders */ @@ -512,7 +515,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get Alignment + * Get Alignment. * * @return Style\Alignment */ @@ -522,7 +525,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get Number Format + * Get Number Format. * * @return Style\NumberFormat */ @@ -545,6 +548,7 @@ class Style extends Style\Supervisor implements IComparable * Set Conditional Styles. Only used on supervisor. * * @param Style\Conditional[] $pValue Array of condtional styles + * * @return Style */ public function setConditionalStyles($pValue = null) @@ -557,7 +561,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get Protection + * Get Protection. * * @return Style\Protection */ @@ -567,7 +571,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get quote prefix + * Get quote prefix. * * @return bool */ @@ -581,7 +585,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Set quote prefix + * Set quote prefix. * * @param bool $pValue */ @@ -594,14 +598,14 @@ class Style extends Style\Supervisor implements IComparable $styleArray = ['quotePrefix' => $pValue]; $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); } else { - $this->quotePrefix = (boolean) $pValue; + $this->quotePrefix = (bool) $pValue; } return $this; } /** - * Get hash code + * Get hash code. * * @return string Hash code */ @@ -626,7 +630,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Get own index in style collection + * Get own index in style collection. * * @return int */ @@ -636,7 +640,7 @@ class Style extends Style\Supervisor implements IComparable } /** - * Set own index in style collection + * Set own index in style collection. * * @param int $pValue */ diff --git a/src/PhpSpreadsheet/Style/Alignment.php b/src/PhpSpreadsheet/Style/Alignment.php index a3e2ce5f..3643d29d 100644 --- a/src/PhpSpreadsheet/Style/Alignment.php +++ b/src/PhpSpreadsheet/Style/Alignment.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -48,56 +49,56 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara const READORDER_RTL = 2; /** - * Horizontal alignment + * Horizontal alignment. * * @var string */ protected $horizontal = self::HORIZONTAL_GENERAL; /** - * Vertical alignment + * Vertical alignment. * * @var string */ protected $vertical = self::VERTICAL_BOTTOM; /** - * Text rotation + * Text rotation. * * @var int */ protected $textRotation = 0; /** - * Wrap text + * Wrap text. * * @var bool */ protected $wrapText = false; /** - * Shrink to fit + * Shrink to fit. * * @var bool */ protected $shrinkToFit = false; /** - * Indent - only possible with horizontal alignment left and right + * Indent - only possible with horizontal alignment left and right. * * @var int */ protected $indent = 0; /** - * Read order + * Read order. * * @var int */ protected $readorder = 0; /** - * Create a new Alignment + * Create a new Alignment. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -120,7 +121,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Alignment */ @@ -130,9 +131,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -141,7 +143,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( @@ -155,7 +157,9 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Alignment */ public function applyFromArray($pStyles = null) @@ -195,7 +199,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get Horizontal + * Get Horizontal. * * @return string */ @@ -209,9 +213,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set Horizontal + * Set Horizontal. * * @param string $pValue + * * @return Alignment */ public function setHorizontal($pValue = self::HORIZONTAL_GENERAL) @@ -231,7 +236,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get Vertical + * Get Vertical. * * @return string */ @@ -245,9 +250,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set Vertical + * Set Vertical. * * @param string $pValue + * * @return Alignment */ public function setVertical($pValue = self::VERTICAL_BOTTOM) @@ -267,7 +273,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get TextRotation + * Get TextRotation. * * @return int */ @@ -281,10 +287,12 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set TextRotation + * Set TextRotation. * * @param int $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Alignment */ public function setTextRotation($pValue = 0) @@ -310,7 +318,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get Wrap Text + * Get Wrap Text. * * @return bool */ @@ -324,9 +332,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set Wrap Text + * Set Wrap Text. * * @param bool $pValue + * * @return Alignment */ public function setWrapText($pValue = false) @@ -345,7 +354,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get Shrink to fit + * Get Shrink to fit. * * @return bool */ @@ -359,9 +368,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set Shrink to fit + * Set Shrink to fit. * * @param bool $pValue + * * @return Alignment */ public function setShrinkToFit($pValue = false) @@ -380,7 +390,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get indent + * Get indent. * * @return int */ @@ -394,9 +404,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set indent + * Set indent. * * @param int $pValue + * * @return Alignment */ public function setIndent($pValue = 0) @@ -419,7 +430,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get read order + * Get read order. * * @return int */ @@ -433,9 +444,10 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Set read order + * Set read order. * * @param int $pValue + * * @return Alignment */ public function setReadorder($pValue = 0) @@ -454,7 +466,7 @@ class Alignment extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompara } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Border.php b/src/PhpSpreadsheet/Style/Border.php index 4239bc78..e1a1c42f 100644 --- a/src/PhpSpreadsheet/Style/Border.php +++ b/src/PhpSpreadsheet/Style/Border.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -42,28 +43,28 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable const BORDER_THIN = 'thin'; /** - * Border style + * Border style. * * @var string */ protected $borderStyle = self::BORDER_NONE; /** - * Border color + * Border color. * * @var Color */ protected $color; /** - * Parent property name + * Parent property name. * * @var string */ protected $parentPropertyName; /** - * Create a new Border + * Create a new Border. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -87,10 +88,11 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Bind parent. Only used for supervisor + * Bind parent. Only used for supervisor. * * @param Borders $parent * @param string $parentPropertyName + * * @return Border */ public function bindParent($parent, $parentPropertyName = null) @@ -103,9 +105,10 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Border */ public function getSharedComponent() @@ -132,9 +135,10 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -158,7 +162,7 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( @@ -172,7 +176,9 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Border */ public function applyFromArray($pStyles = null) @@ -196,7 +202,7 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Border style + * Get Border style. * * @return string */ @@ -210,11 +216,12 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Border style + * Set Border style. * * @param string|bool $pValue * When passing a boolean, FALSE equates Border::BORDER_NONE * and TRUE to Border::BORDER_MEDIUM + * * @return Border */ public function setBorderStyle($pValue = self::BORDER_NONE) @@ -235,7 +242,7 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Border Color + * Get Border Color. * * @return Color */ @@ -245,10 +252,12 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Border Color + * Set Border Color. * * @param Color $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Border */ public function setColor(Color $pValue = null) @@ -267,7 +276,7 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Borders.php b/src/PhpSpreadsheet/Style/Borders.php index 95d80ad4..998aa298 100644 --- a/src/PhpSpreadsheet/Style/Borders.php +++ b/src/PhpSpreadsheet/Style/Borders.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -32,42 +33,42 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl const DIAGONAL_BOTH = 3; /** - * Left + * Left. * * @var Border */ protected $left; /** - * Right + * Right. * * @var Border */ protected $right; /** - * Top + * Top. * * @var Border */ protected $top; /** - * Bottom + * Bottom. * * @var Border */ protected $bottom; /** - * Diagonal + * Diagonal. * * @var Border */ protected $diagonal; /** - * DiagonalDirection + * DiagonalDirection. * * @var int */ @@ -109,7 +110,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl protected $horizontal; /** - * Create a new Borders + * Create a new Borders. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -156,7 +157,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Borders */ @@ -166,9 +167,10 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -177,7 +179,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( @@ -211,7 +213,9 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Borders */ public function applyFromArray($pStyles = null) @@ -253,7 +257,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get Left + * Get Left. * * @return Border */ @@ -263,7 +267,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get Right + * Get Right. * * @return Border */ @@ -273,7 +277,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get Top + * Get Top. * * @return Border */ @@ -283,7 +287,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get Bottom + * Get Bottom. * * @return Border */ @@ -293,7 +297,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get Diagonal + * Get Diagonal. * * @return Border */ @@ -306,6 +310,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl * Get AllBorders (pseudo-border). Only applies to supervisor. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Border */ public function getAllBorders() @@ -321,6 +326,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl * Get Outline (pseudo-border). Only applies to supervisor. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function getOutline() @@ -336,6 +342,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl * Get Inside (pseudo-border). Only applies to supervisor. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return bool */ public function getInside() @@ -351,6 +358,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl * Get Vertical (pseudo-border). Only applies to supervisor. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Border */ public function getVertical() @@ -366,6 +374,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl * Get Horizontal (pseudo-border). Only applies to supervisor. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Border */ public function getHorizontal() @@ -378,7 +387,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get DiagonalDirection + * Get DiagonalDirection. * * @return int */ @@ -392,9 +401,10 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Set DiagonalDirection + * Set DiagonalDirection. * * @param int $pValue + * * @return Borders */ public function setDiagonalDirection($pValue = self::DIAGONAL_NONE) @@ -413,7 +423,7 @@ class Borders extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparabl } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Color.php b/src/PhpSpreadsheet/Style/Color.php index fe67ee80..fe3c318a 100644 --- a/src/PhpSpreadsheet/Style/Color.php +++ b/src/PhpSpreadsheet/Style/Color.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -38,28 +39,28 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable const COLOR_DARKYELLOW = 'FF808000'; /** - * Indexed colors array + * Indexed colors array. * * @var array */ protected static $indexedColors; /** - * ARGB - Alpha RGB + * ARGB - Alpha RGB. * * @var string */ protected $argb = null; /** - * Parent property name + * Parent property name. * * @var string */ protected $parentPropertyName; /** - * Create a new Color + * Create a new Color. * * @param string $pARGB ARGB value for the colour * @param bool $isSupervisor Flag indicating if this is a supervisor or not @@ -81,10 +82,11 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Bind parent. Only used for supervisor + * Bind parent. Only used for supervisor. * * @param mixed $parent * @param string $parentPropertyName + * * @return Color */ public function bindParent($parent, $parentPropertyName = null) @@ -97,7 +99,7 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Color */ @@ -114,9 +116,10 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -137,14 +140,16 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') ); * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Color */ public function applyFromArray($pStyles = null) @@ -168,7 +173,7 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get ARGB + * Get ARGB. * * @return string */ @@ -182,9 +187,10 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set ARGB + * Set ARGB. * * @param string $pValue + * * @return Color */ public function setARGB($pValue = self::COLOR_BLACK) @@ -203,7 +209,7 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get RGB + * Get RGB. * * @return string */ @@ -217,9 +223,10 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set RGB + * Set RGB. * * @param string $pValue RGB value + * * @return Color */ public function setRGB($pValue = '000000') @@ -238,13 +245,15 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get a specified colour component of an RGB value + * Get a specified colour component of an RGB value. * * @private + * * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE * @param int $offset Position within the RGB value to extract * @param bool $hex Flag indicating whether the component should be returned as a hex or a * decimal value + * * @return string The extracted colour component */ private static function getColourComponent($RGB, $offset, $hex = true) @@ -258,11 +267,12 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get the red colour component of an RGB value + * Get the red colour component of an RGB value. * * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE * @param bool $hex Flag indicating whether the component should be returned as a hex or a * decimal value + * * @return string The red colour component */ public static function getRed($RGB, $hex = true) @@ -271,11 +281,12 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get the green colour component of an RGB value + * Get the green colour component of an RGB value. * * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE * @param bool $hex Flag indicating whether the component should be returned as a hex or a * decimal value + * * @return string The green colour component */ public static function getGreen($RGB, $hex = true) @@ -284,11 +295,12 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get the blue colour component of an RGB value + * Get the blue colour component of an RGB value. * * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE * @param bool $hex Flag indicating whether the component should be returned as a hex or a * decimal value + * * @return string The blue colour component */ public static function getBlue($RGB, $hex = true) @@ -297,10 +309,11 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Adjust the brightness of a color + * Adjust the brightness of a color. * * @param string $hex The colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE) * @param float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1 + * * @return string The adjusted colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE) */ public static function changeBrightness($hex, $adjustPercentage) @@ -346,17 +359,18 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get indexed color + * Get indexed color. * * @param int $pIndex Index entry point into the colour array * @param bool $background Flag to indicate whether default background or foreground colour * should be returned if the indexed colour doesn't exist + * * @return Color */ public static function indexedColor($pIndex, $background = false) { // Clean parameter - $pIndex = intval($pIndex); + $pIndex = (int) $pIndex; // Indexed colors if (is_null(self::$indexedColors)) { @@ -432,7 +446,7 @@ class Color extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Conditional.php b/src/PhpSpreadsheet/Style/Conditional.php index d97d22d1..64f7c22f 100644 --- a/src/PhpSpreadsheet/Style/Conditional.php +++ b/src/PhpSpreadsheet/Style/Conditional.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -46,42 +47,42 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable const OPERATOR_BETWEEN = 'between'; /** - * Condition type + * Condition type. * * @var string */ private $conditionType; /** - * Operator type + * Operator type. * * @var string */ private $operatorType; /** - * Text + * Text. * * @var string */ private $text; /** - * Condition + * Condition. * * @var string[] */ private $condition = []; /** - * Style + * Style. * * @var \PhpOffice\PhpSpreadsheet\Style */ private $style; /** - * Create a new Conditional + * Create a new Conditional. */ public function __construct() { @@ -94,7 +95,7 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Condition type + * Get Condition type. * * @return string */ @@ -104,9 +105,10 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Condition type + * Set Condition type. * * @param string $pValue Condition type + * * @return Conditional */ public function setConditionType($pValue = self::CONDITION_NONE) @@ -117,7 +119,7 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Operator type + * Get Operator type. * * @return string */ @@ -127,9 +129,10 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Operator type + * Set Operator type. * * @param string $pValue Conditional operator type + * * @return Conditional */ public function setOperatorType($pValue = self::OPERATOR_NONE) @@ -140,7 +143,7 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get text + * Get text. * * @return string */ @@ -150,9 +153,10 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set text + * Set text. * * @param string $value + * * @return Conditional */ public function setText($value = null) @@ -163,7 +167,7 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Conditions + * Get Conditions. * * @return string[] */ @@ -173,9 +177,10 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Conditions + * Set Conditions. * * @param string[] $pValue Condition + * * @return Conditional */ public function setConditions($pValue) @@ -189,9 +194,10 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Add Condition + * Add Condition. * * @param string $pValue Condition + * * @return Conditional */ public function addCondition($pValue = '') @@ -202,7 +208,7 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Style + * Get Style. * * @return \PhpOffice\PhpSpreadsheet\Style */ @@ -212,10 +218,12 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Style + * Set Style. * * @param \PhpOffice\PhpSpreadsheet\Style $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Conditional */ public function setStyle(\PhpOffice\PhpSpreadsheet\Style $pValue = null) @@ -226,7 +234,7 @@ class Conditional implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Fill.php b/src/PhpSpreadsheet/Style/Fill.php index 7775a2d0..d2dffaf1 100644 --- a/src/PhpSpreadsheet/Style/Fill.php +++ b/src/PhpSpreadsheet/Style/Fill.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -49,35 +50,35 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable const FILL_PATTERN_MEDIUMGRAY = 'mediumGray'; /** - * Fill type + * Fill type. * * @var string */ protected $fillType = self::FILL_NONE; /** - * Rotation + * Rotation. * * @var float */ protected $rotation = 0; /** - * Start color + * Start color. * * @var Color */ protected $startColor; /** - * End color + * End color. * * @var Color */ protected $endColor; /** - * Create a new Fill + * Create a new Fill. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -107,7 +108,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Fill */ @@ -117,9 +118,10 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -128,7 +130,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( @@ -146,7 +148,9 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Fill */ public function applyFromArray($pStyles = null) @@ -179,7 +183,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Fill Type + * Get Fill Type. * * @return string */ @@ -193,9 +197,10 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Fill Type + * Set Fill Type. * * @param string $pValue Fill type + * * @return Fill */ public function setFillType($pValue = self::FILL_NONE) @@ -211,7 +216,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Rotation + * Get Rotation. * * @return float */ @@ -225,9 +230,10 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Rotation + * Set Rotation. * * @param float $pValue + * * @return Fill */ public function setRotation($pValue = 0) @@ -243,7 +249,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Start Color + * Get Start Color. * * @return Color */ @@ -253,10 +259,12 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Start Color + * Set Start Color. * * @param Color $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Fill */ public function setStartColor(Color $pValue = null) @@ -275,7 +283,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get End Color + * Get End Color. * * @return Color */ @@ -285,10 +293,12 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set End Color + * Set End Color. * * @param Color $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Fill */ public function setEndColor(Color $pValue = null) @@ -307,7 +317,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Font.php b/src/PhpSpreadsheet/Style/Font.php index fe1aebbe..15b2bfff 100644 --- a/src/PhpSpreadsheet/Style/Font.php +++ b/src/PhpSpreadsheet/Style/Font.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,70 +34,70 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'; /** - * Font Name + * Font Name. * * @var string */ protected $name = 'Calibri'; /** - * Font Size + * Font Size. * * @var float */ protected $size = 11; /** - * Bold + * Bold. * * @var bool */ protected $bold = false; /** - * Italic + * Italic. * * @var bool */ protected $italic = false; /** - * Superscript + * Superscript. * * @var bool */ protected $superScript = false; /** - * Subscript + * Subscript. * * @var bool */ protected $subScript = false; /** - * Underline + * Underline. * * @var string */ protected $underline = self::UNDERLINE_NONE; /** - * Strikethrough + * Strikethrough. * * @var bool */ protected $strikethrough = false; /** - * Foreground color + * Foreground color. * * @var Color */ protected $color; /** - * Create a new Font + * Create a new Font. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -132,7 +133,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Font */ @@ -142,9 +143,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -153,7 +155,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( @@ -171,7 +173,9 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Font */ public function applyFromArray($pStyles = null) @@ -216,7 +220,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Name + * Get Name. * * @return string */ @@ -230,9 +234,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Name + * Set Name. * * @param string $pValue + * * @return Font */ public function setName($pValue = 'Calibri') @@ -251,7 +256,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Size + * Get Size. * * @return float */ @@ -265,9 +270,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Size + * Set Size. * * @param float $pValue + * * @return Font */ public function setSize($pValue = 10) @@ -286,7 +292,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Bold + * Get Bold. * * @return bool */ @@ -300,9 +306,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Bold + * Set Bold. * * @param bool $pValue + * * @return Font */ public function setBold($pValue = false) @@ -321,7 +328,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Italic + * Get Italic. * * @return bool */ @@ -335,9 +342,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Italic + * Set Italic. * * @param bool $pValue + * * @return Font */ public function setItalic($pValue = false) @@ -356,7 +364,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get SuperScript + * Get SuperScript. * * @return bool */ @@ -370,9 +378,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set SuperScript + * Set SuperScript. * * @param bool $pValue + * * @return Font */ public function setSuperScript($pValue = false) @@ -392,7 +401,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get SubScript + * Get SubScript. * * @return bool */ @@ -406,9 +415,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set SubScript + * Set SubScript. * * @param bool $pValue + * * @return Font */ public function setSubScript($pValue = false) @@ -428,7 +438,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Underline + * Get Underline. * * @return string */ @@ -442,11 +452,12 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Underline + * Set Underline. * * @param string|bool $pValue \PhpOffice\PhpSpreadsheet\Style\Font underline type * If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE, * false equates to UNDERLINE_NONE + * * @return Font */ public function setUnderline($pValue = self::UNDERLINE_NONE) @@ -467,7 +478,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Strikethrough + * Get Strikethrough. * * @return bool */ @@ -481,9 +492,10 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Strikethrough + * Set Strikethrough. * * @param bool $pValue + * * @return Font */ public function setStrikethrough($pValue = false) @@ -502,7 +514,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Color + * Get Color. * * @return Color */ @@ -512,10 +524,12 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Color + * Set Color. * * @param Color $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Font */ public function setColor(Color $pValue = null) @@ -534,7 +548,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index a111801c..984779a3 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -66,35 +67,35 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-'; /** - * Excel built-in number formats + * Excel built-in number formats. * * @var array */ protected static $builtInFormats; /** - * Excel built-in number formats (flipped, for faster lookups) + * Excel built-in number formats (flipped, for faster lookups). * * @var array */ protected static $flippedBuiltInFormats; /** - * Format Code + * Format Code. * * @var string */ protected $formatCode = self::FORMAT_GENERAL; /** - * Built-in format Code + * Built-in format Code. * * @var string */ protected $builtInFormatCode = 0; /** - * Create a new NumberFormat + * Create a new NumberFormat. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -116,7 +117,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return NumberFormat */ @@ -126,9 +127,10 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -137,7 +139,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( @@ -148,7 +150,9 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return NumberFormat */ public function applyFromArray($pStyles = null) @@ -169,7 +173,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Get Format Code + * Get Format Code. * * @return string */ @@ -186,9 +190,10 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Set Format Code + * Set Format Code. * * @param string $pValue + * * @return NumberFormat */ public function setFormatCode($pValue = self::FORMAT_GENERAL) @@ -208,7 +213,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Get Built-In Format Code + * Get Built-In Format Code. * * @return int */ @@ -222,9 +227,10 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Set Built-In Format Code + * Set Built-In Format Code. * * @param int $pValue + * * @return NumberFormat */ public function setBuiltInFormatCode($pValue = 0) @@ -241,7 +247,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Fill built-in format codes + * Fill built-in format codes. */ private static function fillBuiltInFormatCodes() { @@ -328,15 +334,16 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Get built-in format code + * Get built-in format code. * * @param int $pIndex + * * @return string */ public static function builtInFormatCode($pIndex) { // Clean parameter - $pIndex = intval($pIndex); + $pIndex = (int) $pIndex; // Ensure built-in format codes are available self::fillBuiltInFormatCodes(); @@ -350,9 +357,10 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Get built-in format code index + * Get built-in format code index. * * @param string $formatCode + * * @return int|bool */ public static function builtInFormatCodeIndex($formatCode) @@ -369,7 +377,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Get hash code + * Get hash code. * * @return string Hash code */ @@ -387,7 +395,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Search/replace values to convert Excel date/time format masks to PHP format masks + * Search/replace values to convert Excel date/time format masks to PHP format masks. * * @var array */ @@ -430,7 +438,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp '.s' => '', ]; /** - * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock) + * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock). * * @var array */ @@ -439,7 +447,7 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp 'h' => 'G', ]; /** - * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock) + * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock). * * @var array */ @@ -577,11 +585,12 @@ class NumberFormat extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComp } /** - * Convert a value in a pre-defined format to a PHP string + * Convert a value in a pre-defined format to a PHP string. * * @param mixed $value Value to format * @param string $format Format code * @param array $callBack Callback function for additional formatting of string + * * @return string Formatted string */ public static function toFormattedString($value = '0', $format = self::FORMAT_GENERAL, $callBack = null) diff --git a/src/PhpSpreadsheet/Style/Protection.php b/src/PhpSpreadsheet/Style/Protection.php index db924fb2..3e5b4a90 100644 --- a/src/PhpSpreadsheet/Style/Protection.php +++ b/src/PhpSpreadsheet/Style/Protection.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -31,21 +32,21 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar const PROTECTION_UNPROTECTED = 'unprotected'; /** - * Locked + * Locked. * * @var string */ protected $locked; /** - * Hidden + * Hidden. * * @var string */ protected $hidden; /** - * Create a new Protection + * Create a new Protection. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -68,7 +69,7 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar /** * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor + * Only used for style supervisor. * * @return Protection */ @@ -78,9 +79,10 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Build style array from subcomponents + * Build style array from subcomponents. * * @param array $array + * * @return array */ public function getStyleArray($array) @@ -89,7 +91,7 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Apply styles from array + * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( @@ -101,7 +103,9 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar * * * @param array $pStyles Array containing style information + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Protection */ public function applyFromArray($pStyles = null) @@ -125,7 +129,7 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Get locked + * Get locked. * * @return string */ @@ -139,9 +143,10 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Set locked + * Set locked. * * @param string $pValue + * * @return Protection */ public function setLocked($pValue = self::PROTECTION_INHERIT) @@ -157,7 +162,7 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Get hidden + * Get hidden. * * @return string */ @@ -171,9 +176,10 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Set hidden + * Set hidden. * * @param string $pValue + * * @return Protection */ public function setHidden($pValue = self::PROTECTION_INHERIT) @@ -189,7 +195,7 @@ class Protection extends Supervisor implements \PhpOffice\PhpSpreadsheet\ICompar } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Style/Supervisor.php b/src/PhpSpreadsheet/Style/Supervisor.php index 380687aa..d881a669 100644 --- a/src/PhpSpreadsheet/Style/Supervisor.php +++ b/src/PhpSpreadsheet/Style/Supervisor.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Style; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,14 +34,14 @@ abstract class Supervisor protected $isSupervisor; /** - * Parent. Only used for supervisor + * Parent. Only used for supervisor. * * @var \PhpOffice\PhpSpreadsheet\Style */ protected $parent; /** - * Create a new Supervisor + * Create a new Supervisor. * * @param bool $isSupervisor Flag indicating if this is a supervisor or not * Leave this value at default unless you understand exactly what @@ -53,9 +54,11 @@ abstract class Supervisor } /** - * Bind parent. Only used for supervisor + * Bind parent. Only used for supervisor. * * @param \PhpOffice\PhpSpreadsheet\Style $parent + * @param null|mixed $parentPropertyName + * * @return Supervisor */ public function bindParent($parent, $parentPropertyName = null) @@ -76,7 +79,7 @@ abstract class Supervisor } /** - * Get the currently active sheet. Only used for supervisor + * Get the currently active sheet. Only used for supervisor. * * @return \PhpOffice\PhpSpreadsheet\Worksheet */ @@ -87,7 +90,7 @@ abstract class Supervisor /** * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor + * Only used for supervisor. * * @return string E.g. 'A1' */ @@ -98,7 +101,7 @@ abstract class Supervisor /** * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor + * Only used for supervisor. * * @return string E.g. 'A1' */ diff --git a/src/PhpSpreadsheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet.php index 8a432ede..38d4174d 100644 --- a/src/PhpSpreadsheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -36,126 +37,126 @@ class Worksheet implements IComparable const SHEETSTATE_VERYHIDDEN = 'veryHidden'; /** - * Invalid characters in sheet title + * Invalid characters in sheet title. * * @var array */ private static $invalidCharacters = ['*', ':', '/', '\\', '?', '[', ']']; /** - * Parent spreadsheet + * Parent spreadsheet. * * @var Spreadsheet */ private $parent; /** - * Cacheable collection of cells + * Cacheable collection of cells. * * @var CachedObjectStorage_xxx */ private $cellCollection; /** - * Collection of row dimensions + * Collection of row dimensions. * * @var Worksheet\RowDimension[] */ private $rowDimensions = []; /** - * Default row dimension + * Default row dimension. * * @var Worksheet\RowDimension */ private $defaultRowDimension; /** - * Collection of column dimensions + * Collection of column dimensions. * * @var Worksheet\ColumnDimension[] */ private $columnDimensions = []; /** - * Default column dimension + * Default column dimension. * * @var Worksheet\ColumnDimension */ private $defaultColumnDimension = null; /** - * Collection of drawings + * Collection of drawings. * * @var Worksheet\BaseDrawing[] */ private $drawingCollection = null; /** - * Collection of Chart objects + * Collection of Chart objects. * * @var Chart[] */ private $chartCollection = []; /** - * Worksheet title + * Worksheet title. * * @var string */ private $title; /** - * Sheet state + * Sheet state. * * @var string */ private $sheetState; /** - * Page setup + * Page setup. * * @var Worksheet\PageSetup */ private $pageSetup; /** - * Page margins + * Page margins. * * @var Worksheet\PageMargins */ private $pageMargins; /** - * Page header/footer + * Page header/footer. * * @var Worksheet\HeaderFooter */ private $headerFooter; /** - * Sheet view + * Sheet view. * * @var Worksheet\SheetView */ private $sheetView; /** - * Protection + * Protection. * * @var Worksheet\Protection */ private $protection; /** - * Collection of styles + * Collection of styles. * * @var Style[] */ private $styles = []; /** - * Conditional styles. Indexed by cell coordinate, e.g. 'A1' + * Conditional styles. Indexed by cell coordinate, e.g. 'A1'. * * @var array */ @@ -169,35 +170,35 @@ class Worksheet implements IComparable private $cellCollectionIsSorted = false; /** - * Collection of breaks + * Collection of breaks. * * @var array */ private $breaks = []; /** - * Collection of merged cell ranges + * Collection of merged cell ranges. * * @var array */ private $mergeCells = []; /** - * Collection of protected cell ranges + * Collection of protected cell ranges. * * @var array */ private $protectedCells = []; /** - * Autofilter Range and selection + * Autofilter Range and selection. * * @var Worksheet\AutoFilter */ private $autoFilter; /** - * Freeze pane + * Freeze pane. * * @var string */ @@ -225,49 +226,49 @@ class Worksheet implements IComparable private $showRowColHeaders = true; /** - * Show summary below? (Row/Column outline) + * Show summary below? (Row/Column outline). * * @var bool */ private $showSummaryBelow = true; /** - * Show summary right? (Row/Column outline) + * Show summary right? (Row/Column outline). * * @var bool */ private $showSummaryRight = true; /** - * Collection of comments + * Collection of comments. * * @var Comment[] */ private $comments = []; /** - * Active cell. (Only one!) + * Active cell. (Only one!). * * @var string */ private $activeCell = 'A1'; /** - * Selected cells + * Selected cells. * * @var string */ private $selectedCells = 'A1'; /** - * Cached highest column + * Cached highest column. * * @var string */ private $cachedHighestColumn = 'A'; /** - * Cached highest row + * Cached highest row. * * @var int */ @@ -281,49 +282,49 @@ class Worksheet implements IComparable private $rightToLeft = false; /** - * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' + * Hyperlinks. Indexed by cell coordinate, e.g. 'A1'. * * @var array */ private $hyperlinkCollection = []; /** - * Data validation objects. Indexed by cell coordinate, e.g. 'A1' + * Data validation objects. Indexed by cell coordinate, e.g. 'A1'. * * @var array */ private $dataValidationCollection = []; /** - * Tab color + * Tab color. * * @var Style\Color */ private $tabColor; /** - * Dirty flag + * Dirty flag. * * @var bool */ private $dirty = true; /** - * Hash + * Hash. * * @var string */ private $hash; /** - * CodeName + * CodeName. * * @var string */ private $codeName = null; /** - * Create a new worksheet + * Create a new worksheet. * * @param Spreadsheet $parent * @param string $pTitle @@ -361,7 +362,7 @@ class Worksheet implements IComparable /** * Disconnect all cells from this Worksheet object, - * typically so that the worksheet object can be unset + * typically so that the worksheet object can be unset. */ public function disconnectCells() { @@ -374,7 +375,7 @@ class Worksheet implements IComparable } /** - * Code to execute when this worksheet is unset() + * Code to execute when this worksheet is unset(). */ public function __destruct() { @@ -384,7 +385,7 @@ class Worksheet implements IComparable } /** - * Return the cache controller for the cell collection + * Return the cache controller for the cell collection. * * @return CachedObjectStorage_xxx */ @@ -394,7 +395,7 @@ class Worksheet implements IComparable } /** - * Get array of invalid characters for sheet title + * Get array of invalid characters for sheet title. * * @return array */ @@ -404,10 +405,12 @@ class Worksheet implements IComparable } /** - * Check sheet code name for valid Excel syntax + * Check sheet code name for valid Excel syntax. * * @param string $pValue The string to check + * * @throws Exception + * * @return string The valid string */ private static function checkSheetCodeName($pValue) @@ -432,10 +435,12 @@ class Worksheet implements IComparable } /** - * Check sheet title for valid Excel syntax + * Check sheet title for valid Excel syntax. * * @param string $pValue The string to check + * * @throws Exception + * * @return string The valid string */ private static function checkSheetTitle($pValue) @@ -454,9 +459,10 @@ class Worksheet implements IComparable } /** - * Get collection of cells + * Get collection of cells. * * @param bool $pSorted Also sort the cell collection? + * * @return Cell[] */ public function getCellCollection($pSorted = true) @@ -473,7 +479,7 @@ class Worksheet implements IComparable } /** - * Sort collection of cells + * Sort collection of cells. * * @return Worksheet */ @@ -487,7 +493,7 @@ class Worksheet implements IComparable } /** - * Get collection of row dimensions + * Get collection of row dimensions. * * @return Worksheet\RowDimension[] */ @@ -497,7 +503,7 @@ class Worksheet implements IComparable } /** - * Get default row dimension + * Get default row dimension. * * @return Worksheet\RowDimension */ @@ -507,7 +513,7 @@ class Worksheet implements IComparable } /** - * Get collection of column dimensions + * Get collection of column dimensions. * * @return Worksheet\ColumnDimension[] */ @@ -517,7 +523,7 @@ class Worksheet implements IComparable } /** - * Get default column dimension + * Get default column dimension. * * @return Worksheet\ColumnDimension */ @@ -527,7 +533,7 @@ class Worksheet implements IComparable } /** - * Get collection of drawings + * Get collection of drawings. * * @return Worksheet\BaseDrawing[] */ @@ -537,7 +543,7 @@ class Worksheet implements IComparable } /** - * Get collection of charts + * Get collection of charts. * * @return Chart[] */ @@ -547,10 +553,11 @@ class Worksheet implements IComparable } /** - * Add chart + * Add chart. * * @param Chart $pChart * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) + * * @return Chart */ public function addChart(Chart $pChart = null, $iChartIndex = null) @@ -567,7 +574,7 @@ class Worksheet implements IComparable } /** - * Return the count of charts on this worksheet + * Return the count of charts on this worksheet. * * @return int The number of charts */ @@ -577,10 +584,12 @@ class Worksheet implements IComparable } /** - * Get a chart by its index position + * Get a chart by its index position. * * @param string $index Chart index position + * * @throws Exception + * * @return false|Chart */ public function getChartByIndex($index = null) @@ -600,9 +609,10 @@ class Worksheet implements IComparable } /** - * Return an array of the names of charts on this worksheet + * Return an array of the names of charts on this worksheet. * * @throws Exception + * * @return string[] The names of charts */ public function getChartNames() @@ -616,10 +626,12 @@ class Worksheet implements IComparable } /** - * Get a chart by name + * Get a chart by name. * * @param string $chartName Chart name + * * @throws Exception + * * @return false|Chart */ public function getChartByName($chartName = '') @@ -638,7 +650,7 @@ class Worksheet implements IComparable } /** - * Refresh column dimensions + * Refresh column dimensions. * * @return Worksheet */ @@ -657,7 +669,7 @@ class Worksheet implements IComparable } /** - * Refresh row dimensions + * Refresh row dimensions. * * @return Worksheet */ @@ -676,7 +688,7 @@ class Worksheet implements IComparable } /** - * Calculate worksheet dimension + * Calculate worksheet dimension. * * @return string String containing the dimension of this worksheet */ @@ -687,7 +699,7 @@ class Worksheet implements IComparable } /** - * Calculate worksheet data dimension + * Calculate worksheet data dimension. * * @return string String containing the dimension of this worksheet that actually contain data */ @@ -698,7 +710,7 @@ class Worksheet implements IComparable } /** - * Calculate widths for auto-size columns + * Calculate widths for auto-size columns. * * @return Worksheet; */ @@ -776,7 +788,7 @@ class Worksheet implements IComparable } /** - * Get parent + * Get parent. * * @return Spreadsheet */ @@ -786,9 +798,10 @@ class Worksheet implements IComparable } /** - * Re-bind parent + * Re-bind parent. * * @param Spreadsheet $parent + * * @return Worksheet */ public function rebindParent(Spreadsheet $parent) @@ -809,7 +822,7 @@ class Worksheet implements IComparable } /** - * Get title + * Get title. * * @return string */ @@ -819,7 +832,7 @@ class Worksheet implements IComparable } /** - * Set title + * Set title. * * @param string $pValue String containing the dimension of this worksheet * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should @@ -827,6 +840,7 @@ class Worksheet implements IComparable * This should be left as the default true, unless you are * certain that no formula cells on any worksheet contain * references to this worksheet + * * @return Worksheet */ public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) @@ -888,7 +902,7 @@ class Worksheet implements IComparable } /** - * Get sheet state + * Get sheet state. * * @return string Sheet state (visible, hidden, veryHidden) */ @@ -898,9 +912,10 @@ class Worksheet implements IComparable } /** - * Set sheet state + * Set sheet state. * * @param string $value Sheet state (visible, hidden, veryHidden) + * * @return Worksheet */ public function setSheetState($value = self::SHEETSTATE_VISIBLE) @@ -911,7 +926,7 @@ class Worksheet implements IComparable } /** - * Get page setup + * Get page setup. * * @return Worksheet\PageSetup */ @@ -921,9 +936,10 @@ class Worksheet implements IComparable } /** - * Set page setup + * Set page setup. * * @param Worksheet\PageSetup $pValue + * * @return Worksheet */ public function setPageSetup(Worksheet\PageSetup $pValue) @@ -934,7 +950,7 @@ class Worksheet implements IComparable } /** - * Get page margins + * Get page margins. * * @return Worksheet\PageMargins */ @@ -944,9 +960,10 @@ class Worksheet implements IComparable } /** - * Set page margins + * Set page margins. * * @param Worksheet\PageMargins $pValue + * * @return Worksheet */ public function setPageMargins(Worksheet\PageMargins $pValue) @@ -957,7 +974,7 @@ class Worksheet implements IComparable } /** - * Get page header/footer + * Get page header/footer. * * @return Worksheet\HeaderFooter */ @@ -967,9 +984,10 @@ class Worksheet implements IComparable } /** - * Set page header/footer + * Set page header/footer. * * @param Worksheet\HeaderFooter $pValue + * * @return Worksheet */ public function setHeaderFooter(Worksheet\HeaderFooter $pValue) @@ -980,7 +998,7 @@ class Worksheet implements IComparable } /** - * Get sheet view + * Get sheet view. * * @return Worksheet\SheetView */ @@ -990,9 +1008,10 @@ class Worksheet implements IComparable } /** - * Set sheet view + * Set sheet view. * * @param Worksheet\SheetView $pValue + * * @return Worksheet */ public function setSheetView(Worksheet\SheetView $pValue) @@ -1003,7 +1022,7 @@ class Worksheet implements IComparable } /** - * Get Protection + * Get Protection. * * @return Worksheet\Protection */ @@ -1013,9 +1032,10 @@ class Worksheet implements IComparable } /** - * Set Protection + * Set Protection. * * @param Worksheet\Protection $pValue + * * @return Worksheet */ public function setProtection(Worksheet\Protection $pValue) @@ -1027,10 +1047,11 @@ class Worksheet implements IComparable } /** - * Get highest worksheet column + * Get highest worksheet column. * * @param string $row Return the data highest column for the specified row, * or the highest column of any row if no row number is passed + * * @return string Highest column name */ public function getHighestColumn($row = null) @@ -1043,10 +1064,11 @@ class Worksheet implements IComparable } /** - * Get highest worksheet column that contains data + * Get highest worksheet column that contains data. * * @param string $row Return the highest data column for the specified row, * or the highest data column of any row if no row number is passed + * * @return string Highest column name that contains data */ public function getHighestDataColumn($row = null) @@ -1055,10 +1077,11 @@ class Worksheet implements IComparable } /** - * Get highest worksheet row + * Get highest worksheet row. * * @param string $column Return the highest data row for the specified column, * or the highest row of any column if no column letter is passed + * * @return int Highest row number */ public function getHighestRow($column = null) @@ -1071,10 +1094,11 @@ class Worksheet implements IComparable } /** - * Get highest worksheet row that contains data + * Get highest worksheet row that contains data. * * @param string $column Return the highest data row for the specified column, * or the highest data row of any column if no column letter is passed + * * @return string Highest row number that contains data */ public function getHighestDataRow($column = null) @@ -1083,7 +1107,7 @@ class Worksheet implements IComparable } /** - * Get highest worksheet column and highest row that have cell records + * Get highest worksheet column and highest row that have cell records. * * @return array Highest column name and highest row number */ @@ -1093,11 +1117,12 @@ class Worksheet implements IComparable } /** - * Set a cell value + * Set a cell value. * * @param string $pCoordinate Coordinate of the cell * @param mixed $pValue Value of the cell * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * * @return Worksheet|Cell Depending on the last parameter being specified */ public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) @@ -1108,12 +1133,13 @@ class Worksheet implements IComparable } /** - * Set a cell value by using numeric cell coordinates + * Set a cell value by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell (A = 0) * @param int $pRow Numeric row coordinate of the cell * @param mixed $pValue Value of the cell * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * * @return Worksheet|Cell Depending on the last parameter being specified */ public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) @@ -1124,12 +1150,13 @@ class Worksheet implements IComparable } /** - * Set a cell value + * Set a cell value. * * @param string $pCoordinate Coordinate of the cell * @param mixed $pValue Value of the cell * @param string $pDataType Explicit data type * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * * @return Worksheet|Cell Depending on the last parameter being specified */ public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) @@ -1141,13 +1168,14 @@ class Worksheet implements IComparable } /** - * Set a cell value by using numeric cell coordinates + * Set a cell value by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell * @param mixed $pValue Value of the cell * @param string $pDataType Explicit data type * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * * @return Worksheet|Cell Depending on the last parameter being specified */ public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) @@ -1158,12 +1186,14 @@ class Worksheet implements IComparable } /** - * Get cell at a specific coordinate + * Get cell at a specific coordinate. * * @param string $pCoordinate Coordinate of the cell * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't * already exist, or a null should be returned instead + * * @throws Exception + * * @return null|Cell Cell that was found/created or null */ public function getCell($pCoordinate = 'A1', $createIfNotExists = true) @@ -1205,12 +1235,13 @@ class Worksheet implements IComparable } /** - * Get cell at a specific coordinate by using numeric cell coordinates + * Get cell at a specific coordinate by using numeric cell coordinates. * * @param string $pColumn Numeric column coordinate of the cell * @param string $pRow Numeric row coordinate of the cell * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't * already exist, or a null should be returned instead + * * @return null|Cell Cell that was found/created or null */ public function getCellByColumnAndRow($pColumn = 0, $pRow = 1, $createIfNotExists = true) @@ -1227,9 +1258,10 @@ class Worksheet implements IComparable } /** - * Create a new cell at the specified coordinate + * Create a new cell at the specified coordinate. * * @param string $pCoordinate Coordinate of the cell + * * @return Cell Cell that was created */ private function createNewCell($pCoordinate) @@ -1267,7 +1299,9 @@ class Worksheet implements IComparable * Does the cell at a specific coordinate exist? * * @param string $pCoordinate Coordinate of the cell + * * @throws Exception + * * @return bool */ public function cellExists($pCoordinate = 'A1') @@ -1288,9 +1322,8 @@ class Worksheet implements IComparable if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { if (!$namedRange->getLocalOnly()) { return $namedRange->getWorksheet()->cellExists($pCoordinate); - } else { - throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); } + throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); } } else { return false; @@ -1304,13 +1337,12 @@ class Worksheet implements IComparable throw new Exception('Cell coordinate can not be a range of cells.'); } elseif (strpos($pCoordinate, '$') !== false) { throw new Exception('Cell coordinate must not be absolute.'); - } else { + } // Coordinates $aCoordinates = Cell::coordinateFromString($pCoordinate); // Cell exists? return $this->cellCollection->isDataSet($pCoordinate); - } } /** @@ -1318,6 +1350,7 @@ class Worksheet implements IComparable * * @param string $pColumn Numeric column coordinate of the cell * @param string $pRow Numeric row coordinate of the cell + * * @return bool */ public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) @@ -1326,9 +1359,11 @@ class Worksheet implements IComparable } /** - * Get row dimension at a specific row + * Get row dimension at a specific row. * * @param int $pRow Numeric index of the row + * @param mixed $create + * * @return Worksheet\RowDimension */ public function getRowDimension($pRow = 1, $create = true) @@ -1350,9 +1385,11 @@ class Worksheet implements IComparable } /** - * Get column dimension at a specific column + * Get column dimension at a specific column. * * @param string $pColumn String index of the column + * @param mixed $create + * * @return Worksheet\ColumnDimension */ public function getColumnDimension($pColumn = 'A', $create = true) @@ -1376,9 +1413,10 @@ class Worksheet implements IComparable } /** - * Get column dimension at a specific column by using numeric cell coordinates + * Get column dimension at a specific column by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell + * * @return Worksheet\ColumnDimension */ public function getColumnDimensionByColumn($pColumn = 0) @@ -1387,7 +1425,7 @@ class Worksheet implements IComparable } /** - * Get styles + * Get styles. * * @return Style[] */ @@ -1397,10 +1435,12 @@ class Worksheet implements IComparable } /** - * Get style for cell + * Get style for cell. * * @param string $pCellCoordinate Cell coordinate (or range) to get style for + * * @throws Exception + * * @return Style */ public function getStyle($pCellCoordinate = 'A1') @@ -1415,9 +1455,10 @@ class Worksheet implements IComparable } /** - * Get conditional styles for a cell + * Get conditional styles for a cell. * * @param string $pCoordinate + * * @return Style\Conditional[] */ public function getConditionalStyles($pCoordinate = 'A1') @@ -1434,6 +1475,7 @@ class Worksheet implements IComparable * Do conditional styles exist for this cell? * * @param string $pCoordinate + * * @return bool */ public function conditionalStylesExists($pCoordinate = 'A1') @@ -1446,9 +1488,10 @@ class Worksheet implements IComparable } /** - * Removes conditional styles for a cell + * Removes conditional styles for a cell. * * @param string $pCoordinate + * * @return Worksheet */ public function removeConditionalStyles($pCoordinate = 'A1') @@ -1459,7 +1502,7 @@ class Worksheet implements IComparable } /** - * Get collection of conditional styles + * Get collection of conditional styles. * * @return array */ @@ -1469,10 +1512,11 @@ class Worksheet implements IComparable } /** - * Set conditional styles + * Set conditional styles. * * @param string $pCoordinate eg: 'A1' * @param $pValue Style\Conditional[] + * * @return Worksheet */ public function setConditionalStyles($pCoordinate, $pValue) @@ -1483,12 +1527,15 @@ class Worksheet implements IComparable } /** - * Get style for cell by using numeric cell coordinates + * Get style for cell by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell * @param int pColumn2 Numeric column coordinate of the range cell * @param int pRow2 Numeric row coordinate of the range cell + * @param null|mixed $pColumn2 + * @param null|mixed $pRow2 + * * @return Style */ public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null) @@ -1503,13 +1550,15 @@ class Worksheet implements IComparable } /** - * Duplicate cell style to a range of cells + * Duplicate cell style to a range of cells. * * Please note that this will overwrite existing cell styles for cells in range! * * @param Style $pCellStyle Cell style to duplicate * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * * @throws Exception + * * @return Worksheet */ public function duplicateStyle(Style $pCellStyle = null, $pRange = '') @@ -1549,13 +1598,15 @@ class Worksheet implements IComparable } /** - * Duplicate conditional style to a range of cells + * Duplicate conditional style to a range of cells. * * Please note that this will overwrite existing cell styles for cells in range! * * @param Style\Conditional[] $pCellStyle Cell style to duplicate * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * * @throws Exception + * * @return Worksheet */ public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') @@ -1587,11 +1638,13 @@ class Worksheet implements IComparable } /** - * Set break on a cell + * Set break on a cell. * * @param string $pCell Cell coordinate (e.g. A1) * @param int $pBreak Break type (type of Worksheet::BREAK_*) + * * @throws Exception + * * @return Worksheet */ public function setBreak($pCell = 'A1', $pBreak = self::BREAK_NONE) @@ -1615,11 +1668,12 @@ class Worksheet implements IComparable } /** - * Set break on a cell by using numeric cell coordinates + * Set break on a cell by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell * @param int $pBreak Break type (type of \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_*) + * * @return Worksheet */ public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = self::BREAK_NONE) @@ -1628,7 +1682,7 @@ class Worksheet implements IComparable } /** - * Get breaks + * Get breaks. * * @return array[] */ @@ -1638,10 +1692,12 @@ class Worksheet implements IComparable } /** - * Set merge on a cell range + * Set merge on a cell range. * * @param string $pRange Cell range (e.g. A1:E1) + * * @throws Exception + * * @return Worksheet */ public function mergeCells($pRange = 'A1:A1') @@ -1678,13 +1734,15 @@ class Worksheet implements IComparable } /** - * Set merge on a cell range by using numeric cell coordinates + * Set merge on a cell range by using numeric cell coordinates. * * @param int $pColumn1 Numeric column coordinate of the first cell * @param int $pRow1 Numeric row coordinate of the first cell * @param int $pColumn2 Numeric column coordinate of the last cell * @param int $pRow2 Numeric row coordinate of the last cell + * * @throws Exception + * * @return Worksheet */ public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) @@ -1695,10 +1753,12 @@ class Worksheet implements IComparable } /** - * Remove merge on a cell range + * Remove merge on a cell range. * * @param string $pRange Cell range (e.g. A1:E1) + * * @throws Exception + * * @return Worksheet */ public function unmergeCells($pRange = 'A1:A1') @@ -1720,13 +1780,15 @@ class Worksheet implements IComparable } /** - * Remove merge on a cell range by using numeric cell coordinates + * Remove merge on a cell range by using numeric cell coordinates. * * @param int $pColumn1 Numeric column coordinate of the first cell * @param int $pRow1 Numeric row coordinate of the first cell * @param int $pColumn2 Numeric column coordinate of the last cell * @param int $pRow2 Numeric row coordinate of the last cell + * * @throws Exception + * * @return Worksheet */ public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) @@ -1751,6 +1813,7 @@ class Worksheet implements IComparable * a single cell range. * * @param array + * @param mixed $pValue */ public function setMergeCells($pValue = []) { @@ -1760,12 +1823,14 @@ class Worksheet implements IComparable } /** - * Set protection on a cell range + * Set protection on a cell range. * * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) * @param string $pPassword Password to unlock the protection * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * * @throws Exception + * * @return Worksheet */ public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) @@ -1782,7 +1847,7 @@ class Worksheet implements IComparable } /** - * Set protection on a cell range by using numeric cell coordinates + * Set protection on a cell range by using numeric cell coordinates. * * @param int $pColumn1 Numeric column coordinate of the first cell * @param int $pRow1 Numeric row coordinate of the first cell @@ -1790,7 +1855,9 @@ class Worksheet implements IComparable * @param int $pRow2 Numeric row coordinate of the last cell * @param string $pPassword Password to unlock the protection * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * * @throws Exception + * * @return Worksheet */ public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) @@ -1801,10 +1868,12 @@ class Worksheet implements IComparable } /** - * Remove protection on a cell range + * Remove protection on a cell range. * * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * * @throws Exception + * * @return Worksheet */ public function unprotectCells($pRange = 'A1') @@ -1822,7 +1891,7 @@ class Worksheet implements IComparable } /** - * Remove protection on a cell range by using numeric cell coordinates + * Remove protection on a cell range by using numeric cell coordinates. * * @param int $pColumn1 Numeric column coordinate of the first cell * @param int $pRow1 Numeric row coordinate of the first cell @@ -1830,7 +1899,9 @@ class Worksheet implements IComparable * @param int $pRow2 Numeric row coordinate of the last cell * @param string $pPassword Password to unlock the protection * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * * @throws Exception + * * @return Worksheet */ public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) @@ -1841,7 +1912,7 @@ class Worksheet implements IComparable } /** - * Get protected cells + * Get protected cells. * * @return array[] */ @@ -1851,7 +1922,7 @@ class Worksheet implements IComparable } /** - * Get Autofilter + * Get Autofilter. * * @return Worksheet\AutoFilter */ @@ -1861,11 +1932,13 @@ class Worksheet implements IComparable } /** - * Set AutoFilter + * Set AutoFilter. * * @param Worksheet\AutoFilter|string $pValue * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility + * * @throws Exception + * * @return Worksheet */ public function setAutoFilter($pValue) @@ -1881,13 +1954,15 @@ class Worksheet implements IComparable } /** - * Set Autofilter Range by using numeric cell coordinates + * Set Autofilter Range by using numeric cell coordinates. * * @param int $pColumn1 Numeric column coordinate of the first cell * @param int $pRow1 Numeric row coordinate of the first cell * @param int $pColumn2 Numeric column coordinate of the second cell * @param int $pRow2 Numeric row coordinate of the second cell + * * @throws Exception + * * @return Worksheet */ public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) @@ -1900,7 +1975,7 @@ class Worksheet implements IComparable } /** - * Remove autofilter + * Remove autofilter. * * @return Worksheet */ @@ -1912,7 +1987,7 @@ class Worksheet implements IComparable } /** - * Get Freeze Pane + * Get Freeze Pane. * * @return string */ @@ -1922,7 +1997,7 @@ class Worksheet implements IComparable } /** - * Freeze Pane + * Freeze Pane. * * @param string $pCell Cell (i.e. A2) * Examples: @@ -1930,7 +2005,9 @@ class Worksheet implements IComparable * B1 will freeze the columns to the left of cell B1 (i.e column A) * B2 will freeze the rows above and to the left of cell A2 * (i.e row 1 and column A) + * * @throws Exception + * * @return Worksheet */ public function freezePane($pCell = '') @@ -1947,11 +2024,13 @@ class Worksheet implements IComparable } /** - * Freeze Pane by using numeric cell coordinates + * Freeze Pane by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell + * * @throws Exception + * * @return Worksheet */ public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) @@ -1960,7 +2039,7 @@ class Worksheet implements IComparable } /** - * Unfreeze Pane + * Unfreeze Pane. * * @return Worksheet */ @@ -1970,11 +2049,13 @@ class Worksheet implements IComparable } /** - * Insert a new row, updating all possible related data + * Insert a new row, updating all possible related data. * * @param int $pBefore Insert before this one * @param int $pNumRows Number of rows to insert + * * @throws Exception + * * @return Worksheet */ public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) @@ -1990,11 +2071,13 @@ class Worksheet implements IComparable } /** - * Insert a new column, updating all possible related data + * Insert a new column, updating all possible related data. * * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to insert + * * @throws Exception + * * @return Worksheet */ public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) @@ -2010,28 +2093,31 @@ class Worksheet implements IComparable } /** - * Insert a new column, updating all possible related data + * Insert a new column, updating all possible related data. * * @param int $pBefore Insert before this one (numeric column coordinate of the cell) * @param int $pNumCols Number of columns to insert + * * @throws Exception + * * @return Worksheet */ public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) { if ($pBefore >= 0) { return $this->insertNewColumnBefore(Cell::stringFromColumnIndex($pBefore), $pNumCols); - } else { - throw new Exception('Columns can only be inserted before at least column A (0).'); } + throw new Exception('Columns can only be inserted before at least column A (0).'); } /** - * Delete a row, updating all possible related data + * Delete a row, updating all possible related data. * * @param int $pRow Remove starting with this one * @param int $pNumRows Number of rows to remove + * * @throws Exception + * * @return Worksheet */ public function removeRow($pRow = 1, $pNumRows = 1) @@ -2052,11 +2138,13 @@ class Worksheet implements IComparable } /** - * Remove a column, updating all possible related data + * Remove a column, updating all possible related data. * * @param string $pColumn Remove starting with this one * @param int $pNumCols Number of columns to remove + * * @throws Exception + * * @return Worksheet */ public function removeColumn($pColumn = 'A', $pNumCols = 1) @@ -2078,20 +2166,21 @@ class Worksheet implements IComparable } /** - * Remove a column, updating all possible related data + * Remove a column, updating all possible related data. * * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) * @param int $pNumCols Number of columns to remove + * * @throws Exception + * * @return Worksheet */ public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) { if ($pColumn >= 0) { return $this->removeColumn(Cell::stringFromColumnIndex($pColumn), $pNumCols); - } else { - throw new Exception('Columns to be deleted should at least start from column 0'); } + throw new Exception('Columns to be deleted should at least start from column 0'); } /** @@ -2105,9 +2194,10 @@ class Worksheet implements IComparable } /** - * Set show gridlines + * Set show gridlines. * * @param bool $pValue Show gridlines (true/false) + * * @return Worksheet */ public function setShowGridlines($pValue = false) @@ -2128,9 +2218,10 @@ class Worksheet implements IComparable } /** - * Set print gridlines + * Set print gridlines. * * @param bool $pValue Print gridlines (true/false) + * * @return Worksheet */ public function setPrintGridlines($pValue = false) @@ -2151,9 +2242,10 @@ class Worksheet implements IComparable } /** - * Set show row and column headers + * Set show row and column headers. * * @param bool $pValue Show row and column headers (true/false) + * * @return Worksheet */ public function setShowRowColHeaders($pValue = false) @@ -2164,7 +2256,7 @@ class Worksheet implements IComparable } /** - * Show summary below? (Row/Column outlining) + * Show summary below? (Row/Column outlining). * * @return bool */ @@ -2174,9 +2266,10 @@ class Worksheet implements IComparable } /** - * Set show summary below + * Set show summary below. * * @param bool $pValue Show summary below (true/false) + * * @return Worksheet */ public function setShowSummaryBelow($pValue = true) @@ -2187,7 +2280,7 @@ class Worksheet implements IComparable } /** - * Show summary right? (Row/Column outlining) + * Show summary right? (Row/Column outlining). * * @return bool */ @@ -2197,9 +2290,10 @@ class Worksheet implements IComparable } /** - * Set show summary right + * Set show summary right. * * @param bool $pValue Show summary right (true/false) + * * @return Worksheet */ public function setShowSummaryRight($pValue = true) @@ -2210,7 +2304,7 @@ class Worksheet implements IComparable } /** - * Get comments + * Get comments. * * @return Comment[] */ @@ -2223,6 +2317,8 @@ class Worksheet implements IComparable * Set comments array for the entire sheet. * * @param array of Comment + * @param mixed $pValue + * * @return Worksheet */ public function setComments($pValue = []) @@ -2233,10 +2329,12 @@ class Worksheet implements IComparable } /** - * Get comment for cell + * Get comment for cell. * * @param string $pCellCoordinate Cell coordinate to get comment for + * * @throws Exception + * * @return Comment */ public function getComment($pCellCoordinate = 'A1') @@ -2250,25 +2348,24 @@ class Worksheet implements IComparable throw new Exception('Cell coordinate string must not be absolute.'); } elseif ($pCellCoordinate == '') { throw new Exception('Cell coordinate can not be zero-length string.'); - } else { + } // Check if we already have a comment for this cell. // If not, create a new comment. if (isset($this->comments[$pCellCoordinate])) { return $this->comments[$pCellCoordinate]; - } else { - $newComment = new Comment(); - $this->comments[$pCellCoordinate] = $newComment; - - return $newComment; } - } + $newComment = new Comment(); + $this->comments[$pCellCoordinate] = $newComment; + + return $newComment; } /** - * Get comment for cell by using numeric cell coordinates + * Get comment for cell by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell + * * @return Comment */ public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) @@ -2277,7 +2374,7 @@ class Worksheet implements IComparable } /** - * Get active cell + * Get active cell. * * @return string Example: 'A1' */ @@ -2287,7 +2384,7 @@ class Worksheet implements IComparable } /** - * Get selected cells + * Get selected cells. * * @return string */ @@ -2297,9 +2394,10 @@ class Worksheet implements IComparable } /** - * Selected cell + * Selected cell. * * @param string $pCoordinate Cell (i.e. A1) + * * @return Worksheet */ public function setSelectedCell($pCoordinate = 'A1') @@ -2311,7 +2409,9 @@ class Worksheet implements IComparable * Select a range of cells. * * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' + * * @throws Exception + * * @return Worksheet */ public function setSelectedCells($pCoordinate = 'A1') @@ -2343,11 +2443,13 @@ class Worksheet implements IComparable } /** - * Selected cell by using numeric cell coordinates + * Selected cell by using numeric cell coordinates. * * @param int $pColumn Numeric column coordinate of the cell * @param int $pRow Numeric row coordinate of the cell + * * @throws Exception + * * @return Worksheet */ public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) @@ -2356,7 +2458,7 @@ class Worksheet implements IComparable } /** - * Get right-to-left + * Get right-to-left. * * @return bool */ @@ -2366,9 +2468,10 @@ class Worksheet implements IComparable } /** - * Set right-to-left + * Set right-to-left. * * @param bool $value Right-to-left true/false + * * @return Worksheet */ public function setRightToLeft($value = false) @@ -2379,13 +2482,15 @@ class Worksheet implements IComparable } /** - * Fill worksheet from values in array + * Fill worksheet from values in array. * * @param array $source Source array * @param mixed $nullValue Value in source array that stands for blank cell * @param string $startCell Insert array starting from this cell address as the top left coordinate * @param bool $strictNullComparison Apply strict comparison when testing for null values in the array + * * @throws Exception + * * @return Worksheet */ public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) @@ -2426,7 +2531,7 @@ class Worksheet implements IComparable } /** - * Create array from a range of cells + * Create array from a range of cells. * * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist @@ -2434,6 +2539,7 @@ class Worksheet implements IComparable * @param bool $formatData Should formatting be applied to cell values? * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero * True - Return rows and columns indexed by their actual row and column IDs + * * @return array */ public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) @@ -2495,7 +2601,7 @@ class Worksheet implements IComparable } /** - * Create array from a range of cells + * Create array from a range of cells. * * @param string $pNamedRange Name of the Named Range * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist @@ -2503,7 +2609,9 @@ class Worksheet implements IComparable * @param bool $formatData Should formatting be applied to cell values? * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero * True - Return rows and columns indexed by their actual row and column IDs + * * @throws Exception + * * @return array */ public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) @@ -2520,13 +2628,14 @@ class Worksheet implements IComparable } /** - * Create array from worksheet + * Create array from worksheet. * * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist * @param bool $calculateFormulas Should formulas be calculated? * @param bool $formatData Should formatting be applied to cell values? * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero * True - Return rows and columns indexed by their actual row and column IDs + * * @return array */ public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) @@ -2542,7 +2651,7 @@ class Worksheet implements IComparable } /** - * Get row iterator + * Get row iterator. * * @param int $startRow The row number at which to start iterating * @param int $endRow The row number at which to stop iterating @@ -2555,7 +2664,7 @@ class Worksheet implements IComparable } /** - * Get column iterator + * Get column iterator. * * @param string $startColumn The column address at which to start iterating * @param string $endColumn The column address at which to stop iterating @@ -2605,7 +2714,7 @@ class Worksheet implements IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ @@ -2627,6 +2736,7 @@ class Worksheet implements IComparable * * @param string $pRange Range to extract title from * @param bool $returnRange Return range? (see example) + * * @return mixed */ public static function extractSheetTitle($pRange, $returnRange = false) @@ -2644,7 +2754,7 @@ class Worksheet implements IComparable } /** - * Get hyperlink + * Get hyperlink. * * @param string $pCellCoordinate Cell coordinate to get hyperlink for */ @@ -2662,10 +2772,11 @@ class Worksheet implements IComparable } /** - * Set hyperlnk + * Set hyperlnk. * * @param string $pCellCoordinate Cell coordinate to insert hyperlink * @param Cell\Hyperlink $pHyperlink + * * @return Worksheet */ public function setHyperlink($pCellCoordinate = 'A1', Cell\Hyperlink $pHyperlink = null) @@ -2683,6 +2794,7 @@ class Worksheet implements IComparable * Hyperlink at a specific coordinate exists? * * @param string $pCoordinate + * * @return bool */ public function hyperlinkExists($pCoordinate = 'A1') @@ -2691,7 +2803,7 @@ class Worksheet implements IComparable } /** - * Get collection of hyperlinks + * Get collection of hyperlinks. * * @return Cell\Hyperlink[] */ @@ -2701,7 +2813,7 @@ class Worksheet implements IComparable } /** - * Get data validation + * Get data validation. * * @param string $pCellCoordinate Cell coordinate to get data validation for */ @@ -2719,10 +2831,11 @@ class Worksheet implements IComparable } /** - * Set data validation + * Set data validation. * * @param string $pCellCoordinate Cell coordinate to insert data validation * @param Cell\DataValidation $pDataValidation + * * @return Worksheet */ public function setDataValidation($pCellCoordinate = 'A1', Cell\DataValidation $pDataValidation = null) @@ -2740,6 +2853,7 @@ class Worksheet implements IComparable * Data validation at a specific coordinate exists? * * @param string $pCoordinate + * * @return bool */ public function dataValidationExists($pCoordinate = 'A1') @@ -2748,7 +2862,7 @@ class Worksheet implements IComparable } /** - * Get collection of data validations + * Get collection of data validations. * * @return Cell\DataValidation[] */ @@ -2758,9 +2872,10 @@ class Worksheet implements IComparable } /** - * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet + * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet. * * @param string $range + * * @return string Adjusted range value */ public function shrinkRangeToFit($range) @@ -2794,7 +2909,7 @@ class Worksheet implements IComparable } /** - * Get tab color + * Get tab color. * * @return Style\Color */ @@ -2808,7 +2923,7 @@ class Worksheet implements IComparable } /** - * Reset tab color + * Reset tab color. * * @return Worksheet */ @@ -2831,7 +2946,7 @@ class Worksheet implements IComparable } /** - * Copy worksheet (!= clone!) + * Copy worksheet (!= clone!). * * @return Worksheet */ @@ -2870,11 +2985,15 @@ class Worksheet implements IComparable } } } + /** - * Define the code name of the sheet + * Define the code name of the sheet. * * @param null|string Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore) + * @param null|mixed $pValue + * * @throws Exception + * * @return objWorksheet */ public function setCodeName($pValue = null) @@ -2922,8 +3041,9 @@ class Worksheet implements IComparable return $this; } + /** - * Return the code name of the sheet + * Return the code name of the sheet. * * @return null|string */ @@ -2931,8 +3051,10 @@ class Worksheet implements IComparable { return $this->codeName; } + /** * Sheet has a code name ? + * * @return bool */ public function hasCodeName() diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 6d284ade..409175c3 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,34 +20,35 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class AutoFilter { /** - * Autofilter Worksheet + * Autofilter Worksheet. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ private $workSheet; /** - * Autofilter Range + * Autofilter Range. * * @var string */ private $range = ''; /** - * Autofilter Column Ruleset + * Autofilter Column Ruleset. * * @var AutoFilter\Column[] */ private $columns = []; /** - * Create a new AutoFilter + * Create a new AutoFilter. * * @param string $pRange Cell range (i.e. A1:E10) * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet @@ -59,7 +60,7 @@ class AutoFilter } /** - * Get AutoFilter Parent Worksheet + * Get AutoFilter Parent Worksheet. * * @return \PhpOffice\PhpSpreadsheet\Worksheet */ @@ -69,9 +70,10 @@ class AutoFilter } /** - * Set AutoFilter Parent Worksheet + * Set AutoFilter Parent Worksheet. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet + * * @return AutoFilter */ public function setParent(\PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -82,7 +84,7 @@ class AutoFilter } /** - * Get AutoFilter Range + * Get AutoFilter Range. * * @return string */ @@ -92,10 +94,12 @@ class AutoFilter } /** - * Set AutoFilter Range + * Set AutoFilter Range. * * @param string $pRange Cell range (i.e. A1:E10) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter */ public function setRange($pRange = '') @@ -132,9 +136,10 @@ class AutoFilter } /** - * Get all AutoFilter Columns + * Get all AutoFilter Columns. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter\Column[] */ public function getColumns() @@ -143,10 +148,12 @@ class AutoFilter } /** - * Validate that the specified column is in the AutoFilter range + * Validate that the specified column is in the AutoFilter range. * * @param string $column Column name (e.g. A) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return int The column offset within the autofilter range */ public function testColumnInRange($column) @@ -165,10 +172,12 @@ class AutoFilter } /** - * Get a specified AutoFilter Column Offset within the defined AutoFilter range + * Get a specified AutoFilter Column Offset within the defined AutoFilter range. * * @param string $pColumn Column name (e.g. A) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return int The offset of the specified column within the autofilter range */ public function getColumnOffset($pColumn) @@ -177,10 +186,12 @@ class AutoFilter } /** - * Get a specified AutoFilter Column + * Get a specified AutoFilter Column. * * @param string $pColumn Column name (e.g. A) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter\Column */ public function getColumn($pColumn) @@ -195,10 +206,12 @@ class AutoFilter } /** - * Get a specified AutoFilter Column by it's offset + * Get a specified AutoFilter Column by it's offset. * * @param int $pColumnOffset Column offset within range (starting from 0) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter\Column */ public function getColumnByOffset($pColumnOffset = 0) @@ -210,11 +223,13 @@ class AutoFilter } /** - * Set AutoFilter + * Set AutoFilter. * * @param AutoFilter\Column|string $pColumn * A simple string containing a Column ID like 'A' is permitted + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter */ public function setColumn($pColumn) @@ -240,10 +255,12 @@ class AutoFilter } /** - * Clear a specified AutoFilter Column + * Clear a specified AutoFilter Column. * * @param string $pColumn Column name (e.g. A) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter */ public function clearColumn($pColumn) @@ -258,7 +275,7 @@ class AutoFilter } /** - * Shift an AutoFilter Column Rule to a different column + * Shift an AutoFilter Column Rule to a different column. * * Note: This method bypasses validation of the destination column to ensure it is within this AutoFilter range. * Nor does it verify whether any column rule already exists at $toColumn, but will simply overrideany existing value. @@ -266,6 +283,7 @@ class AutoFilter * * @param string $fromColumn Column name (e.g. A) * @param string $toColumn Column name (e.g. B) + * * @return AutoFilter */ public function shiftColumn($fromColumn = null, $toColumn = null) @@ -287,10 +305,11 @@ class AutoFilter } /** - * Test if cell value is in the defined set of values + * Test if cell value is in the defined set of values. * * @param mixed $cellValue * @param mixed[] $dataSet + * * @return bool */ private static function filterTestInSimpleDataSet($cellValue, $dataSet) @@ -305,10 +324,11 @@ class AutoFilter } /** - * Test if cell value is in the defined set of Excel date values + * Test if cell value is in the defined set of Excel date values. * * @param mixed $cellValue * @param mixed[] $dataSet + * * @return bool */ private static function filterTestInDateGroupSet($cellValue, $dataSet) @@ -346,10 +366,11 @@ class AutoFilter } /** - * Test if cell value is within a set of values defined by a ruleset + * Test if cell value is within a set of values defined by a ruleset. * * @param mixed $cellValue * @param mixed[] $ruleSet + * * @return bool */ private static function filterTestInCustomDataSet($cellValue, $ruleSet) @@ -424,10 +445,11 @@ class AutoFilter } /** - * Test if cell date value is matches a set of values defined by a set of months + * Test if cell date value is matches a set of values defined by a set of months. * * @param mixed $cellValue * @param mixed[] $monthSet + * * @return bool */ private static function filterTestInPeriodDateSet($cellValue, $monthSet) @@ -448,7 +470,7 @@ class AutoFilter } /** - * Search/Replace arrays to convert Excel wildcard syntax to a regexp syntax for preg_matching + * Search/Replace arrays to convert Excel wildcard syntax to a regexp syntax for preg_matching. * * @var array */ @@ -456,10 +478,11 @@ class AutoFilter private static $toReplace = ['.*', '.', '~', '\*', '\?']; /** - * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation + * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation. * * @param string $dynamicRuleType * @param AutoFilter\Column $filterColumn + * * @return mixed[] */ private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn) @@ -580,9 +603,10 @@ class AutoFilter } /** - * Apply the AutoFilter rules to the AutoFilter Range + * Apply the AutoFilter rules to the AutoFilter Range. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return AutoFilter */ public function showHideRows() @@ -712,7 +736,7 @@ class AutoFilter ]; } else { // Date based - if ($dynamicRuleType{0} == 'M' || $dynamicRuleType{0} == 'Q') { + if ($dynamicRuleType[0] == 'M' || $dynamicRuleType[0] == 'Q') { // Month or Quarter sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period); if ($periodType == 'M') { diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php index 3e45a3da..b6cdcd11 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -35,7 +36,7 @@ class Column const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10'; /** - * Types of autofilter rules + * Types of autofilter rules. * * @var string[] */ @@ -55,7 +56,7 @@ class Column const AUTOFILTER_COLUMN_JOIN_OR = 'or'; /** - * Join options for autofilter rules + * Join options for autofilter rules. * * @var string[] */ @@ -65,49 +66,49 @@ class Column ]; /** - * Autofilter + * Autofilter. * * @var \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter */ private $parent; /** - * Autofilter Column Index + * Autofilter Column Index. * * @var string */ private $columnIndex = ''; /** - * Autofilter Column Filter Type + * Autofilter Column Filter Type. * * @var string */ private $filterType = self::AUTOFILTER_FILTERTYPE_FILTER; /** - * Autofilter Multiple Rules And/Or + * Autofilter Multiple Rules And/Or. * * @var string */ private $join = self::AUTOFILTER_COLUMN_JOIN_OR; /** - * Autofilter Column Rules + * Autofilter Column Rules. * * @var array of Column\Rule */ private $ruleset = []; /** - * Autofilter Column Dynamic Attributes + * Autofilter Column Dynamic Attributes. * * @var array of mixed */ private $attributes = []; /** - * Create a new Column + * Create a new Column. * * @param string $pColumn Column (e.g. A) * @param \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter $pParent Autofilter for this column @@ -119,7 +120,7 @@ class Column } /** - * Get AutoFilter Column Index + * Get AutoFilter Column Index. * * @return string */ @@ -129,10 +130,12 @@ class Column } /** - * Set AutoFilter Column Index + * Set AutoFilter Column Index. * * @param string $pColumn Column (e.g. A) + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Column */ public function setColumnIndex($pColumn) @@ -149,7 +152,7 @@ class Column } /** - * Get this Column's AutoFilter Parent + * Get this Column's AutoFilter Parent. * * @return \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter */ @@ -159,9 +162,10 @@ class Column } /** - * Set this Column's AutoFilter Parent + * Set this Column's AutoFilter Parent. * * @param \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter + * * @return Column */ public function setParent(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter $pParent = null) @@ -172,7 +176,7 @@ class Column } /** - * Get AutoFilter Type + * Get AutoFilter Type. * * @return string */ @@ -182,10 +186,12 @@ class Column } /** - * Set AutoFilter Type + * Set AutoFilter Type. * * @param string $pFilterType + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Column */ public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) @@ -200,7 +206,7 @@ class Column } /** - * Get AutoFilter Multiple Rules And/Or Join + * Get AutoFilter Multiple Rules And/Or Join. * * @return string */ @@ -210,10 +216,12 @@ class Column } /** - * Set AutoFilter Multiple Rules And/Or + * Set AutoFilter Multiple Rules And/Or. * * @param string $pJoin And/Or + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Column */ public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) @@ -230,10 +238,12 @@ class Column } /** - * Set AutoFilter Attributes + * Set AutoFilter Attributes. * * @param string[] $pAttributes + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Column */ public function setAttributes($pAttributes = []) @@ -244,11 +254,13 @@ class Column } /** - * Set An AutoFilter Attribute + * Set An AutoFilter Attribute. * * @param string $pName Attribute Name * @param string $pValue Attribute Value + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Column */ public function setAttribute($pName, $pValue) @@ -259,7 +271,7 @@ class Column } /** - * Get AutoFilter Column Attributes + * Get AutoFilter Column Attributes. * * @return string */ @@ -269,9 +281,10 @@ class Column } /** - * Get specific AutoFilter Column Attribute + * Get specific AutoFilter Column Attribute. * * @param string $pName Attribute Name + * * @return string */ public function getAttribute($pName) @@ -284,9 +297,10 @@ class Column } /** - * Get all AutoFilter Column Rules + * Get all AutoFilter Column Rules. * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Column\Rule[] */ public function getRules() @@ -295,9 +309,10 @@ class Column } /** - * Get a specified AutoFilter Column Rule + * Get a specified AutoFilter Column Rule. * * @param int $pIndex Rule index in the ruleset array + * * @return Column\Rule */ public function getRule($pIndex) @@ -310,7 +325,7 @@ class Column } /** - * Create a new AutoFilter Column Rule in the ruleset + * Create a new AutoFilter Column Rule in the ruleset. * * @return Column\Rule */ @@ -322,10 +337,11 @@ class Column } /** - * Add a new AutoFilter Column Rule to the ruleset + * Add a new AutoFilter Column Rule to the ruleset. * * @param Column\Rule $pRule * @param bool $returnRule Flag indicating whether the rule object or the column object should be returned + * * @return Column|Column\Rule */ public function addRule(Column\Rule $pRule, $returnRule = true) @@ -338,9 +354,10 @@ class Column /** * Delete a specified AutoFilter Column Rule - * If the number of rules is reduced to 1, then we reset And/Or logic to Or + * If the number of rules is reduced to 1, then we reset And/Or logic to Or. * * @param int $pIndex Rule index in the ruleset array + * * @return Column */ public function deleteRule($pIndex) @@ -357,7 +374,7 @@ class Column } /** - * Delete all AutoFilter Column Rules + * Delete all AutoFilter Column Rules. * * @return Column */ diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php index ea192140..6220a5e1 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -219,42 +220,42 @@ class Rule // const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // for Quarter 2 /** - * Autofilter Column + * Autofilter Column. * * @var \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column */ private $parent = null; /** - * Autofilter Rule Type + * Autofilter Rule Type. * * @var string */ private $ruleType = self::AUTOFILTER_RULETYPE_FILTER; /** - * Autofilter Rule Value + * Autofilter Rule Value. * * @var string */ private $value = ''; /** - * Autofilter Rule Operator + * Autofilter Rule Operator. * * @var string */ private $operator = self::AUTOFILTER_COLUMN_RULE_EQUAL; /** - * DateTimeGrouping Group Value + * DateTimeGrouping Group Value. * * @var string */ private $grouping = ''; /** - * Create a new Rule + * Create a new Rule. * * @param \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column $pParent */ @@ -264,7 +265,7 @@ class Rule } /** - * Get AutoFilter Rule Type + * Get AutoFilter Rule Type. * * @return string */ @@ -274,10 +275,12 @@ class Rule } /** - * Set AutoFilter Rule Type + * Set AutoFilter Rule Type. * * @param string $pRuleType + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Rule */ public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) @@ -292,7 +295,7 @@ class Rule } /** - * Get AutoFilter Rule Value + * Get AutoFilter Rule Value. * * @return string */ @@ -302,10 +305,12 @@ class Rule } /** - * Set AutoFilter Rule Value + * Set AutoFilter Rule Value. * * @param string|string[] $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Rule */ public function setValue($pValue = '') @@ -334,7 +339,7 @@ class Rule } /** - * Get AutoFilter Rule Operator + * Get AutoFilter Rule Operator. * * @return string */ @@ -344,10 +349,12 @@ class Rule } /** - * Set AutoFilter Rule Operator + * Set AutoFilter Rule Operator. * * @param string $pOperator + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Rule */ public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) @@ -365,7 +372,7 @@ class Rule } /** - * Get AutoFilter Rule Grouping + * Get AutoFilter Rule Grouping. * * @return string */ @@ -375,10 +382,12 @@ class Rule } /** - * Set AutoFilter Rule Grouping + * Set AutoFilter Rule Grouping. * * @param string $pGrouping + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Rule */ public function setGrouping($pGrouping = null) @@ -395,12 +404,14 @@ class Rule } /** - * Set AutoFilter Rule + * Set AutoFilter Rule. * * @param string $pOperator * @param string|string[] $pValue * @param string $pGrouping + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Rule */ public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null) @@ -418,7 +429,7 @@ class Rule } /** - * Get this Rule's AutoFilter Column Parent + * Get this Rule's AutoFilter Column Parent. * * @return \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column */ @@ -428,9 +439,10 @@ class Rule } /** - * Set this Rule's AutoFilter Column Parent + * Set this Rule's AutoFilter Column Parent. * * @param \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column + * * @return Rule */ public function setParent(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column $pParent = null) diff --git a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index 8c9077a7..174d7569 100644 --- a/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,104 +20,105 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable { /** - * Image counter + * Image counter. * * @var int */ private static $imageCounter = 0; /** - * Image index + * Image index. * * @var int */ private $imageIndex = 0; /** - * Name + * Name. * * @var string */ protected $name; /** - * Description + * Description. * * @var string */ protected $description; /** - * Worksheet + * Worksheet. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ protected $worksheet; /** - * Coordinates + * Coordinates. * * @var string */ protected $coordinates; /** - * Offset X + * Offset X. * * @var int */ protected $offsetX; /** - * Offset Y + * Offset Y. * * @var int */ protected $offsetY; /** - * Width + * Width. * * @var int */ protected $width; /** - * Height + * Height. * * @var int */ protected $height; /** - * Proportional resize + * Proportional resize. * * @var bool */ protected $resizeProportional; /** - * Rotation + * Rotation. * * @var int */ protected $rotation; /** - * Shadow + * Shadow. * * @var Drawing\Shadow */ protected $shadow; /** - * Create a new BaseDrawing + * Create a new BaseDrawing. */ public function __construct() { @@ -139,7 +140,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get image index + * Get image index. * * @return int */ @@ -149,7 +150,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Name + * Get Name. * * @return string */ @@ -159,9 +160,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Name + * Set Name. * * @param string $pValue + * * @return BaseDrawing */ public function setName($pValue = '') @@ -172,7 +174,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Description + * Get Description. * * @return string */ @@ -182,9 +184,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Description + * Set Description. * * @param string $pValue + * * @return BaseDrawing */ public function setDescription($pValue = '') @@ -195,7 +198,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Worksheet + * Get Worksheet. * * @return \PhpOffice\PhpSpreadsheet\Worksheet */ @@ -205,11 +208,13 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Worksheet + * Set Worksheet. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pValue * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return BaseDrawing */ public function setWorksheet(\PhpOffice\PhpSpreadsheet\Worksheet $pValue = null, $pOverrideOld = false) @@ -243,7 +248,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Coordinates + * Get Coordinates. * * @return string */ @@ -253,9 +258,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Coordinates + * Set Coordinates. * * @param string $pValue + * * @return BaseDrawing */ public function setCoordinates($pValue = 'A1') @@ -266,7 +272,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get OffsetX + * Get OffsetX. * * @return int */ @@ -276,9 +282,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set OffsetX + * Set OffsetX. * * @param int $pValue + * * @return BaseDrawing */ public function setOffsetX($pValue = 0) @@ -289,7 +296,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get OffsetY + * Get OffsetY. * * @return int */ @@ -299,9 +306,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set OffsetY + * Set OffsetY. * * @param int $pValue + * * @return BaseDrawing */ public function setOffsetY($pValue = 0) @@ -312,7 +320,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Width + * Get Width. * * @return int */ @@ -322,9 +330,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Width + * Set Width. * * @param int $pValue + * * @return BaseDrawing */ public function setWidth($pValue = 0) @@ -342,7 +351,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Height + * Get Height. * * @return int */ @@ -352,9 +361,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Height + * Set Height. * * @param int $pValue + * * @return BaseDrawing */ public function setHeight($pValue = 0) @@ -377,11 +387,13 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable * * $objDrawing->setResizeProportional(true); * $objDrawing->setWidthAndHeight(160,120); - * + * . * * @author Vincent@luo MSN:kele_100@hotmail.com + * * @param int $width * @param int $height + * * @return BaseDrawing */ public function setWidthAndHeight($width = 0, $height = 0) @@ -405,7 +417,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get ResizeProportional + * Get ResizeProportional. * * @return bool */ @@ -415,9 +427,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set ResizeProportional + * Set ResizeProportional. * * @param bool $pValue + * * @return BaseDrawing */ public function setResizeProportional($pValue = true) @@ -428,7 +441,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Rotation + * Get Rotation. * * @return int */ @@ -438,9 +451,10 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Rotation + * Set Rotation. * * @param int $pValue + * * @return BaseDrawing */ public function setRotation($pValue = 0) @@ -451,7 +465,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Shadow + * Get Shadow. * * @return Drawing\Shadow */ @@ -461,10 +475,12 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Shadow + * Set Shadow. * * @param Drawing\Shadow $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return BaseDrawing */ public function setShadow(Drawing\Shadow $pValue = null) @@ -475,7 +491,7 @@ class BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Worksheet/CellIterator.php b/src/PhpSpreadsheet/Worksheet/CellIterator.php index e9d365c9..8f914693 100644 --- a/src/PhpSpreadsheet/Worksheet/CellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/CellIterator.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,34 +20,35 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ abstract class CellIterator { /** - * \PhpOffice\PhpSpreadsheet\Worksheet to iterate + * \PhpOffice\PhpSpreadsheet\Worksheet to iterate. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ protected $subject; /** - * Current iterator position + * Current iterator position. * * @var mixed */ protected $position = null; /** - * Iterate only existing cells + * Iterate only existing cells. * * @var bool */ protected $onlyExistingCells = false; /** - * Destructor + * Destructor. */ public function __destruct() { @@ -55,7 +56,7 @@ abstract class CellIterator } /** - * Get loop only existing cells + * Get loop only existing cells. * * @return bool */ @@ -65,21 +66,22 @@ abstract class CellIterator } /** - * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary + * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ abstract protected function adjustForExistingOnlyRange(); /** - * Set the iterator to loop only existing cells + * Set the iterator to loop only existing cells. * * @param bool $value + * * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function setIterateOnlyExistingCells($value = true) { - $this->onlyExistingCells = (boolean) $value; + $this->onlyExistingCells = (bool) $value; $this->adjustForExistingOnlyRange(); } diff --git a/src/PhpSpreadsheet/Worksheet/Column.php b/src/PhpSpreadsheet/Worksheet/Column.php index 4ccb9d24..429a3e3e 100644 --- a/src/PhpSpreadsheet/Worksheet/Column.php +++ b/src/PhpSpreadsheet/Worksheet/Column.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Column { /** - * \PhpOffice\PhpSpreadsheet\Worksheet + * \PhpOffice\PhpSpreadsheet\Worksheet. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ private $parent; /** - * Column index + * Column index. * * @var string */ private $columnIndex; /** - * Create a new column + * Create a new column. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent * @param string $columnIndex @@ -53,7 +54,7 @@ class Column } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -61,7 +62,7 @@ class Column } /** - * Get column index + * Get column index. * * @return string */ @@ -71,10 +72,11 @@ class Column } /** - * Get cell iterator + * Get cell iterator. * * @param int $startRow The row number at which to start iterating * @param int $endRow Optionally, the row number at which to stop iterating + * * @return ColumnCellIterator */ public function getCellIterator($startRow = 1, $endRow = null) diff --git a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php index 3db702ac..a7a0239a 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,34 +20,35 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class ColumnCellIterator extends CellIterator implements \Iterator { /** - * Column index + * Column index. * * @var string */ protected $columnIndex; /** - * Start position + * Start position. * * @var int */ protected $startRow = 1; /** - * End position + * End position. * * @var int */ protected $endRow = 1; /** - * Create a new row iterator + * Create a new row iterator. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $subject The worksheet to iterate over * @param string $columnIndex The column that we want to iterate @@ -64,7 +65,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -72,10 +73,12 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * (Re)Set the start row and the current row pointer + * (Re)Set the start row and the current row pointer. * * @param int $startRow The row number at which to start iterating + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return ColumnCellIterator */ public function resetStart($startRow = 1) @@ -88,10 +91,12 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * (Re)Set the end row + * (Re)Set the end row. * * @param int $endRow The row number at which to stop iterating + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return ColumnCellIterator */ public function resetEnd($endRow = null) @@ -103,10 +108,12 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Set the row pointer to the selected row + * Set the row pointer to the selected row. * * @param int $row The row number to set the current pointer at + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return ColumnCellIterator */ public function seek($row = 1) @@ -122,7 +129,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Rewind the iterator to the starting row + * Rewind the iterator to the starting row. */ public function rewind() { @@ -130,7 +137,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Return the current cell in this worksheet column + * Return the current cell in this worksheet column. * * @return null|\PhpOffice\PhpSpreadsheet\Cell */ @@ -140,7 +147,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Return the current iterator key + * Return the current iterator key. * * @return int */ @@ -150,7 +157,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Set the iterator to its next value + * Set the iterator to its next value. */ public function next() { @@ -162,7 +169,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Set the iterator to its previous value + * Set the iterator to its previous value. */ public function prev() { @@ -178,7 +185,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Indicate if more rows exist in the worksheet range of rows that we're iterating + * Indicate if more rows exist in the worksheet range of rows that we're iterating. * * @return bool */ @@ -188,7 +195,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator } /** - * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary + * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ diff --git a/src/PhpSpreadsheet/Worksheet/ColumnDimension.php b/src/PhpSpreadsheet/Worksheet/ColumnDimension.php index c07682d1..472684c5 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnDimension.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnDimension.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class ColumnDimension extends Dimension { /** - * Column index + * Column index. * * @var string */ private $columnIndex; /** - * Column width + * Column width. * * When this is set to a negative value, the column width should be ignored by IWriter * @@ -49,7 +50,7 @@ class ColumnDimension extends Dimension private $autoSize = false; /** - * Create a new ColumnDimension + * Create a new ColumnDimension. * * @param string $pIndex Character column index */ @@ -63,7 +64,7 @@ class ColumnDimension extends Dimension } /** - * Get ColumnIndex + * Get ColumnIndex. * * @return string */ @@ -73,9 +74,10 @@ class ColumnDimension extends Dimension } /** - * Set ColumnIndex + * Set ColumnIndex. * * @param string $pValue + * * @return ColumnDimension */ public function setColumnIndex($pValue) @@ -86,7 +88,7 @@ class ColumnDimension extends Dimension } /** - * Get Width + * Get Width. * * @return float */ @@ -96,9 +98,10 @@ class ColumnDimension extends Dimension } /** - * Set Width + * Set Width. * * @param float $pValue + * * @return ColumnDimension */ public function setWidth($pValue = -1) @@ -109,7 +112,7 @@ class ColumnDimension extends Dimension } /** - * Get Auto Size + * Get Auto Size. * * @return bool */ @@ -119,9 +122,10 @@ class ColumnDimension extends Dimension } /** - * Set Auto Size + * Set Auto Size. * * @param bool $pValue + * * @return ColumnDimension */ public function setAutoSize($pValue = false) diff --git a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php index f73883bb..2814add7 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php @@ -6,7 +6,7 @@ use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Exception; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,41 +23,42 @@ use PhpOffice\PhpSpreadsheet\Exception; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class ColumnIterator implements \Iterator { /** - * \PhpOffice\PhpSpreadsheet\Worksheet to iterate + * \PhpOffice\PhpSpreadsheet\Worksheet to iterate. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ private $subject; /** - * Current iterator position + * Current iterator position. * * @var int */ private $position = 0; /** - * Start position + * Start position. * * @var int */ private $startColumn = 0; /** - * End position + * End position. * * @var int */ private $endColumn = 0; /** - * Create a new column iterator + * Create a new column iterator. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $subject The worksheet to iterate over * @param string $startColumn The column address at which to start iterating @@ -72,7 +73,7 @@ class ColumnIterator implements \Iterator } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -80,10 +81,12 @@ class ColumnIterator implements \Iterator } /** - * (Re)Set the start column and the current column pointer + * (Re)Set the start column and the current column pointer. * * @param int $startColumn The column address at which to start iterating + * * @throws Exception + * * @return ColumnIterator */ public function resetStart($startColumn = 'A') @@ -103,9 +106,10 @@ class ColumnIterator implements \Iterator } /** - * (Re)Set the end column + * (Re)Set the end column. * * @param string $endColumn The column address at which to stop iterating + * * @return ColumnIterator */ public function resetEnd($endColumn = null) @@ -117,10 +121,12 @@ class ColumnIterator implements \Iterator } /** - * Set the column pointer to the selected column + * Set the column pointer to the selected column. * * @param string $column The column address to set the current pointer at + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return ColumnIterator */ public function seek($column = 'A') @@ -135,7 +141,7 @@ class ColumnIterator implements \Iterator } /** - * Rewind the iterator to the starting column + * Rewind the iterator to the starting column. */ public function rewind() { @@ -143,7 +149,7 @@ class ColumnIterator implements \Iterator } /** - * Return the current column in this worksheet + * Return the current column in this worksheet. * * @return Column */ @@ -153,7 +159,7 @@ class ColumnIterator implements \Iterator } /** - * Return the current iterator key + * Return the current iterator key. * * @return string */ @@ -163,7 +169,7 @@ class ColumnIterator implements \Iterator } /** - * Set the iterator to its next value + * Set the iterator to its next value. */ public function next() { @@ -171,7 +177,7 @@ class ColumnIterator implements \Iterator } /** - * Set the iterator to its previous value + * Set the iterator to its previous value. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -189,7 +195,7 @@ class ColumnIterator implements \Iterator } /** - * Indicate if more columns exist in the worksheet range of columns that we're iterating + * Indicate if more columns exist in the worksheet range of columns that we're iterating. * * @return bool */ diff --git a/src/PhpSpreadsheet/Worksheet/Dimension.php b/src/PhpSpreadsheet/Worksheet/Dimension.php index 782a4d65..da06a66c 100644 --- a/src/PhpSpreadsheet/Worksheet/Dimension.php +++ b/src/PhpSpreadsheet/Worksheet/Dimension.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -33,14 +34,14 @@ abstract class Dimension private $visible = true; /** - * Outline level + * Outline level. * * @var int */ private $outlineLevel = 0; /** - * Collapsed + * Collapsed. * * @var bool */ @@ -54,7 +55,7 @@ abstract class Dimension private $xfIndex; /** - * Create a new Dimension + * Create a new Dimension. * * @param int $initialValue Numeric row index */ @@ -65,7 +66,7 @@ abstract class Dimension } /** - * Get Visible + * Get Visible. * * @return bool */ @@ -75,9 +76,10 @@ abstract class Dimension } /** - * Set Visible + * Set Visible. * * @param bool $pValue + * * @return Dimension */ public function setVisible($pValue = true) @@ -88,7 +90,7 @@ abstract class Dimension } /** - * Get Outline Level + * Get Outline Level. * * @return int */ @@ -98,12 +100,14 @@ abstract class Dimension } /** - * Set Outline Level + * Set Outline Level. * * Value must be between 0 and 7 * * @param int $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Dimension */ public function setOutlineLevel($pValue) @@ -118,7 +122,7 @@ abstract class Dimension } /** - * Get Collapsed + * Get Collapsed. * * @return bool */ @@ -128,9 +132,10 @@ abstract class Dimension } /** - * Set Collapsed + * Set Collapsed. * * @param bool $pValue + * * @return Dimension */ public function setCollapsed($pValue = true) @@ -141,7 +146,7 @@ abstract class Dimension } /** - * Get index to cellXf + * Get index to cellXf. * * @return int */ @@ -151,9 +156,10 @@ abstract class Dimension } /** - * Set index to cellXf + * Set index to cellXf. * * @param int $pValue + * * @return Dimension */ public function setXfIndex($pValue = 0) diff --git a/src/PhpSpreadsheet/Worksheet/Drawing.php b/src/PhpSpreadsheet/Worksheet/Drawing.php index 4041e7f9..0c2bfe29 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparable { /** - * Path + * Path. * * @var string */ private $path; /** - * Create a new Drawing + * Create a new Drawing. */ public function __construct() { @@ -45,7 +46,7 @@ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparab } /** - * Get Filename + * Get Filename. * * @return string */ @@ -55,7 +56,7 @@ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparab } /** - * Get indexed filename (using image index) + * Get indexed filename (using image index). * * @return string */ @@ -68,7 +69,7 @@ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparab } /** - * Get Extension + * Get Extension. * * @return string */ @@ -80,7 +81,7 @@ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparab } /** - * Get Path + * Get Path. * * @return string */ @@ -90,11 +91,13 @@ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparab } /** - * Set Path + * Set Path. * * @param string $pValue File path * @param bool $pVerifyFile Verify file + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Drawing */ public function setPath($pValue = '', $pVerifyFile = true) @@ -118,7 +121,7 @@ class Drawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\IComparab } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php index 8d7321af..38c6878e 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet\Drawing; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet\Drawing; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -36,14 +37,14 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable const SHADOW_TOP_RIGHT = 'tr'; /** - * Visible + * Visible. * * @var bool */ private $visible; /** - * Blur radius + * Blur radius. * * Defaults to 6 * @@ -52,7 +53,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable private $blurRadius; /** - * Shadow distance + * Shadow distance. * * Defaults to 2 * @@ -61,35 +62,35 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable private $distance; /** - * Shadow direction (in degrees) + * Shadow direction (in degrees). * * @var int */ private $direction; /** - * Shadow alignment + * Shadow alignment. * * @var int */ private $alignment; /** - * Color + * Color. * * @var \PhpOffice\PhpSpreadsheet\Style\Color */ private $color; /** - * Alpha + * Alpha. * * @var int */ private $alpha; /** - * Create a new Shadow + * Create a new Shadow. */ public function __construct() { @@ -104,7 +105,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Visible + * Get Visible. * * @return bool */ @@ -114,9 +115,10 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Visible + * Set Visible. * * @param bool $pValue + * * @return Shadow */ public function setVisible($pValue = false) @@ -127,7 +129,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Blur radius + * Get Blur radius. * * @return int */ @@ -137,9 +139,10 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Blur radius + * Set Blur radius. * * @param int $pValue + * * @return Shadow */ public function setBlurRadius($pValue = 6) @@ -150,7 +153,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Shadow distance + * Get Shadow distance. * * @return int */ @@ -160,9 +163,10 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Shadow distance + * Set Shadow distance. * * @param int $pValue + * * @return Shadow */ public function setDistance($pValue = 2) @@ -173,7 +177,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Shadow direction (in degrees) + * Get Shadow direction (in degrees). * * @return int */ @@ -183,9 +187,10 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Shadow direction (in degrees) + * Set Shadow direction (in degrees). * * @param int $pValue + * * @return Shadow */ public function setDirection($pValue = 0) @@ -196,7 +201,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Shadow alignment + * Get Shadow alignment. * * @return int */ @@ -206,9 +211,10 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Shadow alignment + * Set Shadow alignment. * * @param int $pValue + * * @return Shadow */ public function setAlignment($pValue = 0) @@ -219,7 +225,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Color + * Get Color. * * @return \PhpOffice\PhpSpreadsheet\Style\Color */ @@ -229,10 +235,12 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Color + * Set Color. * * @param \PhpOffice\PhpSpreadsheet\Style\Color $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Shadow */ public function setColor(\PhpOffice\PhpSpreadsheet\Style\Color $pValue = null) @@ -243,7 +251,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get Alpha + * Get Alpha. * * @return int */ @@ -253,9 +261,10 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Set Alpha + * Set Alpha. * * @param int $pValue + * * @return Shadow */ public function setAlpha($pValue = 0) @@ -266,7 +275,7 @@ class Shadow implements \PhpOffice\PhpSpreadsheet\IComparable } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Worksheet/HeaderFooter.php b/src/PhpSpreadsheet/Worksheet/HeaderFooter.php index 64996390..b8ad3ccf 100644 --- a/src/PhpSpreadsheet/Worksheet/HeaderFooter.php +++ b/src/PhpSpreadsheet/Worksheet/HeaderFooter.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @@ -94,91 +95,91 @@ class HeaderFooter const IMAGE_FOOTER_RIGHT = 'RF'; /** - * OddHeader + * OddHeader. * * @var string */ private $oddHeader = ''; /** - * OddFooter + * OddFooter. * * @var string */ private $oddFooter = ''; /** - * EvenHeader + * EvenHeader. * * @var string */ private $evenHeader = ''; /** - * EvenFooter + * EvenFooter. * * @var string */ private $evenFooter = ''; /** - * FirstHeader + * FirstHeader. * * @var string */ private $firstHeader = ''; /** - * FirstFooter + * FirstFooter. * * @var string */ private $firstFooter = ''; /** - * Different header for Odd/Even, defaults to false + * Different header for Odd/Even, defaults to false. * * @var bool */ private $differentOddEven = false; /** - * Different header for first page, defaults to false + * Different header for first page, defaults to false. * * @var bool */ private $differentFirst = false; /** - * Scale with document, defaults to true + * Scale with document, defaults to true. * * @var bool */ private $scaleWithDocument = true; /** - * Align with margins, defaults to true + * Align with margins, defaults to true. * * @var bool */ private $alignWithMargins = true; /** - * Header/footer images + * Header/footer images. * * @var HeaderFooterDrawing[] */ private $headerFooterImages = []; /** - * Create a new HeaderFooter + * Create a new HeaderFooter. */ public function __construct() { } /** - * Get OddHeader + * Get OddHeader. * * @return string */ @@ -188,9 +189,10 @@ class HeaderFooter } /** - * Set OddHeader + * Set OddHeader. * * @param string $pValue + * * @return HeaderFooter */ public function setOddHeader($pValue) @@ -201,7 +203,7 @@ class HeaderFooter } /** - * Get OddFooter + * Get OddFooter. * * @return string */ @@ -211,9 +213,10 @@ class HeaderFooter } /** - * Set OddFooter + * Set OddFooter. * * @param string $pValue + * * @return HeaderFooter */ public function setOddFooter($pValue) @@ -224,7 +227,7 @@ class HeaderFooter } /** - * Get EvenHeader + * Get EvenHeader. * * @return string */ @@ -234,9 +237,10 @@ class HeaderFooter } /** - * Set EvenHeader + * Set EvenHeader. * * @param string $pValue + * * @return HeaderFooter */ public function setEvenHeader($pValue) @@ -247,7 +251,7 @@ class HeaderFooter } /** - * Get EvenFooter + * Get EvenFooter. * * @return string */ @@ -257,9 +261,10 @@ class HeaderFooter } /** - * Set EvenFooter + * Set EvenFooter. * * @param string $pValue + * * @return HeaderFooter */ public function setEvenFooter($pValue) @@ -270,7 +275,7 @@ class HeaderFooter } /** - * Get FirstHeader + * Get FirstHeader. * * @return string */ @@ -280,9 +285,10 @@ class HeaderFooter } /** - * Set FirstHeader + * Set FirstHeader. * * @param string $pValue + * * @return HeaderFooter */ public function setFirstHeader($pValue) @@ -293,7 +299,7 @@ class HeaderFooter } /** - * Get FirstFooter + * Get FirstFooter. * * @return string */ @@ -303,9 +309,10 @@ class HeaderFooter } /** - * Set FirstFooter + * Set FirstFooter. * * @param string $pValue + * * @return HeaderFooter */ public function setFirstFooter($pValue) @@ -316,7 +323,7 @@ class HeaderFooter } /** - * Get DifferentOddEven + * Get DifferentOddEven. * * @return bool */ @@ -326,9 +333,10 @@ class HeaderFooter } /** - * Set DifferentOddEven + * Set DifferentOddEven. * * @param bool $pValue + * * @return HeaderFooter */ public function setDifferentOddEven($pValue = false) @@ -339,7 +347,7 @@ class HeaderFooter } /** - * Get DifferentFirst + * Get DifferentFirst. * * @return bool */ @@ -349,9 +357,10 @@ class HeaderFooter } /** - * Set DifferentFirst + * Set DifferentFirst. * * @param bool $pValue + * * @return HeaderFooter */ public function setDifferentFirst($pValue = false) @@ -362,7 +371,7 @@ class HeaderFooter } /** - * Get ScaleWithDocument + * Get ScaleWithDocument. * * @return bool */ @@ -372,9 +381,10 @@ class HeaderFooter } /** - * Set ScaleWithDocument + * Set ScaleWithDocument. * * @param bool $pValue + * * @return HeaderFooter */ public function setScaleWithDocument($pValue = true) @@ -385,7 +395,7 @@ class HeaderFooter } /** - * Get AlignWithMargins + * Get AlignWithMargins. * * @return bool */ @@ -395,9 +405,10 @@ class HeaderFooter } /** - * Set AlignWithMargins + * Set AlignWithMargins. * * @param bool $pValue + * * @return HeaderFooter */ public function setAlignWithMargins($pValue = true) @@ -408,11 +419,13 @@ class HeaderFooter } /** - * Add header/footer image + * Add header/footer image. * * @param HeaderFooterDrawing $image * @param string $location + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return HeaderFooter */ public function addImage(HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) @@ -423,10 +436,12 @@ class HeaderFooter } /** - * Remove header/footer image + * Remove header/footer image. * * @param string $location + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return HeaderFooter */ public function removeImage($location = self::IMAGE_HEADER_LEFT) @@ -439,10 +454,12 @@ class HeaderFooter } /** - * Set header/footer images + * Set header/footer images. * * @param HeaderFooterDrawing[] $images + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return HeaderFooter */ public function setImages($images) @@ -457,7 +474,7 @@ class HeaderFooter } /** - * Get header/footer images + * Get header/footer images. * * @return HeaderFooterDrawing[] */ diff --git a/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php b/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php index 2dc8814c..c684b90e 100644 --- a/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,62 +20,63 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\IComparable { /** - * Path + * Path. * * @var string */ private $path; /** - * Name + * Name. * * @var string */ protected $name; /** - * Offset X + * Offset X. * * @var int */ protected $offsetX; /** - * Offset Y + * Offset Y. * * @var int */ protected $offsetY; /** - * Width + * Width. * * @var int */ protected $width; /** - * Height + * Height. * * @var int */ protected $height; /** - * Proportional resize + * Proportional resize. * * @var bool */ protected $resizeProportional; /** - * Create a new HeaderFooterDrawing + * Create a new HeaderFooterDrawing. */ public function __construct() { @@ -90,7 +91,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get Name + * Get Name. * * @return string */ @@ -100,9 +101,10 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set Name + * Set Name. * * @param string $pValue + * * @return HeaderFooterDrawing */ public function setName($pValue = '') @@ -113,7 +115,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get OffsetX + * Get OffsetX. * * @return int */ @@ -123,9 +125,10 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set OffsetX + * Set OffsetX. * * @param int $pValue + * * @return HeaderFooterDrawing */ public function setOffsetX($pValue = 0) @@ -136,7 +139,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get OffsetY + * Get OffsetY. * * @return int */ @@ -146,9 +149,10 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set OffsetY + * Set OffsetY. * * @param int $pValue + * * @return HeaderFooterDrawing */ public function setOffsetY($pValue = 0) @@ -159,7 +163,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get Width + * Get Width. * * @return int */ @@ -169,9 +173,10 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set Width + * Set Width. * * @param int $pValue + * * @return HeaderFooterDrawing */ public function setWidth($pValue = 0) @@ -189,7 +194,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get Height + * Get Height. * * @return int */ @@ -199,9 +204,10 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set Height + * Set Height. * * @param int $pValue + * * @return HeaderFooterDrawing */ public function setHeight($pValue = 0) @@ -224,11 +230,13 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I * * $objDrawing->setResizeProportional(true); * $objDrawing->setWidthAndHeight(160,120); - * + * . * * @author Vincent@luo MSN:kele_100@hotmail.com + * * @param int $width * @param int $height + * * @return HeaderFooterDrawing */ public function setWidthAndHeight($width = 0, $height = 0) @@ -249,7 +257,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get ResizeProportional + * Get ResizeProportional. * * @return bool */ @@ -259,9 +267,10 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set ResizeProportional + * Set ResizeProportional. * * @param bool $pValue + * * @return HeaderFooterDrawing */ public function setResizeProportional($pValue = true) @@ -272,7 +281,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get Filename + * Get Filename. * * @return string */ @@ -282,7 +291,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get Extension + * Get Extension. * * @return string */ @@ -294,7 +303,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get Path + * Get Path. * * @return string */ @@ -304,11 +313,13 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Set Path + * Set Path. * * @param string $pValue File path * @param bool $pVerifyFile Verify file + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return HeaderFooterDrawing */ public function setPath($pValue = '', $pVerifyFile = true) @@ -332,7 +343,7 @@ class HeaderFooterDrawing extends Drawing implements \PhpOffice\PhpSpreadsheet\I } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Worksheet/Iterator.php b/src/PhpSpreadsheet/Worksheet/Iterator.php index bc620986..03fe44f8 100644 --- a/src/PhpSpreadsheet/Worksheet/Iterator.php +++ b/src/PhpSpreadsheet/Worksheet/Iterator.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Iterator implements \Iterator { /** - * Spreadsheet to iterate + * Spreadsheet to iterate. * * @var \PhpOffice\PhpSpreadsheet\Spreadsheet */ private $subject; /** - * Current iterator position + * Current iterator position. * * @var int */ private $position = 0; /** - * Create a new worksheet iterator + * Create a new worksheet iterator. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $subject */ @@ -51,7 +52,7 @@ class Iterator implements \Iterator } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -59,7 +60,7 @@ class Iterator implements \Iterator } /** - * Rewind iterator + * Rewind iterator. */ public function rewind() { @@ -67,7 +68,7 @@ class Iterator implements \Iterator } /** - * Current Worksheet + * Current Worksheet. * * @return \PhpOffice\PhpSpreadsheet\Worksheet */ @@ -77,7 +78,7 @@ class Iterator implements \Iterator } /** - * Current key + * Current key. * * @return int */ @@ -87,7 +88,7 @@ class Iterator implements \Iterator } /** - * Next value + * Next value. */ public function next() { diff --git a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php index 6f8aff74..5267d72c 100644 --- a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -38,35 +39,35 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo const MIMETYPE_JPEG = 'image/jpeg'; /** - * Image resource + * Image resource. * * @var resource */ private $imageResource; /** - * Rendering function + * Rendering function. * * @var string */ private $renderingFunction; /** - * Mime type + * Mime type. * * @var string */ private $mimeType; /** - * Unique name + * Unique name. * * @var string */ private $uniqueName; /** - * Create a new MemoryDrawing + * Create a new MemoryDrawing. */ public function __construct() { @@ -81,7 +82,7 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Get image resource + * Get image resource. * * @return resource */ @@ -91,9 +92,10 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Set image resource + * Set image resource. * * @param $value resource + * * @return MemoryDrawing */ public function setImageResource($value = null) @@ -110,7 +112,7 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Get rendering function + * Get rendering function. * * @return string */ @@ -120,9 +122,10 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Set rendering function + * Set rendering function. * * @param string $value + * * @return MemoryDrawing */ public function setRenderingFunction($value = self::RENDERING_DEFAULT) @@ -133,7 +136,7 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Get mime type + * Get mime type. * * @return string */ @@ -143,9 +146,10 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Set mime type + * Set mime type. * * @param string $value + * * @return MemoryDrawing */ public function setMimeType($value = self::MIMETYPE_DEFAULT) @@ -156,7 +160,7 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Get indexed filename (using image index) + * Get indexed filename (using image index). * * @return string */ @@ -170,7 +174,7 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo } /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpSpreadsheet/Worksheet/PageMargins.php b/src/PhpSpreadsheet/Worksheet/PageMargins.php index ae90c065..9aa51665 100644 --- a/src/PhpSpreadsheet/Worksheet/PageMargins.php +++ b/src/PhpSpreadsheet/Worksheet/PageMargins.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,62 +20,63 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class PageMargins { /** - * Left + * Left. * * @var float */ private $left = 0.7; /** - * Right + * Right. * * @var float */ private $right = 0.7; /** - * Top + * Top. * * @var float */ private $top = 0.75; /** - * Bottom + * Bottom. * * @var float */ private $bottom = 0.75; /** - * Header + * Header. * * @var float */ private $header = 0.3; /** - * Footer + * Footer. * * @var float */ private $footer = 0.3; /** - * Create a new PageMargins + * Create a new PageMargins. */ public function __construct() { } /** - * Get Left + * Get Left. * * @return float */ @@ -85,9 +86,10 @@ class PageMargins } /** - * Set Left + * Set Left. * * @param float $pValue + * * @return PageMargins */ public function setLeft($pValue) @@ -98,7 +100,7 @@ class PageMargins } /** - * Get Right + * Get Right. * * @return float */ @@ -108,9 +110,10 @@ class PageMargins } /** - * Set Right + * Set Right. * * @param float $pValue + * * @return PageMargins */ public function setRight($pValue) @@ -121,7 +124,7 @@ class PageMargins } /** - * Get Top + * Get Top. * * @return float */ @@ -131,9 +134,10 @@ class PageMargins } /** - * Set Top + * Set Top. * * @param float $pValue + * * @return PageMargins */ public function setTop($pValue) @@ -144,7 +148,7 @@ class PageMargins } /** - * Get Bottom + * Get Bottom. * * @return float */ @@ -154,9 +158,10 @@ class PageMargins } /** - * Set Bottom + * Set Bottom. * * @param float $pValue + * * @return PageMargins */ public function setBottom($pValue) @@ -167,7 +172,7 @@ class PageMargins } /** - * Get Header + * Get Header. * * @return float */ @@ -177,9 +182,10 @@ class PageMargins } /** - * Set Header + * Set Header. * * @param float $pValue + * * @return PageMargins */ public function setHeader($pValue) @@ -190,7 +196,7 @@ class PageMargins } /** - * Get Footer + * Get Footer. * * @return float */ @@ -200,9 +206,10 @@ class PageMargins } /** - * Set Footer + * Set Footer. * * @param float $pValue + * * @return PageMargins */ public function setFooter($pValue) diff --git a/src/PhpSpreadsheet/Worksheet/PageSetup.php b/src/PhpSpreadsheet/Worksheet/PageSetup.php index 21cb2c47..6503afde 100644 --- a/src/PhpSpreadsheet/Worksheet/PageSetup.php +++ b/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @@ -95,6 +96,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) */ class PageSetup @@ -177,21 +179,21 @@ class PageSetup const SETPRINTRANGE_INSERT = 'I'; /** - * Paper size + * Paper size. * * @var int */ private $paperSize = self::PAPERSIZE_LETTER; /** - * Orientation + * Orientation. * * @var string */ private $orientation = self::ORIENTATION_DEFAULT; /** - * Scale (Print Scale) + * Scale (Print Scale). * * Print scaling. Valid values range from 10 to 400 * This setting is overridden when fitToWidth and/or fitToHeight are in use @@ -202,7 +204,7 @@ class PageSetup /** * Fit To Page - * Whether scale or fitToWith / fitToHeight applies + * Whether scale or fitToWith / fitToHeight applies. * * @var bool */ @@ -210,7 +212,7 @@ class PageSetup /** * Fit To Height - * Number of vertical pages to fit on + * Number of vertical pages to fit on. * * @var int? */ @@ -218,63 +220,63 @@ class PageSetup /** * Fit To Width - * Number of horizontal pages to fit on + * Number of horizontal pages to fit on. * * @var int? */ private $fitToWidth = 1; /** - * Columns to repeat at left + * Columns to repeat at left. * * @var array Containing start column and end column, empty array if option unset */ private $columnsToRepeatAtLeft = ['', '']; /** - * Rows to repeat at top + * Rows to repeat at top. * * @var array Containing start row number and end row number, empty array if option unset */ private $rowsToRepeatAtTop = [0, 0]; /** - * Center page horizontally + * Center page horizontally. * * @var bool */ private $horizontalCentered = false; /** - * Center page vertically + * Center page vertically. * * @var bool */ private $verticalCentered = false; /** - * Print area + * Print area. * * @var string */ private $printArea = null; /** - * First page number + * First page number. * * @var int */ private $firstPageNumber = null; /** - * Create a new PageSetup + * Create a new PageSetup. */ public function __construct() { } /** - * Get Paper Size + * Get Paper Size. * * @return int */ @@ -284,9 +286,10 @@ class PageSetup } /** - * Set Paper Size + * Set Paper Size. * * @param int $pValue + * * @return PageSetup */ public function setPaperSize($pValue = self::PAPERSIZE_LETTER) @@ -297,7 +300,7 @@ class PageSetup } /** - * Get Orientation + * Get Orientation. * * @return string */ @@ -307,9 +310,10 @@ class PageSetup } /** - * Set Orientation + * Set Orientation. * * @param string $pValue + * * @return PageSetup */ public function setOrientation($pValue = self::ORIENTATION_DEFAULT) @@ -320,7 +324,7 @@ class PageSetup } /** - * Get Scale + * Get Scale. * * @return int? */ @@ -330,14 +334,16 @@ class PageSetup } /** - * Set Scale + * Set Scale. * * Print scaling. Valid values range from 10 to 400 * This setting is overridden when fitToWidth and/or fitToHeight are in use * * @param int? $pValue * @param bool $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return PageSetup */ public function setScale($pValue = 100, $pUpdate = true) @@ -357,7 +363,7 @@ class PageSetup } /** - * Get Fit To Page + * Get Fit To Page. * * @return bool */ @@ -367,9 +373,10 @@ class PageSetup } /** - * Set Fit To Page + * Set Fit To Page. * * @param bool $pValue + * * @return PageSetup */ public function setFitToPage($pValue = true) @@ -380,7 +387,7 @@ class PageSetup } /** - * Get Fit To Height + * Get Fit To Height. * * @return int? */ @@ -390,10 +397,11 @@ class PageSetup } /** - * Set Fit To Height + * Set Fit To Height. * * @param int? $pValue * @param bool $pUpdate Update fitToPage so it applies rather than scaling + * * @return PageSetup */ public function setFitToHeight($pValue = 1, $pUpdate = true) @@ -407,7 +415,7 @@ class PageSetup } /** - * Get Fit To Width + * Get Fit To Width. * * @return int? */ @@ -417,10 +425,11 @@ class PageSetup } /** - * Set Fit To Width + * Set Fit To Width. * * @param int? $pValue * @param bool $pUpdate Update fitToPage so it applies rather than scaling + * * @return PageSetup */ public function setFitToWidth($pValue = 1, $pUpdate = true) @@ -450,7 +459,7 @@ class PageSetup } /** - * Get Columns to repeat at left + * Get Columns to repeat at left. * * @return array Containing start column and end column, empty array if option unset */ @@ -460,9 +469,10 @@ class PageSetup } /** - * Set Columns to repeat at left + * Set Columns to repeat at left. * * @param array $pValue Containing start column and end column, empty array if option unset + * * @return PageSetup */ public function setColumnsToRepeatAtLeft($pValue = null) @@ -475,10 +485,11 @@ class PageSetup } /** - * Set Columns to repeat at left by start and end + * Set Columns to repeat at left by start and end. * * @param string $pStart * @param string $pEnd + * * @return PageSetup */ public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') @@ -505,7 +516,7 @@ class PageSetup } /** - * Get Rows to repeat at top + * Get Rows to repeat at top. * * @return array Containing start column and end column, empty array if option unset */ @@ -515,9 +526,10 @@ class PageSetup } /** - * Set Rows to repeat at top + * Set Rows to repeat at top. * * @param array $pValue Containing start column and end column, empty array if option unset + * * @return PageSetup */ public function setRowsToRepeatAtTop($pValue = null) @@ -530,10 +542,11 @@ class PageSetup } /** - * Set Rows to repeat at top by start and end + * Set Rows to repeat at top by start and end. * * @param int $pStart * @param int $pEnd + * * @return PageSetup */ public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) @@ -544,7 +557,7 @@ class PageSetup } /** - * Get center page horizontally + * Get center page horizontally. * * @return bool */ @@ -554,9 +567,10 @@ class PageSetup } /** - * Set center page horizontally + * Set center page horizontally. * * @param bool $value + * * @return PageSetup */ public function setHorizontalCentered($value = false) @@ -567,7 +581,7 @@ class PageSetup } /** - * Get center page vertically + * Get center page vertically. * * @return bool */ @@ -577,9 +591,10 @@ class PageSetup } /** - * Set center page vertically + * Set center page vertically. * * @param bool $value + * * @return PageSetup */ public function setVerticalCentered($value = false) @@ -590,13 +605,15 @@ class PageSetup } /** - * Get print area + * Get print area. * * @param int $index Identifier for a specific print area range if several ranges have been set * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string * Otherwise, the specific range identified by the value of $index will be returned * Print areas are numbered from 1 + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return string */ public function getPrintArea($index = 0) @@ -618,6 +635,7 @@ class PageSetup * Default behaviour, or an index value of 0, will identify whether any print range is set * Otherwise, existence of the range identified by the value of $index will be returned * Print areas are numbered from 1 + * * @return bool */ public function isPrintAreaSet($index = 0) @@ -631,12 +649,13 @@ class PageSetup } /** - * Clear a print area + * Clear a print area. * * @param int $index Identifier for a specific print area range if several ranges have been set * Default behaviour, or an index value of 0, will clear all print ranges that are set * Otherwise, the range identified by the value of $index will be removed from the series * Print areas are numbered from 1 + * * @return PageSetup */ public function clearPrintArea($index = 0) @@ -655,7 +674,7 @@ class PageSetup } /** - * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20' + * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'. * * @param string $value * @param int $index Identifier for a specific print area range allowing several ranges to be set @@ -671,7 +690,9 @@ class PageSetup * @param string $method Determines the method used when setting multiple print areas * Default behaviour, or the "O" method, overwrites existing print area * The "I" method, inserts the new print area before any specified index, or at the end of the list + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return PageSetup */ public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) @@ -721,7 +742,7 @@ class PageSetup } /** - * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas + * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas. * * @param string $value * @param int $index Identifier for a specific print area range allowing several ranges to be set @@ -730,7 +751,9 @@ class PageSetup * Specifying an index value of 0, will always append the new print range at the end of the * list. * Print areas are numbered from 1 + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return PageSetup */ public function addPrintArea($value, $index = -1) @@ -739,7 +762,7 @@ class PageSetup } /** - * Set print area + * Set print area. * * @param int $column1 Column 1 * @param int $row1 Row 1 @@ -758,7 +781,9 @@ class PageSetup * @param string $method Determines the method used when setting multiple print areas * Default behaviour, or the "O" method, overwrites existing print area * The "I" method, inserts the new print area before any specified index, or at the end of the list + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return PageSetup */ public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) @@ -771,7 +796,7 @@ class PageSetup } /** - * Add a new print area to the list of print areas + * Add a new print area to the list of print areas. * * @param int $column1 Start Column for the print area * @param int $row1 Start Row for the print area @@ -783,7 +808,9 @@ class PageSetup * Specifying an index value of 0, will always append the new print range at the end of the * list. * Print areas are numbered from 1 + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return PageSetup */ public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1) @@ -796,7 +823,7 @@ class PageSetup } /** - * Get first page number + * Get first page number. * * @return int */ @@ -806,9 +833,10 @@ class PageSetup } /** - * Set first page number + * Set first page number. * * @param int $value + * * @return PageSetup */ public function setFirstPageNumber($value = null) @@ -819,7 +847,7 @@ class PageSetup } /** - * Reset first page number + * Reset first page number. * * @return PageSetup */ diff --git a/src/PhpSpreadsheet/Worksheet/Protection.php b/src/PhpSpreadsheet/Worksheet/Protection.php index 5bf83e72..f619cf59 100644 --- a/src/PhpSpreadsheet/Worksheet/Protection.php +++ b/src/PhpSpreadsheet/Worksheet/Protection.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,132 +20,133 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Protection { /** - * Sheet + * Sheet. * * @var bool */ private $sheet = false; /** - * Objects + * Objects. * * @var bool */ private $objects = false; /** - * Scenarios + * Scenarios. * * @var bool */ private $scenarios = false; /** - * Format cells + * Format cells. * * @var bool */ private $formatCells = false; /** - * Format columns + * Format columns. * * @var bool */ private $formatColumns = false; /** - * Format rows + * Format rows. * * @var bool */ private $formatRows = false; /** - * Insert columns + * Insert columns. * * @var bool */ private $insertColumns = false; /** - * Insert rows + * Insert rows. * * @var bool */ private $insertRows = false; /** - * Insert hyperlinks + * Insert hyperlinks. * * @var bool */ private $insertHyperlinks = false; /** - * Delete columns + * Delete columns. * * @var bool */ private $deleteColumns = false; /** - * Delete rows + * Delete rows. * * @var bool */ private $deleteRows = false; /** - * Select locked cells + * Select locked cells. * * @var bool */ private $selectLockedCells = false; /** - * Sort + * Sort. * * @var bool */ private $sort = false; /** - * AutoFilter + * AutoFilter. * * @var bool */ private $autoFilter = false; /** - * Pivot tables + * Pivot tables. * * @var bool */ private $pivotTables = false; /** - * Select unlocked cells + * Select unlocked cells. * * @var bool */ private $selectUnlockedCells = false; /** - * Password + * Password. * * @var string */ private $password = ''; /** - * Create a new Protection + * Create a new Protection. */ public function __construct() { @@ -177,7 +178,7 @@ class Protection } /** - * Get Sheet + * Get Sheet. * * @return bool */ @@ -187,9 +188,10 @@ class Protection } /** - * Set Sheet + * Set Sheet. * * @param bool $pValue + * * @return Protection */ public function setSheet($pValue = false) @@ -200,7 +202,7 @@ class Protection } /** - * Get Objects + * Get Objects. * * @return bool */ @@ -210,9 +212,10 @@ class Protection } /** - * Set Objects + * Set Objects. * * @param bool $pValue + * * @return Protection */ public function setObjects($pValue = false) @@ -223,7 +226,7 @@ class Protection } /** - * Get Scenarios + * Get Scenarios. * * @return bool */ @@ -233,9 +236,10 @@ class Protection } /** - * Set Scenarios + * Set Scenarios. * * @param bool $pValue + * * @return Protection */ public function setScenarios($pValue = false) @@ -246,7 +250,7 @@ class Protection } /** - * Get FormatCells + * Get FormatCells. * * @return bool */ @@ -256,9 +260,10 @@ class Protection } /** - * Set FormatCells + * Set FormatCells. * * @param bool $pValue + * * @return Protection */ public function setFormatCells($pValue = false) @@ -269,7 +274,7 @@ class Protection } /** - * Get FormatColumns + * Get FormatColumns. * * @return bool */ @@ -279,9 +284,10 @@ class Protection } /** - * Set FormatColumns + * Set FormatColumns. * * @param bool $pValue + * * @return Protection */ public function setFormatColumns($pValue = false) @@ -292,7 +298,7 @@ class Protection } /** - * Get FormatRows + * Get FormatRows. * * @return bool */ @@ -302,9 +308,10 @@ class Protection } /** - * Set FormatRows + * Set FormatRows. * * @param bool $pValue + * * @return Protection */ public function setFormatRows($pValue = false) @@ -315,7 +322,7 @@ class Protection } /** - * Get InsertColumns + * Get InsertColumns. * * @return bool */ @@ -325,9 +332,10 @@ class Protection } /** - * Set InsertColumns + * Set InsertColumns. * * @param bool $pValue + * * @return Protection */ public function setInsertColumns($pValue = false) @@ -338,7 +346,7 @@ class Protection } /** - * Get InsertRows + * Get InsertRows. * * @return bool */ @@ -348,9 +356,10 @@ class Protection } /** - * Set InsertRows + * Set InsertRows. * * @param bool $pValue + * * @return Protection */ public function setInsertRows($pValue = false) @@ -361,7 +370,7 @@ class Protection } /** - * Get InsertHyperlinks + * Get InsertHyperlinks. * * @return bool */ @@ -371,9 +380,10 @@ class Protection } /** - * Set InsertHyperlinks + * Set InsertHyperlinks. * * @param bool $pValue + * * @return Protection */ public function setInsertHyperlinks($pValue = false) @@ -384,7 +394,7 @@ class Protection } /** - * Get DeleteColumns + * Get DeleteColumns. * * @return bool */ @@ -394,9 +404,10 @@ class Protection } /** - * Set DeleteColumns + * Set DeleteColumns. * * @param bool $pValue + * * @return Protection */ public function setDeleteColumns($pValue = false) @@ -407,7 +418,7 @@ class Protection } /** - * Get DeleteRows + * Get DeleteRows. * * @return bool */ @@ -417,9 +428,10 @@ class Protection } /** - * Set DeleteRows + * Set DeleteRows. * * @param bool $pValue + * * @return Protection */ public function setDeleteRows($pValue = false) @@ -430,7 +442,7 @@ class Protection } /** - * Get SelectLockedCells + * Get SelectLockedCells. * * @return bool */ @@ -440,9 +452,10 @@ class Protection } /** - * Set SelectLockedCells + * Set SelectLockedCells. * * @param bool $pValue + * * @return Protection */ public function setSelectLockedCells($pValue = false) @@ -453,7 +466,7 @@ class Protection } /** - * Get Sort + * Get Sort. * * @return bool */ @@ -463,9 +476,10 @@ class Protection } /** - * Set Sort + * Set Sort. * * @param bool $pValue + * * @return Protection */ public function setSort($pValue = false) @@ -476,7 +490,7 @@ class Protection } /** - * Get AutoFilter + * Get AutoFilter. * * @return bool */ @@ -486,9 +500,10 @@ class Protection } /** - * Set AutoFilter + * Set AutoFilter. * * @param bool $pValue + * * @return Protection */ public function setAutoFilter($pValue = false) @@ -499,7 +514,7 @@ class Protection } /** - * Get PivotTables + * Get PivotTables. * * @return bool */ @@ -509,9 +524,10 @@ class Protection } /** - * Set PivotTables + * Set PivotTables. * * @param bool $pValue + * * @return Protection */ public function setPivotTables($pValue = false) @@ -522,7 +538,7 @@ class Protection } /** - * Get SelectUnlockedCells + * Get SelectUnlockedCells. * * @return bool */ @@ -532,9 +548,10 @@ class Protection } /** - * Set SelectUnlockedCells + * Set SelectUnlockedCells. * * @param bool $pValue + * * @return Protection */ public function setSelectUnlockedCells($pValue = false) @@ -545,7 +562,7 @@ class Protection } /** - * Get Password (hashed) + * Get Password (hashed). * * @return string */ @@ -555,10 +572,11 @@ class Protection } /** - * Set Password + * Set Password. * * @param string $pValue * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * * @return Protection */ public function setPassword($pValue = '', $pAlreadyHashed = false) diff --git a/src/PhpSpreadsheet/Worksheet/Row.php b/src/PhpSpreadsheet/Worksheet/Row.php index e7fe6427..b546d808 100644 --- a/src/PhpSpreadsheet/Worksheet/Row.php +++ b/src/PhpSpreadsheet/Worksheet/Row.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Row { /** - * \PhpOffice\PhpSpreadsheet\Worksheet + * \PhpOffice\PhpSpreadsheet\Worksheet. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ private $parent; /** - * Row index + * Row index. * * @var int */ private $rowIndex = 0; /** - * Create a new row + * Create a new row. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $parent * @param int $rowIndex @@ -53,7 +54,7 @@ class Row } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -61,7 +62,7 @@ class Row } /** - * Get row index + * Get row index. * * @return int */ @@ -71,10 +72,11 @@ class Row } /** - * Get cell iterator + * Get cell iterator. * * @param string $startColumn The column address at which to start iterating * @param string $endColumn Optionally, the column address at which to stop iterating + * * @return RowCellIterator */ public function getCellIterator($startColumn = 'A', $endColumn = null) diff --git a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php index 108353fb..813e708d 100644 --- a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,34 +20,35 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class RowCellIterator extends CellIterator implements \Iterator { /** - * Row index + * Row index. * * @var int */ protected $rowIndex; /** - * Start position + * Start position. * * @var int */ protected $startColumn = 0; /** - * End position + * End position. * * @var int */ protected $endColumn = 0; /** - * Create a new column iterator + * Create a new column iterator. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $subject The worksheet to iterate over * @param int $rowIndex The row that we want to iterate @@ -64,7 +65,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -72,10 +73,12 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * (Re)Set the start column and the current column pointer + * (Re)Set the start column and the current column pointer. * * @param int $startColumn The column address at which to start iterating + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return RowCellIterator */ public function resetStart($startColumn = 'A') @@ -89,10 +92,12 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * (Re)Set the end column + * (Re)Set the end column. * * @param string $endColumn The column address at which to stop iterating + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return RowCellIterator */ public function resetEnd($endColumn = null) @@ -105,10 +110,12 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Set the column pointer to the selected column + * Set the column pointer to the selected column. * * @param string $column The column address to set the current pointer at + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return RowCellIterator */ public function seek($column = 'A') @@ -125,7 +132,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Rewind the iterator to the starting column + * Rewind the iterator to the starting column. */ public function rewind() { @@ -133,7 +140,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Return the current cell in this worksheet row + * Return the current cell in this worksheet row. * * @return \PhpOffice\PhpSpreadsheet\Cell */ @@ -143,7 +150,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Return the current iterator key + * Return the current iterator key. * * @return string */ @@ -153,7 +160,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Set the iterator to its next value + * Set the iterator to its next value. */ public function next() { @@ -165,7 +172,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Set the iterator to its previous value + * Set the iterator to its previous value. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -187,7 +194,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Indicate if more columns exist in the worksheet range of columns that we're iterating + * Indicate if more columns exist in the worksheet range of columns that we're iterating. * * @return bool */ @@ -197,7 +204,7 @@ class RowCellIterator extends CellIterator implements \Iterator } /** - * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary + * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ diff --git a/src/PhpSpreadsheet/Worksheet/RowDimension.php b/src/PhpSpreadsheet/Worksheet/RowDimension.php index 8118db2b..60097dcc 100644 --- a/src/PhpSpreadsheet/Worksheet/RowDimension.php +++ b/src/PhpSpreadsheet/Worksheet/RowDimension.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class RowDimension extends Dimension { /** - * Row index + * Row index. * * @var int */ private $rowIndex; /** - * Row height (in pt) + * Row height (in pt). * * When this is set to a negative value, the row height should be ignored by IWriter * @@ -49,7 +50,7 @@ class RowDimension extends Dimension private $zeroHeight = false; /** - * Create a new RowDimension + * Create a new RowDimension. * * @param int $pIndex Numeric row index */ @@ -63,7 +64,7 @@ class RowDimension extends Dimension } /** - * Get Row Index + * Get Row Index. * * @return int */ @@ -73,9 +74,10 @@ class RowDimension extends Dimension } /** - * Set Row Index + * Set Row Index. * * @param int $pValue + * * @return RowDimension */ public function setRowIndex($pValue) @@ -86,7 +88,7 @@ class RowDimension extends Dimension } /** - * Get Row Height + * Get Row Height. * * @return float */ @@ -96,9 +98,10 @@ class RowDimension extends Dimension } /** - * Set Row Height + * Set Row Height. * * @param float $pValue + * * @return RowDimension */ public function setRowHeight($pValue = -1) @@ -109,7 +112,7 @@ class RowDimension extends Dimension } /** - * Get ZeroHeight + * Get ZeroHeight. * * @return bool */ @@ -119,9 +122,10 @@ class RowDimension extends Dimension } /** - * Set ZeroHeight + * Set ZeroHeight. * * @param bool $pValue + * * @return RowDimension */ public function setZeroHeight($pValue = false) diff --git a/src/PhpSpreadsheet/Worksheet/RowIterator.php b/src/PhpSpreadsheet/Worksheet/RowIterator.php index 91821d5d..e0077ca7 100644 --- a/src/PhpSpreadsheet/Worksheet/RowIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowIterator.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,41 +20,42 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class RowIterator implements \Iterator { /** - * \PhpOffice\PhpSpreadsheet\Worksheet to iterate + * \PhpOffice\PhpSpreadsheet\Worksheet to iterate. * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ private $subject; /** - * Current iterator position + * Current iterator position. * * @var int */ private $position = 1; /** - * Start position + * Start position. * * @var int */ private $startRow = 1; /** - * End position + * End position. * * @var int */ private $endRow = 1; /** - * Create a new row iterator + * Create a new row iterator. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $subject The worksheet to iterate over * @param int $startRow The row number at which to start iterating @@ -69,7 +70,7 @@ class RowIterator implements \Iterator } /** - * Destructor + * Destructor. */ public function __destruct() { @@ -77,10 +78,12 @@ class RowIterator implements \Iterator } /** - * (Re)Set the start row and the current row pointer + * (Re)Set the start row and the current row pointer. * * @param int $startRow The row number at which to start iterating + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return RowIterator */ public function resetStart($startRow = 1) @@ -99,9 +102,10 @@ class RowIterator implements \Iterator } /** - * (Re)Set the end row + * (Re)Set the end row. * * @param int $endRow The row number at which to stop iterating + * * @return RowIterator */ public function resetEnd($endRow = null) @@ -112,10 +116,12 @@ class RowIterator implements \Iterator } /** - * Set the row pointer to the selected row + * Set the row pointer to the selected row. * * @param int $row The row number to set the current pointer at + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return RowIterator */ public function seek($row = 1) @@ -129,7 +135,7 @@ class RowIterator implements \Iterator } /** - * Rewind the iterator to the starting row + * Rewind the iterator to the starting row. */ public function rewind() { @@ -137,7 +143,7 @@ class RowIterator implements \Iterator } /** - * Return the current row in this worksheet + * Return the current row in this worksheet. * * @return Row */ @@ -147,7 +153,7 @@ class RowIterator implements \Iterator } /** - * Return the current iterator key + * Return the current iterator key. * * @return int */ @@ -157,7 +163,7 @@ class RowIterator implements \Iterator } /** - * Set the iterator to its next value + * Set the iterator to its next value. */ public function next() { @@ -165,7 +171,7 @@ class RowIterator implements \Iterator } /** - * Set the iterator to its previous value + * Set the iterator to its previous value. * * @throws \PhpOffice\PhpSpreadsheet\Exception */ @@ -179,7 +185,7 @@ class RowIterator implements \Iterator } /** - * Indicate if more rows exist in the worksheet range of rows that we're iterating + * Indicate if more rows exist in the worksheet range of rows that we're iterating. * * @return bool */ diff --git a/src/PhpSpreadsheet/Worksheet/SheetView.php b/src/PhpSpreadsheet/Worksheet/SheetView.php index 5dd6f6a7..8ac4849f 100644 --- a/src/PhpSpreadsheet/Worksheet/SheetView.php +++ b/src/PhpSpreadsheet/Worksheet/SheetView.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -37,7 +38,7 @@ class SheetView ]; /** - * ZoomScale + * ZoomScale. * * Valid values range from 10 to 400. * @@ -46,7 +47,7 @@ class SheetView private $zoomScale = 100; /** - * ZoomScaleNormal + * ZoomScaleNormal. * * Valid values range from 10 to 400. * @@ -55,7 +56,7 @@ class SheetView private $zoomScaleNormal = 100; /** - * View + * View. * * Valid values range from 10 to 400. * @@ -64,14 +65,14 @@ class SheetView private $sheetviewType = self::SHEETVIEW_NORMAL; /** - * Create a new SheetView + * Create a new SheetView. */ public function __construct() { } /** - * Get ZoomScale + * Get ZoomScale. * * @return int */ @@ -81,12 +82,14 @@ class SheetView } /** - * Set ZoomScale + * Set ZoomScale. * * Valid values range from 10 to 400. * * @param int $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return SheetView */ public function setZoomScale($pValue = 100) @@ -103,7 +106,7 @@ class SheetView } /** - * Get ZoomScaleNormal + * Get ZoomScaleNormal. * * @return int */ @@ -113,12 +116,14 @@ class SheetView } /** - * Set ZoomScale + * Set ZoomScale. * * Valid values range from 10 to 400. * * @param int $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return SheetView */ public function setZoomScaleNormal($pValue = 100) @@ -133,7 +138,7 @@ class SheetView } /** - * Get View + * Get View. * * @return string */ @@ -143,7 +148,7 @@ class SheetView } /** - * Set View + * Set View. * * Valid values are * 'normal' self::SHEETVIEW_NORMAL @@ -151,7 +156,9 @@ class SheetView * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW * * @param string $pValue + * * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return SheetView */ public function setView($pValue = null) diff --git a/src/PhpSpreadsheet/Writer/BaseWriter.php b/src/PhpSpreadsheet/Writer/BaseWriter.php index 017bb481..05821181 100644 --- a/src/PhpSpreadsheet/Writer/BaseWriter.php +++ b/src/PhpSpreadsheet/Writer/BaseWriter.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -27,7 +28,7 @@ abstract class BaseWriter implements IWriter { /** * Write charts that are defined in the workbook? - * Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object; + * Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object;. * * @var bool */ @@ -36,7 +37,7 @@ abstract class BaseWriter implements IWriter /** * Pre-calculate formulas * Forces PhpSpreadsheet to recalculate all formulae in a workbook when saving, so that the pre-calculated values are - * immediately available to MS Excel or other office spreadsheet viewer when opening the file + * immediately available to MS Excel or other office spreadsheet viewer when opening the file. * * @var bool */ @@ -50,7 +51,7 @@ abstract class BaseWriter implements IWriter protected $_useDiskCaching = false; /** - * Disk caching directory + * Disk caching directory. * * @var string */ @@ -74,11 +75,12 @@ abstract class BaseWriter implements IWriter * Set to false (the default) to ignore charts. * * @param bool $pValue + * * @return IWriter */ public function setIncludeCharts($pValue = false) { - $this->includeCharts = (boolean) $pValue; + $this->includeCharts = (bool) $pValue; return $this; } @@ -89,7 +91,7 @@ abstract class BaseWriter implements IWriter * so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet * viewer when opening the file * If false, then formulae are not calculated on save. This is faster for saving in PhpSpreadsheet, but slower - * when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself + * when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself. * * @return bool */ @@ -104,11 +106,12 @@ abstract class BaseWriter implements IWriter * Set to false to prevent precalculation of formulae on save. * * @param bool $pValue Pre-Calculate Formulas? + * * @return IWriter */ public function setPreCalculateFormulas($pValue = true) { - $this->preCalculateFormulas = (boolean) $pValue; + $this->preCalculateFormulas = (bool) $pValue; return $this; } @@ -128,7 +131,9 @@ abstract class BaseWriter implements IWriter * * @param bool $pValue * @param string $pDirectory Disk caching directory + * * @throws Exception when directory does not exist + * * @return IWriter */ public function setUseDiskCaching($pValue = false, $pDirectory = null) @@ -147,7 +152,7 @@ abstract class BaseWriter implements IWriter } /** - * Get disk caching directory + * Get disk caching directory. * * @return string */ diff --git a/src/PhpSpreadsheet/Writer/CSV.php b/src/PhpSpreadsheet/Writer/CSV.php index e5fde94a..84e0e1a2 100644 --- a/src/PhpSpreadsheet/Writer/CSV.php +++ b/src/PhpSpreadsheet/Writer/CSV.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,41 +20,42 @@ namespace PhpOffice\PhpSpreadsheet\Writer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class CSV extends BaseWriter implements IWriter { /** - * PhpSpreadsheet object + * PhpSpreadsheet object. * * @var PhpSpreadsheet */ private $spreadsheet; /** - * Delimiter + * Delimiter. * * @var string */ private $delimiter = ','; /** - * Enclosure + * Enclosure. * * @var string */ private $enclosure = '"'; /** - * Line ending + * Line ending. * * @var string */ private $lineEnding = PHP_EOL; /** - * Sheet index to write + * Sheet index to write. * * @var int */ @@ -69,7 +70,7 @@ class CSV extends BaseWriter implements IWriter /** * Whether to write a Separator line as the first line of the file - * sep=x + * sep=x. * * @var bool */ @@ -83,7 +84,7 @@ class CSV extends BaseWriter implements IWriter private $excelCompatibility = false; /** - * Create a new CSV + * Create a new CSV. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object */ @@ -93,9 +94,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Save PhpSpreadsheet to file + * Save PhpSpreadsheet to file. * * @param string $pFilename + * * @throws Exception */ public function save($pFilename = null) @@ -150,7 +152,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get delimiter + * Get delimiter. * * @return string */ @@ -160,9 +162,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Set delimiter + * Set delimiter. * * @param string $pValue Delimiter, defaults to , + * * @return CSV */ public function setDelimiter($pValue = ',') @@ -173,7 +176,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get enclosure + * Get enclosure. * * @return string */ @@ -183,9 +186,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Set enclosure + * Set enclosure. * * @param string $pValue Enclosure, defaults to " + * * @return CSV */ public function setEnclosure($pValue = '"') @@ -199,7 +203,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get line ending + * Get line ending. * * @return string */ @@ -209,9 +213,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Set line ending + * Set line ending. * * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) + * * @return CSV */ public function setLineEnding($pValue = PHP_EOL) @@ -222,7 +227,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get whether BOM should be used + * Get whether BOM should be used. * * @return bool */ @@ -232,9 +237,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Set whether BOM should be used + * Set whether BOM should be used. * * @param bool $pValue Use UTF-8 byte-order mark? Defaults to false + * * @return CSV */ public function setUseBOM($pValue = false) @@ -245,7 +251,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get whether a separator line should be included + * Get whether a separator line should be included. * * @return bool */ @@ -255,9 +261,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Set whether a separator line should be included as the first line of the file + * Set whether a separator line should be included as the first line of the file. * * @param bool $pValue Use separator line? Defaults to false + * * @return CSV */ public function setIncludeSeparatorLine($pValue = false) @@ -268,7 +275,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get whether the file should be saved with full Excel Compatibility + * Get whether the file should be saved with full Excel Compatibility. * * @return bool */ @@ -278,10 +285,11 @@ class CSV extends BaseWriter implements IWriter } /** - * Set whether the file should be saved with full Excel Compatibility + * Set whether the file should be saved with full Excel Compatibility. * * @param bool $pValue Set the file to be written as a fully Excel compatible csv file * Note that this overrides other settings such as useBOM, enclosure and delimiter + * * @return CSV */ public function setExcelCompatibility($pValue = false) @@ -292,7 +300,7 @@ class CSV extends BaseWriter implements IWriter } /** - * Get sheet index + * Get sheet index. * * @return int */ @@ -302,9 +310,10 @@ class CSV extends BaseWriter implements IWriter } /** - * Set sheet index + * Set sheet index. * * @param int $pValue Sheet index + * * @return CSV */ public function setSheetIndex($pValue = 0) @@ -315,10 +324,11 @@ class CSV extends BaseWriter implements IWriter } /** - * Write line to CSV file + * Write line to CSV file. * * @param resource $pFileHandle PHP filehandle * @param array $pValues Array containing values in a row + * * @throws Exception */ private function writeLine($pFileHandle = null, $pValues = null) diff --git a/src/PhpSpreadsheet/Writer/Exception.php b/src/PhpSpreadsheet/Writer/Exception.php index be920d89..d36fc3f2 100644 --- a/src/PhpSpreadsheet/Writer/Exception.php +++ b/src/PhpSpreadsheet/Writer/Exception.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Exception extends \PhpOffice\PhpSpreadsheet\Exception { /** - * Error handler callback + * Error handler callback. * * @param mixed $code * @param mixed $string diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/HTML.php index c08b2589..467dbdcb 100644 --- a/src/PhpSpreadsheet/Writer/HTML.php +++ b/src/PhpSpreadsheet/Writer/HTML.php @@ -8,7 +8,7 @@ use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; /** - * Copyright (c) 2006 - 2015 Spreadsheet + * Copyright (c) 2006 - 2015 Spreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,34 +25,35 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category Spreadsheet + * * @copyright Copyright (c) 2006 - 2015 Spreadsheet (https://github.com/PHPOffice/Spreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class HTML extends BaseWriter implements IWriter { /** - * Spreadsheet object + * Spreadsheet object. * * @var Spreadsheet */ protected $spreadsheet; /** - * Sheet index to write + * Sheet index to write. * * @var int */ private $sheetIndex = 0; /** - * Images root + * Images root. * * @var string */ private $imagesRoot = '.'; /** - * embed images, or link to images + * embed images, or link to images. * * @var bool */ @@ -66,49 +67,49 @@ class HTML extends BaseWriter implements IWriter private $useInlineCss = false; /** - * Array of CSS styles + * Array of CSS styles. * * @var array */ private $cssStyles; /** - * Array of column widths in points + * Array of column widths in points. * * @var array */ private $columnWidths; /** - * Default font + * Default font. * * @var \PhpOffice\PhpSpreadsheet\Style\Font */ private $defaultFont; /** - * Flag whether spans have been calculated + * Flag whether spans have been calculated. * * @var bool */ private $spansAreCalculated = false; /** - * Excel cells that should not be written as HTML cells + * Excel cells that should not be written as HTML cells. * * @var array */ private $isSpannedCell = []; /** - * Excel cells that are upper-left corner in a cell merge + * Excel cells that are upper-left corner in a cell merge. * * @var array */ private $isBaseCell = []; /** - * Excel rows that should not be written as HTML rows + * Excel rows that should not be written as HTML rows. * * @var array */ @@ -122,14 +123,14 @@ class HTML extends BaseWriter implements IWriter protected $isPdf = false; /** - * Generate the Navigation block + * Generate the Navigation block. * * @var bool */ private $generateSheetNavigationBlock = true; /** - * Create a new HTML + * Create a new HTML. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet */ @@ -140,9 +141,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Save Spreadsheet to file + * Save Spreadsheet to file. * * @param string $pFilename + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) @@ -186,9 +188,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Map VAlign + * Map VAlign. * * @param string $vAlign Vertical alignment + * * @return string */ private function mapVAlign($vAlign) @@ -207,9 +210,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Map HAlign + * Map HAlign. * * @param string $hAlign Horizontal alignment + * * @return string|false */ private function mapHAlign($hAlign) @@ -232,9 +236,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Map border style + * Map border style. * * @param int $borderStyle Sheet index + * * @return string */ private function mapBorderStyle($borderStyle) @@ -275,7 +280,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Get sheet index + * Get sheet index. * * @return int */ @@ -285,9 +290,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Set sheet index + * Set sheet index. * * @param int $pValue Sheet index + * * @return HTML */ public function setSheetIndex($pValue = 0) @@ -298,7 +304,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Get sheet index + * Get sheet index. * * @return bool */ @@ -308,9 +314,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Set sheet index + * Set sheet index. * * @param bool $pValue Flag indicating whether the sheet navigation block should be generated or not + * * @return HTML */ public function setGenerateSheetNavigationBlock($pValue = true) @@ -321,7 +328,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Write all sheets (resets sheetIndex to NULL) + * Write all sheets (resets sheetIndex to NULL). */ public function writeAllSheets() { @@ -331,10 +338,12 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate HTML header + * Generate HTML header. * * @param bool $pIncludeStyles Include styles? + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ public function generateHTMLHeader($pIncludeStyles = false) @@ -391,9 +400,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate sheet data + * Generate sheet data. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ public function generateSheetData() @@ -510,9 +520,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate sheet tabs + * Generate sheet tabs. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ public function generateNavigation() @@ -603,11 +614,13 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate image tag in cell + * Generate image tag in cell. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet * @param string $coordinates Cell coordinates + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ private function writeImageInCell(\PhpOffice\PhpSpreadsheet\Worksheet $pSheet, $coordinates) @@ -684,11 +697,13 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate chart tag in cell + * Generate chart tag in cell. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet * @param string $coordinates Cell coordinates + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ private function writeChartInCell(\PhpOffice\PhpSpreadsheet\Worksheet $pSheet, $coordinates) @@ -731,10 +746,12 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate CSS styles + * Generate CSS styles. * * @param bool $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>) + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ public function generateStyles($generateSurroundingHTML = true) @@ -773,10 +790,12 @@ class HTML extends BaseWriter implements IWriter } /** - * Build CSS styles + * Build CSS styles. * * @param bool $generateSurroundingHTML Generate surrounding HTML style? (html { }) + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return array */ public function buildCSS($generateSurroundingHTML = true) @@ -928,9 +947,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Create CSS style + * Create CSS style. * * @param \PhpOffice\PhpSpreadsheet\Style $pStyle + * * @return array */ private function createCSSStyle(\PhpOffice\PhpSpreadsheet\Style $pStyle) @@ -951,9 +971,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Alignment) + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Alignment). * * @param \PhpOffice\PhpSpreadsheet\Style\Alignment $pStyle \PhpOffice\PhpSpreadsheet\Style\Alignment + * * @return array */ private function createCSSStyleAlignment(\PhpOffice\PhpSpreadsheet\Style\Alignment $pStyle) @@ -974,9 +995,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Font) + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Font). * * @param \PhpOffice\PhpSpreadsheet\Style\Font $pStyle \PhpOffice\PhpSpreadsheet\Style\Font + * * @return array */ private function createCSSStyleFont(\PhpOffice\PhpSpreadsheet\Style\Font $pStyle) @@ -1007,9 +1029,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Borders) + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Borders). * * @param \PhpOffice\PhpSpreadsheet\Style\Borders $pStyle \PhpOffice\PhpSpreadsheet\Style\Borders + * * @return array */ private function createCSSStyleBorders(\PhpOffice\PhpSpreadsheet\Style\Borders $pStyle) @@ -1027,9 +1050,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Border) + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Border). * * @param \PhpOffice\PhpSpreadsheet\Style\Border $pStyle \PhpOffice\PhpSpreadsheet\Style\Border + * * @return string */ private function createCSSStyleBorder(\PhpOffice\PhpSpreadsheet\Style\Border $pStyle) @@ -1042,9 +1066,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Fill) + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Fill). * * @param \PhpOffice\PhpSpreadsheet\Style\Fill $pStyle \PhpOffice\PhpSpreadsheet\Style\Fill + * * @return array */ private function createCSSStyleFill(\PhpOffice\PhpSpreadsheet\Style\Fill $pStyle) @@ -1061,7 +1086,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate HTML footer + * Generate HTML footer. */ public function generateHTMLFooter() { @@ -1074,10 +1099,12 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate table header + * Generate table header. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet The worksheet for the table we are writing + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ private function generateTableHeader($pSheet) @@ -1121,7 +1148,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate table footer + * Generate table footer. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ @@ -1133,12 +1160,15 @@ class HTML extends BaseWriter implements IWriter } /** - * Generate row + * Generate row. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet * @param array $pValues Array containing cells in a row * @param int $pRow Row number (0-based) + * @param mixed $cellType + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string */ private function generateRow(\PhpOffice\PhpSpreadsheet\Worksheet $pSheet, $pValues = null, $pRow = 0, $cellType = 'td') @@ -1379,15 +1409,16 @@ class HTML extends BaseWriter implements IWriter // Return return $html; - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid parameters passed.'); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid parameters passed.'); } /** - * Takes array where of CSS properties / values and converts to CSS string + * Takes array where of CSS properties / values and converts to CSS string. * * @param array + * @param mixed $pValue + * * @return string */ private function assembleCSS($pValue = []) @@ -1402,7 +1433,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Get images root + * Get images root. * * @return string */ @@ -1412,9 +1443,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Set images root + * Set images root. * * @param string $pValue + * * @return HTML */ public function setImagesRoot($pValue = '.') @@ -1425,7 +1457,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Get embed images + * Get embed images. * * @return bool */ @@ -1435,9 +1467,10 @@ class HTML extends BaseWriter implements IWriter } /** - * Set embed images + * Set embed images. * * @param bool $pValue + * * @return HTML */ public function setEmbedImages($pValue = true) @@ -1461,6 +1494,7 @@ class HTML extends BaseWriter implements IWriter * Set use inline CSS? * * @param bool $pValue + * * @return HTML */ public function setUseInlineCss($pValue = false) @@ -1471,10 +1505,11 @@ class HTML extends BaseWriter implements IWriter } /** - * Add color to formatted string as inline style + * Add color to formatted string as inline style. * * @param string $pValue Plain formatted value without color * @param string $pFormat Format code + * * @return string */ public function formatColor($pValue, $pFormat) @@ -1502,7 +1537,7 @@ class HTML extends BaseWriter implements IWriter } /** - * Calculate information about HTML colspan and rowspan which is not always the same as Excel's + * Calculate information about HTML colspan and rowspan which is not always the same as Excel's. */ private function calculateSpans() { diff --git a/src/PhpSpreadsheet/Writer/IWriter.php b/src/PhpSpreadsheet/Writer/IWriter.php index d693d308..0fd2109e 100644 --- a/src/PhpSpreadsheet/Writer/IWriter.php +++ b/src/PhpSpreadsheet/Writer/IWriter.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,17 @@ namespace PhpOffice\PhpSpreadsheet\Writer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ interface IWriter { /** - * Save PhpSpreadsheet to file + * Save PhpSpreadsheet to file. * * @param string $pFilename Name of the file to save + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null); diff --git a/src/PhpSpreadsheet/Writer/Ods.php b/src/PhpSpreadsheet/Writer/Ods.php index f2cbd471..66860e41 100644 --- a/src/PhpSpreadsheet/Writer/Ods.php +++ b/src/PhpSpreadsheet/Writer/Ods.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; use PhpOffice\PhpSpreadsheet\Spreadsheet; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,27 +22,28 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Ods extends BaseWriter implements IWriter { /** - * Private writer parts + * Private writer parts. * * @var Ods\WriterPart[] */ private $writerParts = []; /** - * Private PhpSpreadsheet + * Private PhpSpreadsheet. * * @var PhpSpreadsheet */ private $spreadSheet; /** - * Create a new Ods + * Create a new Ods. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet */ @@ -66,24 +67,26 @@ class Ods extends BaseWriter implements IWriter } /** - * Get writer part + * Get writer part. * * @param string $pPartName Writer part name + * * @return Ods\WriterPart|null */ public function getWriterPart($pPartName = '') { if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) { return $this->writerParts[strtolower($pPartName)]; - } else { - return null; } + + return null; } /** - * Save PhpSpreadsheet to file + * Save PhpSpreadsheet to file. * * @param string $pFilename + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) @@ -129,10 +132,12 @@ class Ods extends BaseWriter implements IWriter } /** - * Create zip object + * Create zip object. * * @param string $pFilename + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return ZipArchive */ private function createZip($pFilename) @@ -161,25 +166,27 @@ class Ods extends BaseWriter implements IWriter } /** - * Get Spreadsheet object + * Get Spreadsheet object. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return Spreadsheet */ public function getSpreadsheet() { if ($this->spreadSheet !== null) { return $this->spreadSheet; - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No PhpSpreadsheet assigned.'); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No PhpSpreadsheet assigned.'); } /** - * Set Spreadsheet object + * Set Spreadsheet object. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return self */ public function setSpreadsheet(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php b/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php index a9b76f62..9d3b4c00 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php +++ b/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods\Cell; /** - * PhpSpreadsheet + * PhpSpreadsheet. * * Copyright (c) 2006 - 2015 PhpSpreadsheet * @@ -22,12 +22,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods\Cell; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ /** * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @author Alexander Pervakov */ diff --git a/src/PhpSpreadsheet/Writer/Ods/Content.php b/src/PhpSpreadsheet/Writer/Ods/Content.php index f03749d0..844d6fe7 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Content.php +++ b/src/PhpSpreadsheet/Writer/Ods/Content.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * PhpSpreadsheet + * PhpSpreadsheet. * * Copyright (c) 2006 - 2015 PhpSpreadsheet * @@ -22,12 +22,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ /** * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @author Alexander Pervakov */ @@ -37,10 +39,12 @@ class Content extends WriterPart const NUMBER_ROWS_REPEATED_MAX = 1048576; /** - * Write content.xml to XML format + * Write content.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function write(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -112,7 +116,7 @@ class Content extends WriterPart } /** - * Write sheets + * Write sheets. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter */ @@ -134,7 +138,7 @@ class Content extends WriterPart } /** - * Write rows of the specified sheet + * Write rows of the specified sheet. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter * @param \PhpOffice\PhpSpreadsheet\Worksheet $sheet @@ -170,10 +174,11 @@ class Content extends WriterPart } /** - * Write cells of the specified row + * Write cells of the specified row. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter * @param \PhpOffice\PhpSpreadsheet\Worksheet\Row $row + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeCells(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Row $row) @@ -194,11 +199,9 @@ class Content extends WriterPart $objWriter->writeAttribute('office:value', $cell->getValue()); $objWriter->writeElement('text:p', $cell->getValue()); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ERROR: throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Writing of error not implemented yet.'); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_FORMULA: try { $formula_value = $cell->getCalculatedValue(); @@ -214,17 +217,14 @@ class Content extends WriterPart $objWriter->writeAttribute('office:value', $formula_value); $objWriter->writeElement('text:p', $formula_value); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_INLINE: throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Writing of inline not implemented yet.'); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC: $objWriter->writeAttribute('office:value-type', 'float'); $objWriter->writeAttribute('office:value', $cell->getValue()); $objWriter->writeElement('text:p', $cell->getValue()); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING: $objWriter->writeAttribute('office:value-type', 'string'); $objWriter->writeElement('text:p', $cell->getValue()); @@ -248,7 +248,7 @@ class Content extends WriterPart } /** - * Write span + * Write span. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter * @param int $curColumn diff --git a/src/PhpSpreadsheet/Writer/Ods/Meta.php b/src/PhpSpreadsheet/Writer/Ods/Meta.php index 9485c82e..79d99869 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Meta.php +++ b/src/PhpSpreadsheet/Writer/Ods/Meta.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Meta extends WriterPart { /** - * Write meta.xml to XML format + * Write meta.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function write(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/MetaInf.php b/src/PhpSpreadsheet/Writer/Ods/MetaInf.php index 62cd88ee..676c9e88 100644 --- a/src/PhpSpreadsheet/Writer/Ods/MetaInf.php +++ b/src/PhpSpreadsheet/Writer/Ods/MetaInf.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class MetaInf extends WriterPart { /** - * Write META-INF/manifest.xml to XML format + * Write META-INF/manifest.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeManifest(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/Mimetype.php b/src/PhpSpreadsheet/Writer/Ods/Mimetype.php index 8afa8dc3..5a10d337 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Mimetype.php +++ b/src/PhpSpreadsheet/Writer/Ods/Mimetype.php @@ -18,16 +18,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Mimetype extends WriterPart { /** - * Write mimetype to plain text format + * Write mimetype to plain text format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function write(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/Settings.php b/src/PhpSpreadsheet/Writer/Ods/Settings.php index d1812422..c32c2c5a 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Settings.php +++ b/src/PhpSpreadsheet/Writer/Ods/Settings.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Settings extends WriterPart { /** - * Write settings.xml to XML format + * Write settings.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function write(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/Styles.php b/src/PhpSpreadsheet/Writer/Ods/Styles.php index 3f73c1ee..333f813e 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Styles.php +++ b/src/PhpSpreadsheet/Writer/Ods/Styles.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Styles extends WriterPart { /** - * Write styles.xml to XML format + * Write styles.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function write(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php b/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php index 964506cd..f8fb2b72 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php +++ b/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Thumbnails extends WriterPart { /** - * Write Thumbnails/thumbnail.png to PNG format + * Write Thumbnails/thumbnail.png to PNG format. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeThumbnail(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Ods/WriterPart.php b/src/PhpSpreadsheet/Writer/Ods/WriterPart.php index f4dfcb8f..647aca37 100644 --- a/src/PhpSpreadsheet/Writer/Ods/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Ods/WriterPart.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ diff --git a/src/PhpSpreadsheet/Writer/PDF.php b/src/PhpSpreadsheet/Writer/PDF.php index 6b9e6328..e7edcc45 100644 --- a/src/PhpSpreadsheet/Writer/PDF.php +++ b/src/PhpSpreadsheet/Writer/PDF.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; use PhpOffice\PhpSpreadsheet\Spreadsheet; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,22 +22,24 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class PDF implements IWriter { /** - * The wrapper for the requested PDF rendering engine + * The wrapper for the requested PDF rendering engine. * * @var PDF\Core */ private $renderer = null; /** - * Instantiate a new renderer of the configured type within this container class + * Instantiate a new renderer of the configured type within this container class. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object + * * @throws Exception when PDF library is not configured */ public function __construct(Spreadsheet $spreadsheet) @@ -66,6 +68,7 @@ class PDF implements IWriter * * @param string $name Renderer library method name * @param mixed[] $arguments Array of arguments to pass to the renderer method + * * @return mixed Returned data from the PDF renderer wrapper method */ public function __call($name, $arguments) diff --git a/src/PhpSpreadsheet/Writer/PDF/Core.php b/src/PhpSpreadsheet/Writer/PDF/Core.php index 2ddef1ee..3481697d 100644 --- a/src/PhpSpreadsheet/Writer/PDF/Core.php +++ b/src/PhpSpreadsheet/Writer/PDF/Core.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,48 +20,49 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML { /** - * Temporary storage directory + * Temporary storage directory. * * @var string */ protected $tempDir = ''; /** - * Font + * Font. * * @var string */ protected $font = 'freesans'; /** - * Orientation (Over-ride) + * Orientation (Over-ride). * * @var string */ protected $orientation; /** - * Paper size (Over-ride) + * Paper size (Over-ride). * * @var int */ protected $paperSize; /** - * Temporary storage for Save Array Return type + * Temporary storage for Save Array Return type. * * @var string */ private $saveArrayReturnType; /** - * Paper Sizes xRef List + * Paper Sizes xRef List. * * @var array */ @@ -135,7 +136,7 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML ]; /** - * Create a new PDF Writer instance + * Create a new PDF Writer instance. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object */ @@ -147,7 +148,7 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Get Font + * Get Font. * * @return string */ @@ -161,7 +162,7 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML * 'arialunicid0-chinese-simplified' * 'arialunicid0-chinese-traditional' * 'arialunicid0-korean' - * 'arialunicid0-japanese' + * 'arialunicid0-japanese'. * * @param string $fontName */ @@ -173,7 +174,7 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Get Paper Size + * Get Paper Size. * * @return int */ @@ -183,9 +184,10 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Set Paper Size + * Set Paper Size. * * @param string $pValue Paper size + * * @return self */ public function setPaperSize($pValue = \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER) @@ -196,7 +198,7 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Get Orientation + * Get Orientation. * * @return string */ @@ -206,9 +208,10 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Set Orientation + * Set Orientation. * * @param string $pValue Page orientation + * * @return self */ public function setOrientation($pValue = \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_DEFAULT) @@ -219,7 +222,7 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Get temporary storage directory + * Get temporary storage directory. * * @return string */ @@ -229,10 +232,12 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Set temporary storage directory + * Set temporary storage directory. * * @param string $pValue Temporary storage directory + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception when directory does not exist + * * @return self */ public function setTempDir($pValue = '') @@ -247,9 +252,10 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Save Spreadsheet to PDF file, pre-save + * Save Spreadsheet to PDF file, pre-save. * * @param string $pFilename Name of the file to save as + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ protected function prepareForSave($pFilename = null) @@ -275,9 +281,10 @@ abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML } /** - * Save PhpSpreadsheet to PDF file, post-save + * Save PhpSpreadsheet to PDF file, post-save. * * @param resource $fileHandle + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ protected function restoreStateAfterSave($fileHandle) diff --git a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php index 5afcb43e..c2ded457 100644 --- a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class DomPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter { /** - * Create a new DomPDF Writer instance + * Create a new DomPDF Writer instance. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object */ @@ -44,9 +45,10 @@ class DomPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter } /** - * Save Spreadsheet to file + * Save Spreadsheet to file. * * @param string $pFilename Name of the file to save as + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) diff --git a/src/PhpSpreadsheet/Writer/PDF/MPDF.php b/src/PhpSpreadsheet/Writer/PDF/MPDF.php index 8e29d6e4..dbabe710 100644 --- a/src/PhpSpreadsheet/Writer/PDF/MPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/MPDF.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class MPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter { /** - * Create a mPDF Writer instance + * Create a mPDF Writer instance. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object */ @@ -44,9 +45,10 @@ class MPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter } /** - * Save Spreadsheet to file + * Save Spreadsheet to file. * * @param string $pFilename Name of the file to save as + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) diff --git a/src/PhpSpreadsheet/Writer/PDF/TcPDF.php b/src/PhpSpreadsheet/Writer/PDF/TcPDF.php index f0c506af..396714ab 100644 --- a/src/PhpSpreadsheet/Writer/PDF/TcPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/TcPDF.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class TcPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter { /** - * Create a new tcPDF Writer instance + * Create a new tcPDF Writer instance. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object */ @@ -45,9 +46,10 @@ class TcPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter } /** - * Save Spreadsheet to file + * Save Spreadsheet to file. * * @param string $pFilename Name of the file to save as + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index 3c1ba66e..57dd2417 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,34 +20,35 @@ namespace PhpOffice\PhpSpreadsheet\Writer; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Xls extends BaseWriter implements IWriter { /** - * PhpSpreadsheet object + * PhpSpreadsheet object. * * @var \PhpOffice\PhpSpreadsheet\Spreadsheet */ private $spreadsheet; /** - * Total number of shared strings in workbook + * Total number of shared strings in workbook. * * @var int */ private $strTotal = 0; /** - * Number of unique shared strings in workbook + * Number of unique shared strings in workbook. * * @var int */ private $strUnique = 0; /** - * Array of unique shared strings in workbook + * Array of unique shared strings in workbook. * * @var array */ @@ -61,7 +62,7 @@ class Xls extends BaseWriter implements IWriter private $colors; /** - * Formula parser + * Formula parser. * * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser */ @@ -75,21 +76,21 @@ class Xls extends BaseWriter implements IWriter private $IDCLs; /** - * Basic OLE object summary information + * Basic OLE object summary information. * * @var array */ private $summaryInformation; /** - * Extended OLE object document summary information + * Extended OLE object document summary information. * * @var array */ private $documentSummaryInformation; /** - * Create a new Xls Writer + * Create a new Xls Writer. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object */ @@ -101,14 +102,14 @@ class Xls extends BaseWriter implements IWriter } /** - * Save Spreadsheet to file + * Save Spreadsheet to file. * * @param string $pFilename + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) { - // garbage collect $this->spreadsheet->garbageCollect(); @@ -216,7 +217,7 @@ class Xls extends BaseWriter implements IWriter } /** - * Build the Worksheet Escher objects + * Build the Worksheet Escher objects. */ private function buildWorksheetEschers() { @@ -378,7 +379,7 @@ class Xls extends BaseWriter implements IWriter } /** - * Build the Escher object corresponding to the MSODRAWINGGROUP record + * Build the Escher object corresponding to the MSODRAWINGGROUP record. */ private function buildWorkbookEscher() { @@ -519,7 +520,8 @@ class Xls extends BaseWriter implements IWriter } /** - * Build the OLE Part for DocumentSummary Information + * Build the OLE Part for DocumentSummary Information. + * * @return string */ private function writeDocumentSummaryInformation() @@ -733,7 +735,8 @@ class Xls extends BaseWriter implements IWriter } /** - * Build the OLE Part for Summary Information + * Build the OLE Part for Summary Information. + * * @return string */ private function writeSummaryInformation() @@ -904,9 +907,8 @@ class Xls extends BaseWriter implements IWriter $dataSection_Content .= $dataProp['data']['data']; $dataSection_Content_Offset += 4 + 8; - } else { - // Data Type Not Used at the moment } + // Data Type Not Used at the moment } // Now $dataSection_Content_Offset contains the size of the content diff --git a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php index 8d29109b..e5d16cd3 100644 --- a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -60,32 +61,37 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; class BIFFwriter { /** - * The byte order of this architecture. 0 => little endian, 1 => big endian + * The byte order of this architecture. 0 => little endian, 1 => big endian. + * * @var int */ private static $byteOrder; /** - * The string containing the data of the BIFF stream + * The string containing the data of the BIFF stream. + * * @var string */ public $_data; /** - * The size of the data in bytes. Should be the same as strlen($this->_data) + * The size of the data in bytes. Should be the same as strlen($this->_data). + * * @var int */ public $_datasize; /** - * The maximum length for a BIFF record (excluding record header and length field). See addContinue() + * The maximum length for a BIFF record (excluding record header and length field). See addContinue(). + * * @var int + * * @see addContinue() */ private $limit = 8224; /** - * Constructor + * Constructor. */ public function __construct() { @@ -120,7 +126,7 @@ class BIFFwriter } /** - * General storage function + * General storage function. * * @param string $data binary data to append */ @@ -134,9 +140,10 @@ class BIFFwriter } /** - * General storage function like append, but returns string instead of modifying $this->_data + * General storage function like append, but returns string instead of modifying $this->_data. * * @param string $data binary data to write + * * @return string */ public function writeData($data) @@ -153,8 +160,8 @@ class BIFFwriter * Writes Excel BOF record to indicate the beginning of a stream or * sub-stream in the BIFF file. * - * @param int $type Type of BIFF file to write: 0x0005 Workbook, - * 0x0010 Worksheet. + * @param int $type type of BIFF file to write: 0x0005 Workbook, + * 0x0010 Worksheet */ protected function storeBof($type) { @@ -207,6 +214,7 @@ class BIFFwriter * necessary. * * @param string $data The original binary data to be written + * * @return string A very convenient string of continue blocks */ private function addContinue($data) diff --git a/src/PhpSpreadsheet/Writer/Xls/Escher.php b/src/PhpSpreadsheet/Writer/Xls/Escher.php index 66bc8ecb..3071eeb5 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Escher.php +++ b/src/PhpSpreadsheet/Writer/Xls/Escher.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,23 +20,24 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Escher { /** - * The object we are writing + * The object we are writing. */ private $object; /** - * The written binary data + * The written binary data. */ private $data; /** - * Shape offsets. Positions in binary stream where a new shape record begins + * Shape offsets. Positions in binary stream where a new shape record begins. * * @var array */ @@ -50,9 +51,10 @@ class Escher private $spTypes; /** - * Constructor + * Constructor. * * @param mixed + * @param mixed $object */ public function __construct($object) { @@ -60,7 +62,8 @@ class Escher } /** - * Process the object to be written + * Process the object to be written. + * * @return string */ public function close() @@ -240,7 +243,6 @@ class Escher $this->data .= $innerData; break; - case \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE::BLIPTYPE_PNG: // initialize $innerData = ''; @@ -491,7 +493,7 @@ class Escher } /** - * Gets the shape offsets + * Gets the shape offsets. * * @return array */ @@ -501,7 +503,7 @@ class Escher } /** - * Gets the shape types + * Gets the shape types. * * @return array */ diff --git a/src/PhpSpreadsheet/Writer/Xls/Font.php b/src/PhpSpreadsheet/Writer/Xls/Font.php index 97066431..e4ecea91 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Font.php +++ b/src/PhpSpreadsheet/Writer/Xls/Font.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,28 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Font { /** - * Color index + * Color index. * * @var int */ private $colorIndex; /** - * Font + * Font. * * @var \PhpOffice\PhpSpreadsheet\Style\Font */ private $font; /** - * Constructor + * Constructor. * * @param \PhpOffice\PhpSpreadsheet\Style\Font $font */ @@ -51,7 +52,7 @@ class Font } /** - * Set the color index + * Set the color index. * * @param int $colorIndex */ @@ -61,7 +62,7 @@ class Font } /** - * Get font record data + * Get font record data. * * @return string */ @@ -122,9 +123,10 @@ class Font } /** - * Map to BIFF5-BIFF8 codes for bold + * Map to BIFF5-BIFF8 codes for bold. * * @param bool $bold + * * @return int */ private static function mapBold($bold) @@ -137,7 +139,8 @@ class Font } /** - * Map of BIFF2-BIFF8 codes for underline styles + * Map of BIFF2-BIFF8 codes for underline styles. + * * @static array of int */ private static $mapUnderline = [ @@ -149,9 +152,11 @@ class Font ]; /** - * Map underline + * Map underline. * * @param string + * @param mixed $underline + * * @return int */ private static function mapUnderline($underline) diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index e4ffea19..cec97823 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -64,49 +65,56 @@ class Parser const REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+'; /** - * The index of the character we are currently looking at + * The index of the character we are currently looking at. + * * @var int */ public $currentCharacter; /** * The token we are working on. + * * @var string */ public $currentToken; /** - * The formula to parse + * The formula to parse. + * * @var string */ private $formula; /** - * The character ahead of the current char + * The character ahead of the current char. + * * @var string */ public $lookAhead; /** - * The parse tree to be generated + * The parse tree to be generated. + * * @var string */ private $parseTree; /** - * Array of external sheets + * Array of external sheets. + * * @var array */ private $externalSheets; /** - * Array of sheet references in the form of REF structures + * Array of sheet references in the form of REF structures. + * * @var array */ public $references; /** - * The class constructor + * The class constructor. */ public function __construct() { @@ -495,7 +503,8 @@ class Parser /** * Convert a token to the proper ptg value. * - * @param mixed $token The token to convert. + * @param mixed $token the token to convert + * * @return mixed the converted token on success */ private function convert($token) @@ -543,7 +552,7 @@ class Parser } /** - * Convert a number token to ptgInt or ptgNum + * Convert a number token to ptgInt or ptgNum. * * @param mixed $num an integer or double for conversion to its ptg value */ @@ -552,19 +561,19 @@ class Parser // Integer in the range 0..2**16-1 if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) { return pack('Cv', $this->ptg['ptgInt'], $num); - } else { // A float + } // A float if (BIFFwriter::getByteOrder()) { // if it's Big Endian $num = strrev($num); } - return pack('Cd', $this->ptg['ptgNum'], $num); - } + return pack('Cd', $this->ptg['ptgNum'], $num); } /** - * Convert a string token to ptgStr + * Convert a string token to ptgStr. + * + * @param string $string a string for conversion to its ptg value * - * @param string $string A string for conversion to its ptg value. * @return mixed the converted token on success */ private function convertString($string) @@ -582,8 +591,9 @@ class Parser * Convert a function to a ptgFunc or ptgFuncVarV depending on the number of * args that it takes. * - * @param string $token The name of the function for convertion to ptg value. - * @param int $num_args The number of arguments the function receives. + * @param string $token the name of the function for convertion to ptg value + * @param int $num_args the number of arguments the function receives + * * @return string The packed ptg for the function */ private function convertFunction($token, $num_args) @@ -608,7 +618,6 @@ class Parser */ private function convertRange2d($range, $class = 0) { - // TODO: possible class value 0,1,2 check Formula.pm // Split the range into 2 cell refs if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) { @@ -641,8 +650,9 @@ class Parser * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to * a ptgArea3d. * - * @param string $token An Excel range in the Sheet1!A1:A2 format. - * @return mixed The packed ptgArea3d token on success. + * @param string $token an Excel range in the Sheet1!A1:A2 format + * + * @return mixed the packed ptgArea3d token on success */ private function convertRange3d($token) { @@ -673,6 +683,7 @@ class Parser * Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV. * * @param string $cell An Excel cell reference + * * @return string The cell in packed() format with the corresponding ptg */ private function convertRef2d($cell) @@ -692,7 +703,8 @@ class Parser * ptgRef3d. * * @param string $cell An Excel cell reference - * @return mixed The packed ptgRef3d token on success. + * + * @return mixed the packed ptgRef3d token on success */ private function convertRef3d($cell) { @@ -712,9 +724,10 @@ class Parser } /** - * Convert an error code to a ptgErr + * Convert an error code to a ptgErr. * * @param string $errorCode The error code for conversion to its ptg value + * * @return string The error code ptgErr */ private function convertError($errorCode) @@ -744,6 +757,7 @@ class Parser * "Sheet1:Sheet2", to a packed structure. * * @param string $ext_ref The name of the external reference + * * @return string The reference index in packed() format */ private function packExtRef($ext_ref) @@ -788,6 +802,7 @@ class Parser * array. It assumes all sheet names given must exist. * * @param string $ext_ref The name of the external reference + * * @return mixed The reference index in packed() format on success */ private function getRefIndex($ext_ref) @@ -847,15 +862,16 @@ class Parser * \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook class. * * @param string $sheet_name Sheet name + * * @return int The sheet index, -1 if the sheet was not found */ private function getSheetIndex($sheet_name) { if (!isset($this->externalSheets[$sheet_name])) { return -1; - } else { - return $this->externalSheets[$sheet_name]; } + + return $this->externalSheets[$sheet_name]; } /** @@ -864,6 +880,7 @@ class Parser * \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook class. * * @see \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook::addWorksheet() + * * @param string $name The name of the worksheet being added * @param int $index The index of the worksheet being added */ @@ -876,6 +893,7 @@ class Parser * pack() row and column into the required 3 or 4 byte format. * * @param string $cell The Excel cell reference to be packed + * * @return array Array containing the row and column in packed() format */ private function cellToPackedRowcol($cell) @@ -901,9 +919,10 @@ class Parser /** * pack() row range into the required 3 or 4 byte format. - * Just using maximum col/rows, which is probably not the correct solution + * Just using maximum col/rows, which is probably not the correct solution. * * @param string $range The Excel range to be packed + * * @return array Array containing (row1,col1,row2,col2) in packed() format */ private function rangeToPackedRange($range) @@ -943,7 +962,8 @@ class Parser * indexed row and column number. Also returns two (0,1) values to indicate * whether the row or column are relative references. * - * @param string $cell The Excel cell reference in A1 format. + * @param string $cell the Excel cell reference in A1 format + * * @return array */ private function cellToRowcol($cell) @@ -960,7 +980,7 @@ class Parser $col = 0; $col_ref_length = strlen($col_ref); for ($i = 0; $i < $col_ref_length; ++$i) { - $col += (ord($col_ref{$i}) - 64) * pow(26, $expn); + $col += (ord($col_ref[$i]) - 64) * pow(26, $expn); --$expn; } @@ -980,21 +1000,21 @@ class Parser $formula_length = strlen($this->formula); // eat up white spaces if ($i < $formula_length) { - while ($this->formula{$i} == ' ') { + while ($this->formula[$i] == ' ') { ++$i; } if ($i < ($formula_length - 1)) { - $this->lookAhead = $this->formula{$i + 1}; + $this->lookAhead = $this->formula[$i + 1]; } $token = ''; } while ($i < $formula_length) { - $token .= $this->formula{$i}; + $token .= $this->formula[$i]; if ($i < ($formula_length - 1)) { - $this->lookAhead = $this->formula{$i + 1}; + $this->lookAhead = $this->formula[$i + 1]; } else { $this->lookAhead = ''; } @@ -1007,7 +1027,7 @@ class Parser } if ($i < ($formula_length - 2)) { - $this->lookAhead = $this->formula{$i + 2}; + $this->lookAhead = $this->formula[$i + 2]; } else { // if we run out of characters lookAhead becomes empty $this->lookAhead = ''; } @@ -1019,7 +1039,8 @@ class Parser /** * Checks if it's a valid token. * - * @param mixed $token The token to check. + * @param mixed $token the token to check + * * @return mixed The checked token or false on failure */ private function match($token) @@ -1101,15 +1122,16 @@ class Parser /** * The parsing method. It parses a formula. * - * @param string $formula The formula to parse, without the initial equal - * sign (=). + * @param string $formula the formula to parse, without the initial equal + * sign (=) + * * @return mixed true on success */ public function parse($formula) { $this->currentCharacter = 0; $this->formula = $formula; - $this->lookAhead = isset($formula{1}) ? $formula{1} + $this->lookAhead = isset($formula[1]) ? $formula[1] : ''; $this->advance(); $this->parseTree = $this->condition(); @@ -1119,7 +1141,7 @@ class Parser /** * It parses a condition. It assumes the following rule: - * Cond -> Expr [(">" | "<") Expr] + * Cond -> Expr [(">" | "<") Expr]. * * @return mixed The parsed ptg'd tree on success */ @@ -1165,7 +1187,7 @@ class Parser * -> "string" * -> "-" Term : Negative value * -> "+" Term : Positive value - * -> Error code + * -> Error code. * * @return mixed The parsed ptg'd tree on success */ @@ -1209,7 +1231,6 @@ class Parser while (($this->currentToken == '+') or ($this->currentToken == '-') or ($this->currentToken == '^')) { - /**/ if ($this->currentToken == '+') { $this->advance(); $result2 = $this->term(); @@ -1233,6 +1254,7 @@ class Parser * doesn't get confused when working with a parenthesized formula afterwards. * * @see fact() + * * @return array The parsed ptg'd tree */ private function parenthesizedExpression() @@ -1244,7 +1266,7 @@ class Parser /** * It parses a term. It assumes the following rule: - * Term -> Fact [("*" | "/") Fact] + * Term -> Fact [("*" | "/") Fact]. * * @return mixed The parsed ptg'd tree on success */ @@ -1253,7 +1275,6 @@ class Parser $result = $this->fact(); while (($this->currentToken == '*') or ($this->currentToken == '/')) { - /**/ if ($this->currentToken == '*') { $this->advance(); $result2 = $this->fact(); @@ -1274,7 +1295,7 @@ class Parser * | CellRef * | CellRange * | Number - * | Function + * | Function. * * @return mixed The parsed ptg'd tree on success */ @@ -1351,7 +1372,7 @@ class Parser /** * It parses a function call. It assumes the following rule: - * Func -> ( Expr [,Expr]* ) + * Func -> ( Expr [,Expr]* ). * * @return mixed The parsed ptg'd tree on success */ @@ -1363,7 +1384,6 @@ class Parser $this->advance(); $this->advance(); // eat the "(" while ($this->currentToken != ')') { - /**/ if ($num_args > 0) { if ($this->currentToken == ',' || $this->currentToken == ';') { $this->advance(); // eat the "," or ";" @@ -1396,9 +1416,10 @@ class Parser * Creates a tree. In fact an array which may have one or two arrays (sub-trees) * as elements. * - * @param mixed $value The value of this node. - * @param mixed $left The left array (sub-tree) or a final node. - * @param mixed $right The right array (sub-tree) or a final node. + * @param mixed $value the value of this node + * @param mixed $left the left array (sub-tree) or a final node + * @param mixed $right the right array (sub-tree) or a final node + * * @return array A tree */ private function createTree($value, $left, $right) @@ -1409,7 +1430,7 @@ class Parser /** * Builds a string containing the tree in reverse polish notation (What you * would use in a HP calculator stack). - * The following tree: + * The following tree:. * * + * / \ @@ -1429,7 +1450,8 @@ class Parser * * In fact all operands, functions, references, etc... are written as ptg's * - * @param array $tree The optional tree to convert. + * @param array $tree the optional tree to convert + * * @return string The tree in reverse polish notation */ public function toReversePolish($tree = []) @@ -1467,9 +1489,9 @@ class Parser } // add it's left subtree and return. return $left_tree . $this->convertFunction($tree['value'], $tree['right']); - } else { - $converted_tree = $this->convert($tree['value']); } + $converted_tree = $this->convert($tree['value']); + $polish .= $converted_tree; return $polish; diff --git a/src/PhpSpreadsheet/Writer/Xls/Workbook.php b/src/PhpSpreadsheet/Writer/Xls/Workbook.php index e8a60f90..9419fbab 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xls/Workbook.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -61,7 +62,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; class Workbook extends BIFFwriter { /** - * Formula parser + * Formula parser. * * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser */ @@ -69,118 +70,125 @@ class Workbook extends BIFFwriter /** * The BIFF file size for the workbook. + * * @var int + * * @see calcSheetOffsets() */ private $biffSize; /** - * XF Writers + * XF Writers. + * * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Xf[] */ private $xfWriters = []; /** - * Array containing the colour palette + * Array containing the colour palette. + * * @var array */ private $palette; /** - * The codepage indicates the text encoding used for strings + * The codepage indicates the text encoding used for strings. + * * @var int */ private $codepage; /** - * The country code used for localization + * The country code used for localization. + * * @var int */ private $countryCode; /** - * Workbook + * Workbook. + * * @var \PhpOffice\PhpSpreadsheet\Spreadsheet */ private $spreadsheet; /** - * Fonts writers + * Fonts writers. * * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Font[] */ private $fontWriters = []; /** - * Added fonts. Maps from font's hash => index in workbook + * Added fonts. Maps from font's hash => index in workbook. * * @var array */ private $addedFonts = []; /** - * Shared number formats + * Shared number formats. * * @var array */ private $numberFormats = []; /** - * Added number formats. Maps from numberFormat's hash => index in workbook + * Added number formats. Maps from numberFormat's hash => index in workbook. * * @var array */ private $addedNumberFormats = []; /** - * Sizes of the binary worksheet streams + * Sizes of the binary worksheet streams. * * @var array */ private $worksheetSizes = []; /** - * Offsets of the binary worksheet streams relative to the start of the global workbook stream + * Offsets of the binary worksheet streams relative to the start of the global workbook stream. * * @var array */ private $worksheetOffsets = []; /** - * Total number of shared strings in workbook + * Total number of shared strings in workbook. * * @var int */ private $stringTotal; /** - * Number of unique shared strings in workbook + * Number of unique shared strings in workbook. * * @var int */ private $stringUnique; /** - * Array of unique shared strings in workbook + * Array of unique shared strings in workbook. * * @var array */ private $stringTable; /** - * Color cache + * Color cache. */ private $colors; /** - * Escher object corresponding to MSODRAWINGGROUP + * Escher object corresponding to MSODRAWINGGROUP. * * @var \PhpOffice\PhpSpreadsheet\Shared\Escher */ private $escher; /** - * Class constructor + * Class constructor. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet The Workbook * @param int $str_total Total number of strings @@ -228,10 +236,13 @@ class Workbook extends BIFFwriter } /** - * Add a new XF writer + * Add a new XF writer. * * @param \PhpOffice\PhpSpreadsheet\Style * @param bool Is it a style XF? + * @param mixed $style + * @param mixed $isStyleXf + * * @return int Index to XF record */ public function addXfWriter($style, $isStyleXf = false) @@ -280,9 +291,10 @@ class Workbook extends BIFFwriter } /** - * Add a font to added fonts + * Add a font to added fonts. * * @param \PhpOffice\PhpSpreadsheet\Style\Font $font + * * @return int Index to FONT record */ public function addFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) @@ -305,9 +317,10 @@ class Workbook extends BIFFwriter } /** - * Alter color palette adding a custom color + * Alter color palette adding a custom color. * * @param string $rgb E.g. 'FF00AA' + * * @return int Color index */ private function addColor($rgb) @@ -406,6 +419,7 @@ class Workbook extends BIFFwriter * storage. * * @param array $pWorksheetSizes The sizes in bytes of the binary worksheet streams + * * @return string Binary data for workbook stream */ public function writeWorkbook($pWorksheetSizes = null) @@ -492,7 +506,7 @@ class Workbook extends BIFFwriter } /** - * Store user defined numerical formats i.e. FORMAT records + * Store user defined numerical formats i.e. FORMAT records. */ private function writeAllNumberFormats() { @@ -629,7 +643,7 @@ class Workbook extends BIFFwriter /** * Writes all the DEFINEDNAME records (BIFF8). - * So far this is only used for repeating rows/columns (print titles) and print areas + * So far this is only used for repeating rows/columns (print titles) and print areas. */ private function writeAllDefinedNamesBiff8() { @@ -656,7 +670,7 @@ class Workbook extends BIFFwriter $formulaData = $this->parser->toReversePolish(); // make sure tRef3d is of type tRef3dR (0x3A) - if (isset($formulaData{0}) and ($formulaData{0} == "\x7A" or $formulaData{0} == "\x5A")) { + if (isset($formulaData[0]) and ($formulaData[0] == "\x7A" or $formulaData[0] == "\x5A")) { $formulaData = "\x3A" . substr($formulaData, 1); } @@ -778,12 +792,13 @@ class Workbook extends BIFFwriter } /** - * Write a DEFINEDNAME record for BIFF8 using explicit binary formula data + * Write a DEFINEDNAME record for BIFF8 using explicit binary formula data. * * @param string $name The name in UTF-8 * @param string $formulaData The binary formula data * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global * @param bool $isBuiltIn Built-in name? + * * @return string Complete binary record data */ private function writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false) @@ -813,12 +828,13 @@ class Workbook extends BIFFwriter } /** - * Write a short NAME record + * Write a short NAME record. * * @param string $name * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global * @param integer[][] $rangeBounds range boundaries * @param bool $isHidden + * * @return string Complete binary record data * */ private function writeShortNameBiff8($name, $sheetIndex, $rangeBounds, $isHidden = false) @@ -936,7 +952,7 @@ class Workbook extends BIFFwriter } /** - * Write Internal SUPBOOK record + * Write Internal SUPBOOK record. */ private function writeSupbookInternal() { @@ -1131,7 +1147,7 @@ class Workbook extends BIFFwriter * Store the NAME record in the long format that is used for storing the repeat * rows and columns when both are specified. This shares a lot of code with * writeNameShort() but we use a separate method to keep the code clean. - * Code abstraction for reuse can be carried too far, and I should know. ;-) + * Code abstraction for reuse can be carried too far, and I should know. ;-). * * @param int $index Sheet index * @param int $type Built-in name type @@ -1211,7 +1227,7 @@ class Workbook extends BIFFwriter } /** - * Stores the COUNTRY record for localization + * Stores the COUNTRY record for localization. * * @return string */ @@ -1228,7 +1244,7 @@ class Workbook extends BIFFwriter } /** - * Write the RECALCID record + * Write the RECALCID record. * * @return string */ @@ -1408,13 +1424,13 @@ class Workbook extends BIFFwriter $header = pack('vv', $record, $length); return $this->writeData($header . $data); - } else { - return ''; } + + return ''; } /** - * Get Escher object + * Get Escher object. * * @return \PhpOffice\PhpSpreadsheet\Shared\Escher */ @@ -1424,7 +1440,7 @@ class Workbook extends BIFFwriter } /** - * Set Escher object + * Set Escher object. * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue */ diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index 5602928a..93edaea1 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -61,129 +62,145 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; class Worksheet extends BIFFwriter { /** - * Formula parser + * Formula parser. * * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser */ private $parser; /** - * Maximum number of characters for a string (LABEL record in BIFF5) + * Maximum number of characters for a string (LABEL record in BIFF5). + * * @var int */ private $xlsStringMaxLength; /** - * Array containing format information for columns + * Array containing format information for columns. + * * @var array */ private $columnInfo; /** - * Array containing the selected area for the worksheet + * Array containing the selected area for the worksheet. + * * @var array */ private $selection; /** - * The active pane for the worksheet + * The active pane for the worksheet. + * * @var int */ private $activePane; /** * Whether to use outline. + * * @var int */ private $outlineOn; /** * Auto outline styles. + * * @var bool */ private $outlineStyle; /** * Whether to have outline summary below. + * * @var bool */ private $outlineBelow; /** * Whether to have outline summary at the right. + * * @var bool */ private $outlineRight; /** - * Reference to the total number of strings in the workbook + * Reference to the total number of strings in the workbook. + * * @var int */ private $stringTotal; /** - * Reference to the number of unique strings in the workbook + * Reference to the number of unique strings in the workbook. + * * @var int */ private $stringUnique; /** - * Reference to the array containing all the unique strings in the workbook + * Reference to the array containing all the unique strings in the workbook. + * * @var array */ private $stringTable; /** - * Color cache + * Color cache. */ private $colors; /** - * Index of first used row (at least 0) + * Index of first used row (at least 0). + * * @var int */ private $firstRowIndex; /** - * Index of last used row. (no used rows means -1) + * Index of last used row. (no used rows means -1). + * * @var int */ private $lastRowIndex; /** - * Index of first used column (at least 0) + * Index of first used column (at least 0). + * * @var int */ private $firstColumnIndex; /** - * Index of last used column (no used columns means -1) + * Index of last used column (no used columns means -1). + * * @var int */ private $lastColumnIndex; /** - * Sheet object + * Sheet object. + * * @var \PhpOffice\PhpSpreadsheet\Worksheet */ public $phpSheet; /** - * Count cell style Xfs + * Count cell style Xfs. * * @var int */ private $countCellStyleXfs; /** - * Escher object corresponding to MSODRAWING + * Escher object corresponding to MSODRAWING. * * @var \PhpOffice\PhpSpreadsheet\Shared\Escher */ private $escher; /** - * Array of font hashes associated to FONT records index + * Array of font hashes associated to FONT records index. * * @var array */ @@ -200,7 +217,7 @@ class Worksheet extends BIFFwriter private $printHeaders; /** - * Constructor + * Constructor. * * @param int &$str_total Total number of strings * @param int &$str_unique Total number of unique strings @@ -425,21 +442,17 @@ class Worksheet extends BIFFwriter $this->writeString($row, $column, $cVal, $xfIndex); } break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC: $this->writeNumber($row, $column, $cVal, $xfIndex); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_FORMULA: $calculatedValue = $this->preCalculateFormulas ? $cell->getCalculatedValue() : null; $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_BOOL: $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex); break; - case \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ERROR: $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex); break; @@ -521,9 +534,10 @@ class Worksheet extends BIFFwriter /** * Write a cell range address in BIFF8 * always fixed range - * See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format + * See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format. * * @param string $range E.g. 'A1' or 'A1:B6' + * * @return string Binary data */ private function writeBIFF8CellRangeAddressFixed($range = 'A1') @@ -611,6 +625,7 @@ class Worksheet extends BIFFwriter * @param int $col Zero indexed column * @param float $num The number to write * @param mixed $xfIndex The optional XF format + * * @return int */ private function writeNumber($row, $col, $num, $xfIndex) @@ -631,7 +646,7 @@ class Worksheet extends BIFFwriter } /** - * Write a LABELSST record or a LABEL record. Which one depends on BIFF version + * Write a LABELSST record or a LABEL record. Which one depends on BIFF version. * * @param int $row Row index (0-based) * @param int $col Column index (0-based) @@ -646,6 +661,7 @@ class Worksheet extends BIFFwriter /** * Write a LABELSST record or a LABEL record. Which one depends on BIFF version * It differs from writeString by the writing of rich text strings. + * * @param int $row Row index (0-based) * @param int $col Column index (0-based) * @param string $str The string @@ -675,12 +691,13 @@ class Worksheet extends BIFFwriter * $format is optional. * Returns 0 : normal termination * -2 : row or column out of range - * -3 : long string truncated to 255 chars + * -3 : long string truncated to 255 chars. * * @param int $row Zero indexed row * @param int $col Zero indexed column * @param string $str The string to write * @param mixed $xfIndex The XF format index for the cell + * * @return int */ private function writeLabel($row, $col, $str, $xfIndex) @@ -711,12 +728,13 @@ class Worksheet extends BIFFwriter * $format is optional. * Returns 0 : normal termination * -2 : row or column out of range - * -3 : long string truncated to 255 chars + * -3 : long string truncated to 255 chars. * * @param int $row Zero indexed row * @param int $col Zero indexed column * @param string $str The string to write * @param mixed $xfIndex The XF format index for the cell + * * @return int */ private function writeLabelSst($row, $col, $str, $xfIndex) @@ -797,7 +815,7 @@ class Worksheet extends BIFFwriter } /** - * Write a boolean or an error type to the specified row and column (zero indexed) + * Write a boolean or an error type to the specified row and column (zero indexed). * * @param int $row Row index (0-based) * @param int $col Column index (0-based) @@ -831,6 +849,7 @@ class Worksheet extends BIFFwriter * @param string $formula The formula text string * @param mixed $xfIndex The XF format index * @param mixed $calculatedValue Calculated value + * * @return int */ private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue) @@ -875,7 +894,7 @@ class Worksheet extends BIFFwriter $unknown = 0x0000; // Must be zero // Strip the '=' or '@' sign at the beginning of the formula string - if ($formula{0} == '=') { + if ($formula[0] == '=') { $formula = substr($formula, 1); } else { // Error handling @@ -911,7 +930,7 @@ class Worksheet extends BIFFwriter } /** - * Write a STRING record. This + * Write a STRING record. This. * * @param string $stringValue */ @@ -944,6 +963,7 @@ class Worksheet extends BIFFwriter * @param int $row Row * @param int $col Column * @param string $url URL string + * * @return int */ private function writeUrl($row, $col, $url) @@ -959,11 +979,13 @@ class Worksheet extends BIFFwriter * (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1'). * * @see writeUrl() + * * @param int $row1 Start row * @param int $col1 Start column * @param int $row2 End row * @param int $col2 End column * @param string $url URL string + * * @return int */ public function writeUrlRange($row1, $col1, $row2, $col2, $url) @@ -985,11 +1007,13 @@ class Worksheet extends BIFFwriter * sheet. However it is differentiated by the $unknown2 data stream. * * @see writeUrl() + * * @param int $row1 Start row * @param int $col1 Start column * @param int $row2 End row * @param int $col2 End column * @param string $url URL string + * * @return int */ public function writeUrlWeb($row1, $col1, $row2, $col2, $url) @@ -1028,11 +1052,13 @@ class Worksheet extends BIFFwriter * Used to write internal reference hyperlinks such as "Sheet1!A1". * * @see writeUrl() + * * @param int $row1 Start row * @param int $col1 Start column * @param int $row2 End row * @param int $col2 End column * @param string $url URL string + * * @return int */ public function writeUrlInternal($row1, $col1, $row2, $col2, $url) @@ -1079,11 +1105,13 @@ class Worksheet extends BIFFwriter * these cases for the sake of simpler code. * * @see writeUrl() + * * @param int $row1 Start row * @param int $col1 Start column * @param int $row2 End row * @param int $col2 End column * @param string $url URL string + * * @return int */ public function writeUrlExternal($row1, $col1, $row2, $col2, $url) @@ -1332,7 +1360,7 @@ class Worksheet extends BIFFwriter } /** - * Write BIFF record COLINFO to define column widths + * Write BIFF record COLINFO to define column widths. * * Note: The SDK says the record length is 0x0B but Excel writes a 0x0C * length record. @@ -1451,7 +1479,7 @@ class Worksheet extends BIFFwriter } /** - * Store the MERGEDCELLS records for all ranges of merged cells + * Store the MERGEDCELLS records for all ranges of merged cells. */ private function writeMergedCells() { @@ -1505,7 +1533,7 @@ class Worksheet extends BIFFwriter } /** - * Write SHEETLAYOUT record + * Write SHEETLAYOUT record. */ private function writeSheetLayout() { @@ -1532,7 +1560,7 @@ class Worksheet extends BIFFwriter } /** - * Write SHEETPROTECTION + * Write SHEETPROTECTION. */ private function writeSheetProtection() { @@ -1576,7 +1604,7 @@ class Worksheet extends BIFFwriter } /** - * Write BIFF record RANGEPROTECTION + * Write BIFF record RANGEPROTECTION. * * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records @@ -2223,7 +2251,7 @@ class Worksheet extends BIFFwriter } /** - * Write SCENPROTECT + * Write SCENPROTECT. */ private function writeScenProtect() { @@ -2247,7 +2275,7 @@ class Worksheet extends BIFFwriter } /** - * Write OBJECTPROTECT + * Write OBJECTPROTECT. */ private function writeObjectProtect() { @@ -2297,8 +2325,8 @@ class Worksheet extends BIFFwriter * @param int $row The row we are going to insert the bitmap into * @param int $col The column we are going to insert the bitmap into * @param mixed $bitmap The bitmap filename or GD-image resource - * @param int $x The horizontal position (offset) of the image inside the cell. - * @param int $y The vertical position (offset) of the image inside the cell. + * @param int $x the horizontal position (offset) of the image inside the cell + * @param int $y the vertical position (offset) of the image inside the cell * @param float $scale_x The horizontal scale * @param float $scale_y The vertical scale */ @@ -2511,6 +2539,7 @@ class Worksheet extends BIFFwriter * Convert a GD-image into the internal format. * * @param resource $image The image to process + * * @return array Array with data and properties of the bitmap */ public function processBitmapGd($image) @@ -2541,6 +2570,7 @@ class Worksheet extends BIFFwriter * MSDN library. * * @param string $bitmap The bitmap to process + * * @return array Array with data and properties of the bitmap */ public function processBitmap($bitmap) @@ -2640,7 +2670,7 @@ class Worksheet extends BIFFwriter } /** - * Get Escher object + * Get Escher object. * * @return \PhpOffice\PhpSpreadsheet\Shared\Escher */ @@ -2650,7 +2680,7 @@ class Worksheet extends BIFFwriter } /** - * Set Escher object + * Set Escher object. * * @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue */ @@ -2660,7 +2690,7 @@ class Worksheet extends BIFFwriter } /** - * Write MSODRAWING record + * Write MSODRAWING record. */ private function writeMsoDrawing() { @@ -2936,9 +2966,10 @@ class Worksheet extends BIFFwriter } /** - * Map Error code + * Map Error code. * * @param string $errorCode + * * @return int */ private static function mapErrorCode($errorCode) @@ -2964,7 +2995,7 @@ class Worksheet extends BIFFwriter } /** - * Write PLV Record + * Write PLV Record. */ private function writePageLayoutView() { @@ -2995,7 +3026,8 @@ class Worksheet extends BIFFwriter } /** - * Write CFRule Record + * Write CFRule Record. + * * @param \PhpOffice\PhpSpreadsheet\Style\Conditional $conditional */ private function writeCFRule(\PhpOffice\PhpSpreadsheet\Style\Conditional $conditional) @@ -3042,7 +3074,7 @@ class Worksheet extends BIFFwriter // $szValue1 : size of the formula data for first value or formula // $szValue2 : size of the formula data for second value or formula $arrConditions = $conditional->getConditions(); - $numConditions = sizeof($arrConditions); + $numConditions = count($arrConditions); if ($numConditions == 1) { $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); $szValue2 = 0x0000; @@ -4172,7 +4204,7 @@ class Worksheet extends BIFFwriter } /** - * Write CFHeader record + * Write CFHeader record. */ private function writeCFHeader() { diff --git a/src/PhpSpreadsheet/Writer/Xls/Xf.php b/src/PhpSpreadsheet/Writer/Xls/Xf.php index 85021dde..14ae6c4c 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Xf.php +++ b/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xls; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -68,61 +69,70 @@ class Xf private $isStyleXf; /** - * Index to the FONT record. Index 4 does not exist + * Index to the FONT record. Index 4 does not exist. + * * @var int */ private $fontIndex; /** * An index (2 bytes) to a FORMAT record (number format). + * * @var int */ private $numberFormatIndex; /** * 1 bit, apparently not used. + * * @var int */ private $textJustLast; /** * The cell's foreground color. + * * @var int */ private $foregroundColor; /** * The cell's background color. + * * @var int */ private $backgroundColor; /** * Color of the bottom border of the cell. + * * @var int */ private $bottomBorderColor; /** * Color of the top border of the cell. + * * @var int */ private $topBorderColor; /** * Color of the left border of the cell. + * * @var int */ private $leftBorderColor; /** * Color of the right border of the cell. + * * @var int */ private $rightBorderColor; /** - * Constructor + * Constructor. * * @param \PhpOffice\PhpSpreadsheet\Style The XF format */ @@ -260,7 +270,7 @@ class Xf } /** - * Sets the cell's bottom border color + * Sets the cell's bottom border color. * * @param int $colorIndex Color index */ @@ -270,7 +280,7 @@ class Xf } /** - * Sets the cell's top border color + * Sets the cell's top border color. * * @param int $colorIndex Color index */ @@ -280,7 +290,7 @@ class Xf } /** - * Sets the cell's left border color + * Sets the cell's left border color. * * @param int $colorIndex Color index */ @@ -290,7 +300,7 @@ class Xf } /** - * Sets the cell's right border color + * Sets the cell's right border color. * * @param int $colorIndex Color index */ @@ -300,7 +310,7 @@ class Xf } /** - * Sets the cell's diagonal border color + * Sets the cell's diagonal border color. * * @param int $colorIndex Color index */ @@ -310,7 +320,7 @@ class Xf } /** - * Sets the cell's foreground color + * Sets the cell's foreground color. * * @param int $colorIndex Color index */ @@ -320,7 +330,7 @@ class Xf } /** - * Sets the cell's background color + * Sets the cell's background color. * * @param int $colorIndex Color index */ @@ -351,7 +361,8 @@ class Xf } /** - * Map of BIFF2-BIFF8 codes for border styles + * Map of BIFF2-BIFF8 codes for border styles. + * * @static array of int */ private static $mapBorderStyles = [ @@ -372,9 +383,10 @@ class Xf ]; /** - * Map border style + * Map border style. * * @param string $borderStyle + * * @return int */ private static function mapBorderStyle($borderStyle) @@ -387,7 +399,8 @@ class Xf } /** - * Map of BIFF2-BIFF8 codes for fill types + * Map of BIFF2-BIFF8 codes for fill types. + * * @static array of int */ private static $mapFillTypes = [ @@ -415,9 +428,10 @@ class Xf ]; /** - * Map fill type + * Map fill type. * * @param string $fillType + * * @return int */ private static function mapFillType($fillType) @@ -430,7 +444,8 @@ class Xf } /** - * Map of BIFF2-BIFF8 codes for horizontal alignment + * Map of BIFF2-BIFF8 codes for horizontal alignment. + * * @static array of int */ private static $mapHAlignments = [ @@ -444,9 +459,10 @@ class Xf ]; /** - * Map to BIFF2-BIFF8 codes for horizontal alignment + * Map to BIFF2-BIFF8 codes for horizontal alignment. * * @param string $hAlign + * * @return int */ private function mapHAlign($hAlign) @@ -459,7 +475,8 @@ class Xf } /** - * Map of BIFF2-BIFF8 codes for vertical alignment + * Map of BIFF2-BIFF8 codes for vertical alignment. + * * @static array of int */ private static $mapVAlignments = [ @@ -470,9 +487,10 @@ class Xf ]; /** - * Map to BIFF2-BIFF8 codes for vertical alignment + * Map to BIFF2-BIFF8 codes for vertical alignment. * * @param string $vAlign + * * @return int */ private static function mapVAlign($vAlign) @@ -485,9 +503,10 @@ class Xf } /** - * Map to BIFF8 codes for text rotation angle + * Map to BIFF8 codes for text rotation angle. * * @param int $textRotation + * * @return int */ private static function mapTextRotation($textRotation) @@ -502,9 +521,11 @@ class Xf } /** - * Map locked + * Map locked. * * @param string + * @param mixed $locked + * * @return int */ private static function mapLocked($locked) @@ -522,9 +543,11 @@ class Xf } /** - * Map hidden + * Map hidden. * * @param string + * @param mixed $hidden + * * @return int */ private static function mapHidden($hidden) diff --git a/src/PhpSpreadsheet/Writer/Xlsx.php b/src/PhpSpreadsheet/Writer/Xlsx.php index 2fad0646..a7910e22 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx.php +++ b/src/PhpSpreadsheet/Writer/Xlsx.php @@ -5,7 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; use PhpOffice\PhpSpreadsheet\Spreadsheet; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,90 +22,91 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Xlsx extends BaseWriter implements IWriter { /** - * Office2003 compatibility + * Office2003 compatibility. * * @var bool */ private $office2003compatibility = false; /** - * Private writer parts + * Private writer parts. * * @var Xlsx\WriterPart[] */ private $writerParts = []; /** - * Private Spreadsheet + * Private Spreadsheet. * * @var \PhpOffice\PhpSpreadsheet\Spreadsheet */ private $spreadSheet; /** - * Private string table + * Private string table. * * @var string[] */ private $stringTable = []; /** - * Private unique \PhpOffice\PhpSpreadsheet\Style\Conditional HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Style\Conditional HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $stylesConditionalHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Style HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Style HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $styleHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Style\Fill HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Style\Fill HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $fillHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Style\Font HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Style\Font HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $fontHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Style\Borders HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Style\Borders HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $bordersHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Style\NumberFormat HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Style\NumberFormat HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $numFmtHashTable; /** - * Private unique \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing HashTable + * Private unique \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing HashTable. * * @var \PhpOffice\PhpSpreadsheet\HashTable */ private $drawingHashTable; /** - * Create a new Xlsx Writer + * Create a new Xlsx Writer. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet */ @@ -148,24 +149,26 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get writer part + * Get writer part. * * @param string $pPartName Writer part name + * * @return \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart */ public function getWriterPart($pPartName = '') { if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) { return $this->writerParts[strtolower($pPartName)]; - } else { - return null; } + + return null; } /** - * Save PhpSpreadsheet to file + * Save PhpSpreadsheet to file. * * @param string $pFilename + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function save($pFilename = null) @@ -396,25 +399,25 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get Spreadsheet object + * Get Spreadsheet object. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return Spreadsheet */ public function getSpreadsheet() { if ($this->spreadSheet !== null) { return $this->spreadSheet; - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No Spreadsheet object assigned.'); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No Spreadsheet object assigned.'); } /** - * Set Spreadsheet object + * Set Spreadsheet object. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object - * @throws Exception + * * @return Xlsx */ public function setSpreadsheet(Spreadsheet $spreadsheet = null) @@ -425,7 +428,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get string table + * Get string table. * * @return string[] */ @@ -435,7 +438,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Style HashTable + * Get \PhpOffice\PhpSpreadsheet\Style HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -445,7 +448,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Style\Conditional HashTable + * Get \PhpOffice\PhpSpreadsheet\Style\Conditional HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -455,7 +458,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Style\Fill HashTable + * Get \PhpOffice\PhpSpreadsheet\Style\Fill HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -465,7 +468,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable + * Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -475,7 +478,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Style\Borders HashTable + * Get \PhpOffice\PhpSpreadsheet\Style\Borders HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -485,7 +488,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Style\NumberFormat HashTable + * Get \PhpOffice\PhpSpreadsheet\Style\NumberFormat HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -495,7 +498,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing HashTable + * Get \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing HashTable. * * @return \PhpOffice\PhpSpreadsheet\HashTable */ @@ -505,7 +508,7 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Get Office2003 compatibility + * Get Office2003 compatibility. * * @return bool */ @@ -515,9 +518,10 @@ class Xlsx extends BaseWriter implements IWriter } /** - * Set Office2003 compatibility + * Set Office2003 compatibility. * * @param bool $pValue Office2003 compatibility? + * * @return Xlsx */ public function setOffice2003Compatibility($pValue = false) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php index d59f6a13..828d26b8 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -12,7 +12,7 @@ use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\Title; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,7 @@ use PhpOffice\PhpSpreadsheet\Chart\Title; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ @@ -37,11 +38,13 @@ class Chart extends WriterPart protected $calculateCellValues; /** - * Write charts to XML format + * Write charts to XML format. * * @param \PhpOffice\PhpSpreadsheet\Chart $pChart + * @param mixed $calculateCellValues * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeChart(\PhpOffice\PhpSpreadsheet\Chart $pChart = null, $calculateCellValues = true) @@ -116,7 +119,7 @@ class Chart extends WriterPart } /** - * Write Chart Title + * Write Chart Title. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param Title $title @@ -161,7 +164,7 @@ class Chart extends WriterPart } /** - * Write Chart Legend + * Write Chart Legend. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param Legend $legend @@ -212,7 +215,7 @@ class Chart extends WriterPart } /** - * Write Chart Plot Area + * Write Chart Plot Area. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet @@ -269,7 +272,7 @@ class Chart extends WriterPart if ($chartType === DataSeries::TYPE_LINECHART) { // Line only, Line3D can't be smoothed $objWriter->startElement('c:smooth'); - $objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine()); + $objWriter->writeAttribute('val', (int) $plotGroup->getSmoothLine()); $objWriter->endElement(); } elseif (($chartType === DataSeries::TYPE_BARCHART) || ($chartType === DataSeries::TYPE_BARCHART_3D)) { $objWriter->startElement('c:gapWidth'); @@ -348,7 +351,7 @@ class Chart extends WriterPart } /** - * Write Data Labels + * Write Data Labels. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Chart\Layout $chartLayout Chart layout @@ -398,7 +401,7 @@ class Chart extends WriterPart } /** - * Write Category Axis + * Write Category Axis. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param PlotArea $plotArea @@ -407,6 +410,8 @@ class Chart extends WriterPart * @param string $id1 * @param string $id2 * @param bool $isMultiLevelSeries + * @param mixed $xAxis + * @param mixed $yAxis * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ @@ -519,7 +524,7 @@ class Chart extends WriterPart } /** - * Write Value Axis + * Write Value Axis. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param PlotArea $plotArea @@ -528,6 +533,10 @@ class Chart extends WriterPart * @param string $id1 * @param string $id2 * @param bool $isMultiLevelSeries + * @param mixed $xAxis + * @param mixed $yAxis + * @param mixed $majorGridlines + * @param mixed $minorGridlines * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ @@ -1005,11 +1014,12 @@ class Chart extends WriterPart } /** - * Get the data series type(s) for a chart plot series + * Get the data series type(s) for a chart plot series. * * @param PlotArea $plotArea * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string|array */ private static function getChartType($plotArea) @@ -1033,7 +1043,7 @@ class Chart extends WriterPart } /** - * Write Plot Group (series of related plots) + * Write Plot Group (series of related plots). * * @param DataSeries $plotGroup * @param string $groupType Type of plot for dataseries @@ -1212,7 +1222,7 @@ class Chart extends WriterPart } /** - * Write Plot Series Label + * Write Plot Series Label. * * @param DataSeriesValues $plotSeriesLabel * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer @@ -1247,7 +1257,7 @@ class Chart extends WriterPart } /** - * Write Plot Series Values + * Write Plot Series Values. * * @param DataSeriesValues $plotSeriesValues * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer @@ -1341,7 +1351,7 @@ class Chart extends WriterPart } /** - * Write Bubble Chart Details + * Write Bubble Chart Details. * * @param DataSeriesValues $plotSeriesValues * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer @@ -1388,7 +1398,7 @@ class Chart extends WriterPart } /** - * Write Layout + * Write Layout. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param Layout $layout @@ -1458,7 +1468,7 @@ class Chart extends WriterPart } /** - * Write Alternate Content block + * Write Alternate Content block. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @@ -1488,7 +1498,7 @@ class Chart extends WriterPart } /** - * Write Printer Settings + * Write Printer Settings. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php index 6842c6d3..b8a3e33a 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Comments extends WriterPart { /** - * Write comments to XML format + * Write comments to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null) @@ -82,12 +85,13 @@ class Comments extends WriterPart } /** - * Write comment to XML format + * Write comment to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference * @param \PhpOffice\PhpSpreadsheet\Comment $pComment Comment * @param array $pAuthors Array of authors + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeComment(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PhpOffice\PhpSpreadsheet\Comment $pComment = null, $pAuthors = null) @@ -106,10 +110,12 @@ class Comments extends WriterPart } /** - * Write VML comments to XML format + * Write VML comments to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null) @@ -178,11 +184,12 @@ class Comments extends WriterPart } /** - * Write VML comment to XML format + * Write VML comment to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference * @param \PhpOffice\PhpSpreadsheet\Comment $pComment Comment + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeVMLComment(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PhpOffice\PhpSpreadsheet\Comment $pComment = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php b/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php index 14bbc156..1ce7f868 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,20 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class ContentTypes extends WriterPart { /** - * Write content types to XML format + * Write content types to XML format. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeContentTypes(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet = null, $includeCharts = false) @@ -180,10 +183,12 @@ class ContentTypes extends WriterPart } /** - * Get image mime type + * Get image mime type. * * @param string $pFile Filename + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string Mime Type */ private function getImageMimeType($pFile = '') @@ -192,17 +197,17 @@ class ContentTypes extends WriterPart $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("File $pFile does not exist"); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("File $pFile does not exist"); } /** - * Write Default content type + * Write Default content type. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDefaultContentType(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') @@ -219,11 +224,12 @@ class ContentTypes extends WriterPart } /** - * Write Override content type + * Write Override content type. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeOverrideContentType(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') diff --git a/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php b/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php index 2fdcd857..7c3c3688 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class DocProps extends WriterPart { /** - * Write docProps/app.xml to XML format + * Write docProps/app.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeDocPropsApp(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -123,10 +126,12 @@ class DocProps extends WriterPart } /** - * Write docProps/core.xml to XML format + * Write docProps/core.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeDocPropsCore(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -190,10 +195,12 @@ class DocProps extends WriterPart } /** - * Write docProps/custom.xml to XML format + * Write docProps/custom.xml to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeDocPropsCustom(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php index ae8f1c36..3639bf1f 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,18 +20,21 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Drawing extends WriterPart { /** - * Write drawings to XML format + * Write drawings to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param bool $includeCharts Flag indicating if we should include drawing details for charts + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeDrawings(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false) @@ -79,11 +82,12 @@ class Drawing extends WriterPart } /** - * Write drawings to XML format + * Write drawings to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Chart $pChart * @param int $pRelationId + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function writeChart(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Chart $pChart = null, $pRelationId = -1) @@ -151,11 +155,12 @@ class Drawing extends WriterPart } /** - * Write drawings to XML format + * Write drawings to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing $pDrawing * @param int $pRelationId + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function writeDrawing(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing $pDrawing = null, $pRelationId = -1) @@ -328,10 +333,12 @@ class Drawing extends WriterPart } /** - * Write VML header/footer images to XML format + * Write VML header/footer images to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null) @@ -475,11 +482,12 @@ class Drawing extends WriterPart } /** - * Write VML comment to XML format + * Write VML comment to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pReference Reference * @param \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing $pImage Image + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeVMLHeaderFooterImage(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pReference = '', \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing $pImage = null) @@ -517,10 +525,12 @@ class Drawing extends WriterPart } /** - * Get an array of all drawings + * Get an array of all drawings. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Worksheet\Drawing[] All drawings in PhpSpreadsheet */ public function allDrawings(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Rels.php b/src/PhpSpreadsheet/Writer/Xlsx/Rels.php index 6da94117..df577943 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Rels.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Rels.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Rels extends WriterPart { /** - * Write relationships to XML format + * Write relationships to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -99,10 +102,12 @@ class Rels extends WriterPart } /** - * Write workbook relationships to XML format + * Write workbook relationships to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeWorkbookRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -174,7 +179,7 @@ class Rels extends WriterPart } /** - * Write worksheet relationships to XML format + * Write worksheet relationships to XML format. * * Numbering is as follows: * rId1 - Drawings @@ -183,7 +188,9 @@ class Rels extends WriterPart * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet * @param int $pWorksheetId * @param bool $includeCharts Flag indicating if we should write charts + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false) @@ -271,12 +278,14 @@ class Rels extends WriterPart } /** - * Write drawing relationships to XML format + * Write drawing relationships to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param bool $includeCharts Flag indicating if we should write charts + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false) @@ -336,10 +345,12 @@ class Rels extends WriterPart } /** - * Write header/footer drawing relationships to XML format + * Write header/footer drawing relationships to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null) @@ -376,13 +387,14 @@ class Rels extends WriterPart } /** - * Write Override content type + * Write Override content type. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param int $pId Relationship ID. rId will be prepended! * @param string $pType Relationship type * @param string $pTarget Relationship target * @param string $pTargetMode Relationship target mode + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeRelationship(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') diff --git a/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php b/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php index c97f9e7b..016e1ca4 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class RelsRibbon extends WriterPart { /** - * Write relationships for additional objects of custom UI (ribbon) + * Write relationships for additional objects of custom UI (ribbon). * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeRibbonRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php b/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php index c87fd898..f42011c8 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class RelsVBA extends WriterPart { /** - * Write relationships for a signed VBA Project + * Write relationships for a signed VBA Project. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeVBARelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php b/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php index 9939fe29..b4778b8a 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,20 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class StringTable extends WriterPart { /** - * Create worksheet stringtable + * Create worksheet stringtable. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet * @param string[] $pExistingTable Existing table to eventually merge with + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string[] String table for worksheet */ public function createStringTable($pSheet = null, $pExistingTable = null) @@ -69,16 +72,17 @@ class StringTable extends WriterPart } return $aStringTable; - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("Invalid \PhpOffice\PhpSpreadsheet\Worksheet object passed."); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("Invalid \PhpOffice\PhpSpreadsheet\Worksheet object passed."); } /** - * Write string table to XML format + * Write string table to XML format. * * @param string[] $pStringTable + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeStringTable($pStringTable = null) @@ -122,17 +126,17 @@ class StringTable extends WriterPart $objWriter->endElement(); return $objWriter->getData(); - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid string table array passed.'); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid string table array passed.'); } /** - * Write Rich Text + * Write Rich Text. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\RichText $pRichText Rich text * @param string $prefix Optional Namespace prefix + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function writeRichText(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\RichText $pRichText = null, $prefix = null) @@ -212,11 +216,12 @@ class StringTable extends WriterPart } /** - * Write Rich Text + * Write Rich Text. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string|\PhpOffice\PhpSpreadsheet\RichText $pRichText text string or Rich text * @param string $prefix Optional Namespace prefix + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function writeRichTextForCharts(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pRichText = null, $prefix = null) @@ -275,9 +280,10 @@ class StringTable extends WriterPart } /** - * Flip string table (for index searching) + * Flip string table (for index searching). * * @param array $stringTable Stringtable + * * @return array */ public function flipStringTable($stringTable = []) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Style.php b/src/PhpSpreadsheet/Writer/Xlsx/Style.php index f40a5b87..036599e2 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Style.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Style.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,19 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Style extends WriterPart { /** - * Write styles to XML format + * Write styles to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -156,10 +159,11 @@ class Style extends WriterPart } /** - * Write Fill + * Write Fill. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\Fill $pFill Fill style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill = null) @@ -176,10 +180,11 @@ class Style extends WriterPart } /** - * Write Gradient Fill + * Write Gradient Fill. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\Fill $pFill Fill style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeGradientFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill = null) @@ -220,10 +225,11 @@ class Style extends WriterPart } /** - * Write Pattern Fill + * Write Pattern Fill. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\Fill $pFill Fill style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writePatternFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill = null) @@ -258,10 +264,11 @@ class Style extends WriterPart } /** - * Write Font + * Write Font. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\Font $pFont Font style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeFont(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Font $pFont = null) @@ -338,10 +345,11 @@ class Style extends WriterPart } /** - * Write Border + * Write Border. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\Borders $pBorders Borders style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeBorder(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Borders $pBorders = null) @@ -374,11 +382,12 @@ class Style extends WriterPart } /** - * Write Cell Style Xf + * Write Cell Style Xf. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style $pStyle Style * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet Workbook + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeCellStyleXf(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style $pStyle = null, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -450,10 +459,11 @@ class Style extends WriterPart } /** - * Write Cell Style Dxf + * Write Cell Style Dxf. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style $pStyle Style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeCellStyleDxf(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style $pStyle = null) @@ -514,11 +524,12 @@ class Style extends WriterPart } /** - * Write BorderPr + * Write BorderPr. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pName Element name * @param \PhpOffice\PhpSpreadsheet\Style\Border $pBorder Border style + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeBorderPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pName = 'left', \PhpOffice\PhpSpreadsheet\Style\Border $pBorder = null) @@ -538,11 +549,12 @@ class Style extends WriterPart } /** - * Write NumberFormat + * Write NumberFormat. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Style\NumberFormat $pNumberFormat Number Format * @param int $pId Number Format identifier + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeNumFmt(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\NumberFormat $pNumberFormat = null, $pId = 0) @@ -560,10 +572,12 @@ class Style extends WriterPart } /** - * Get an array of all styles + * Get an array of all styles. * * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Style[] All styles in PhpSpreadsheet */ public function allStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -572,10 +586,12 @@ class Style extends WriterPart } /** - * Get an array of all conditional styles + * Get an array of all conditional styles. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Style\Conditional[] All conditional styles in PhpSpreadsheet */ public function allConditionalStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -596,10 +612,12 @@ class Style extends WriterPart } /** - * Get an array of all fills + * Get an array of all fills. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Style\Fill[] All fills in PhpSpreadsheet */ public function allFills(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -628,10 +646,12 @@ class Style extends WriterPart } /** - * Get an array of all fonts + * Get an array of all fonts. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Style\Font[] All fonts in PhpSpreadsheet */ public function allFonts(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -651,10 +671,12 @@ class Style extends WriterPart } /** - * Get an array of all borders + * Get an array of all borders. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Style\Borders[] All borders in PhpSpreadsheet */ public function allBorders(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -674,10 +696,12 @@ class Style extends WriterPart } /** - * Get an array of all number formats + * Get an array of all number formats. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Style\NumberFormat[] All number formats in PhpSpreadsheet */ public function allNumberFormats(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Theme.php b/src/PhpSpreadsheet/Writer/Xlsx/Theme.php index 5f8869b4..cc66eea6 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Theme.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Theme.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * PhpSpreadsheet + * PhpSpreadsheet. * * Copyright (c) 2006 - 2016 PhpSpreadsheet * @@ -22,18 +22,21 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ /** * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) */ class Theme extends WriterPart { /** - * Map of Major fonts to write + * Map of Major fonts to write. + * * @static array of string */ private static $majorFonts = [ @@ -70,7 +73,8 @@ class Theme extends WriterPart ]; /** - * Map of Minor fonts to write + * Map of Minor fonts to write. + * * @static array of string */ private static $minorFonts = [ @@ -107,7 +111,8 @@ class Theme extends WriterPart ]; /** - * Map of core colours + * Map of core colours. + * * @static array of string */ private static $colourScheme = [ @@ -124,10 +129,12 @@ class Theme extends WriterPart ]; /** - * Write theme to XML format + * Write theme to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeTheme(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -806,12 +813,14 @@ class Theme extends WriterPart } /** - * Write fonts to XML format + * Write fonts to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter * @param string $latinFont * @param array of string $fontSet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ private function writeFonts($objWriter, $latinFont, $fontSet) @@ -840,10 +849,12 @@ class Theme extends WriterPart } /** - * Write colour scheme to XML format + * Write colour scheme to XML format. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ private function writeColourScheme($objWriter) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php index 70712aed..774e99ed 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2016 PhpSpreadsheet + * Copyright (c) 2006 - 2016 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,20 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ class Workbook extends WriterPart { /** - * Write workbook to XML format + * Write workbook to XML format. * * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeWorkbook(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null, $recalcRequired = false) @@ -81,9 +84,10 @@ class Workbook extends WriterPart } /** - * Write file version + * Write file version. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeFileVersion(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter) @@ -97,9 +101,10 @@ class Workbook extends WriterPart } /** - * Write WorkbookPr + * Write WorkbookPr. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeWorkbookPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter) @@ -116,10 +121,11 @@ class Workbook extends WriterPart } /** - * Write BookViews + * Write BookViews. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeBookViews(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -146,10 +152,11 @@ class Workbook extends WriterPart } /** - * Write WorkbookProtection + * Write WorkbookProtection. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeWorkbookProtection(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -173,10 +180,11 @@ class Workbook extends WriterPart } /** - * Write calcPr + * Write calcPr. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeCalcPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $recalcRequired = true) @@ -196,10 +204,11 @@ class Workbook extends WriterPart } /** - * Write sheets + * Write sheets. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheets(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -222,13 +231,14 @@ class Workbook extends WriterPart } /** - * Write sheet + * Write sheet. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param string $pSheetname Sheet name * @param int $pSheetId Sheet id * @param int $pRelId Relationship ID * @param string $sheetState Sheet state (visible, hidden, veryHidden) + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheet(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') @@ -249,10 +259,11 @@ class Workbook extends WriterPart } /** - * Write Defined Names + * Write Defined Names. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDefinedNames(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null) @@ -283,10 +294,11 @@ class Workbook extends WriterPart } /** - * Write named ranges + * Write named ranges. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeNamedRanges(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet) @@ -299,10 +311,11 @@ class Workbook extends WriterPart } /** - * Write Defined Name for named range + * Write Defined Name for named range. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\NamedRange $pNamedRange + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDefinedNameForNamedRange(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\NamedRange $pNamedRange) @@ -330,11 +343,12 @@ class Workbook extends WriterPart } /** - * Write Defined Name for autoFilter + * Write Defined Name for autoFilter. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet * @param int $pSheetId + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDefinedNameForAutofilter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pSheetId = 0) @@ -366,11 +380,12 @@ class Workbook extends WriterPart } /** - * Write Defined Name for PrintTitles + * Write Defined Name for PrintTitles. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet * @param int $pSheetId + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDefinedNameForPrintTitles(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pSheetId = 0) @@ -409,11 +424,12 @@ class Workbook extends WriterPart } /** - * Write Defined Name for PrintTitles + * Write Defined Name for PrintTitles. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet * @param int $pSheetId + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDefinedNameForPrintArea(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pSheetId = 0) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php index 7eba9f2b..22e8a570 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * PhpSpreadsheet + * PhpSpreadsheet. * * Copyright (c) 2006 - 2015 PhpSpreadsheet * @@ -22,23 +22,27 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ /** * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) */ class Worksheet extends WriterPart { /** - * Write worksheet to XML format + * Write worksheet to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet * @param string[] $pStringTable * @param bool $includeCharts Flag indicating if we should write charts + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return string XML Output */ public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = false) @@ -128,16 +132,16 @@ class Worksheet extends WriterPart // Return return $objWriter->getData(); - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid \\PhpOffice\\PhpSpreadsheet\\Worksheet object passed.'); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid \\PhpOffice\\PhpSpreadsheet\\Worksheet object passed.'); } /** - * Write SheetPr + * Write SheetPr. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheetPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -181,10 +185,11 @@ class Worksheet extends WriterPart } /** - * Write Dimension + * Write Dimension. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDimension(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -196,10 +201,11 @@ class Worksheet extends WriterPart } /** - * Write SheetViews + * Write SheetViews. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheetViews(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -308,10 +314,11 @@ class Worksheet extends WriterPart } /** - * Write SheetFormatPr + * Write SheetFormatPr. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheetFormatPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -360,10 +367,11 @@ class Worksheet extends WriterPart } /** - * Write Cols + * Write Cols. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeCols(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -425,10 +433,11 @@ class Worksheet extends WriterPart } /** - * Write SheetProtection + * Write SheetProtection. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheetProtection(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -460,10 +469,11 @@ class Worksheet extends WriterPart } /** - * Write ConditionalFormatting + * Write ConditionalFormatting. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeConditionalFormatting(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -533,10 +543,11 @@ class Worksheet extends WriterPart } /** - * Write DataValidations + * Write DataValidations. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDataValidations(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -599,10 +610,11 @@ class Worksheet extends WriterPart } /** - * Write Hyperlinks + * Write Hyperlinks. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeHyperlinks(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -640,10 +652,11 @@ class Worksheet extends WriterPart } /** - * Write ProtectedRanges + * Write ProtectedRanges. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeProtectedRanges(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -669,10 +682,11 @@ class Worksheet extends WriterPart } /** - * Write MergeCells + * Write MergeCells. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeMergeCells(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -694,10 +708,11 @@ class Worksheet extends WriterPart } /** - * Write PrintOptions + * Write PrintOptions. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writePrintOptions(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -720,10 +735,11 @@ class Worksheet extends WriterPart } /** - * Write PageMargins + * Write PageMargins. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writePageMargins(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -740,10 +756,11 @@ class Worksheet extends WriterPart } /** - * Write AutoFilter + * Write AutoFilter. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeAutoFilter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -833,10 +850,11 @@ class Worksheet extends WriterPart } /** - * Write PageSetup + * Write PageSetup. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writePageSetup(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -868,10 +886,11 @@ class Worksheet extends WriterPart } /** - * Write Header / Footer + * Write Header / Footer. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeHeaderFooter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -893,10 +912,11 @@ class Worksheet extends WriterPart } /** - * Write Breaks + * Write Breaks. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeBreaks(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -950,11 +970,12 @@ class Worksheet extends WriterPart } /** - * Write SheetData + * Write SheetData. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet * @param string[] $pStringTable String table + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeSheetData(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pStringTable = null) @@ -1040,13 +1061,14 @@ class Worksheet extends WriterPart } /** - * Write Cell + * Write Cell. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet * @param \PhpOffice\PhpSpreadsheet\Cell $pCellAddress Cell Address * @param string[] $pStringTable String table * @param string[] $pFlippedStringTable String table (flipped), for faster index searching + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeCell(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) @@ -1159,11 +1181,12 @@ class Worksheet extends WriterPart } /** - * Write Drawings + * Write Drawings. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet * @param bool $includeCharts Flag indicating if we should include drawing details for charts + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeDrawings(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $includeCharts = false) @@ -1179,10 +1202,11 @@ class Worksheet extends WriterPart } /** - * Write LegacyDrawing + * Write LegacyDrawing. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeLegacyDrawing(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) @@ -1196,10 +1220,11 @@ class Worksheet extends WriterPart } /** - * Write LegacyDrawingHF + * Write LegacyDrawingHF. * * @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet Worksheet + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ private function writeLegacyDrawingHF(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null) diff --git a/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php b/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php index 3aad2ac9..63d626e0 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; /** - * Copyright (c) 2006 - 2015 PhpSpreadsheet + * Copyright (c) 2006 - 2015 PhpSpreadsheet. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,22 +20,24 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PhpSpreadsheet + * * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ abstract class WriterPart { /** - * Parent IWriter object + * Parent IWriter object. * * @var \PhpOffice\PhpSpreadsheet\Writer\IWriter */ private $parentWriter; /** - * Set parent IWriter object + * Set parent IWriter object. * * @param \PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function setParentWriter(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter = null) @@ -44,24 +46,25 @@ abstract class WriterPart } /** - * Get parent IWriter object + * Get parent IWriter object. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * * @return \PhpOffice\PhpSpreadsheet\Writer\IWriter */ public function getParentWriter() { if (!is_null($this->parentWriter)) { return $this->parentWriter; - } else { - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No parent \\PhpOffice\\PhpSpreadsheet\\Writer\\IWriter assigned.'); } + throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No parent \\PhpOffice\\PhpSpreadsheet\\Writer\\IWriter assigned.'); } /** - * Set parent IWriter object + * Set parent IWriter object. * * @param \PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter + * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ public function __construct(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter = null) diff --git a/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php b/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php index 4d1c07ee..1a41c902 100644 --- a/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php @@ -7,7 +7,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Shared\Date; /** - * Class DateTimeTest + * Class DateTimeTest. */ class DateTimeTest extends \PHPUnit_Framework_TestCase { @@ -46,7 +46,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase $result = DateTime::DATE(2012, 1, 31); Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); // Must return an object... - $this->assertTrue(is_object($result)); + $this->assertInternalType('object', $result); // ... of the correct type $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value @@ -99,7 +99,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase $result = DateTime::DATEVALUE('2012-1-31'); Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); // Must return an object... - $this->assertTrue(is_object($result)); + $this->assertInternalType('object', $result); // ... of the correct type $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value @@ -216,7 +216,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase $result = DateTime::TIME(7, 30, 20); Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); // Must return an object... - $this->assertTrue(is_object($result)); + $this->assertInternalType('object', $result); // ... of the correct type $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value @@ -253,7 +253,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase $result = DateTime::TIMEVALUE('7:30:20'); Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); // Must return an object... - $this->assertTrue(is_object($result)); + $this->assertInternalType('object', $result); // ... of the correct type $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value @@ -370,7 +370,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase $result = DateTime::EDATE('2012-1-26', -1); Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); // Must return an object... - $this->assertTrue(is_object($result)); + $this->assertInternalType('object', $result); // ... of the correct type $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value @@ -407,7 +407,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase $result = DateTime::EOMONTH('2012-1-26', -1); Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); // Must return an object... - $this->assertTrue(is_object($result)); + $this->assertInternalType('object', $result); // ... of the correct type $this->assertTrue(is_a($result, 'DateTime')); // ... with the correct value diff --git a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php index b72c2282..09487797 100644 --- a/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php @@ -6,7 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; /** - * Class LookupRefTest + * Class LookupRefTest. */ class LookupRefTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/PhpSpreadsheetTests/CalculationTest.php b/tests/PhpSpreadsheetTests/CalculationTest.php index 603abd4a..1fc2b817 100644 --- a/tests/PhpSpreadsheetTests/CalculationTest.php +++ b/tests/PhpSpreadsheetTests/CalculationTest.php @@ -14,6 +14,10 @@ class CalculationTest extends \PHPUnit_Framework_TestCase /** * @dataProvider providerBinaryComparisonOperation + * + * @param mixed $formula + * @param mixed $expectedResultExcel + * @param mixed $expectedResultOpenOffice */ public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice) { @@ -33,10 +37,14 @@ class CalculationTest extends \PHPUnit_Framework_TestCase /** * @dataProvider providerGetFunctions + * + * @param mixed $category + * @param mixed $functionCall + * @param mixed $argumentCount */ public function testGetFunctions($category, $functionCall, $argumentCount) { - $this->assertTrue(is_callable($functionCall)); + $this->assertInternalType('callable', $functionCall); } public function providerGetFunctions() diff --git a/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php b/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php index 0eedb920..94be08b1 100644 --- a/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php +++ b/tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php @@ -42,6 +42,13 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase /** * @dataProvider provider + * + * @param mixed $value + * @param mixed $valueBinded + * @param mixed $format + * @param mixed $thousandsSeparator + * @param mixed $decimalSeparator + * @param mixed $currencyCode */ public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode) { diff --git a/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php b/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php index 3788c98d..fe0a0c80 100644 --- a/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php @@ -33,6 +33,8 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase /** * @dataProvider binderProvider + * + * @param mixed $value */ public function testBindValue($value) { diff --git a/tests/PhpSpreadsheetTests/Custom/Complex.php b/tests/PhpSpreadsheetTests/Custom/Complex.php index 9406572d..c2164160 100644 --- a/tests/PhpSpreadsheetTests/Custom/Complex.php +++ b/tests/PhpSpreadsheetTests/Custom/Complex.php @@ -62,7 +62,9 @@ class Complex // Return real and imaginary parts and suffix as an array, and set a default suffix if user input lazily return [$complexParts[1], $complexParts[4], !empty($complexParts[9]) ? $complexParts[9] : 'i']; - } // function _parseComplex() + } + + // function _parseComplex() public function __construct($realPart, $imaginaryPart = null, $suffix = 'i') { diff --git a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php index 828730e5..9543a543 100644 --- a/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php +++ b/tests/PhpSpreadsheetTests/Custom/ComplexAssert.php @@ -8,7 +8,7 @@ class ComplexAssert public function assertComplexEquals($expected, $actual, $delta = 0) { - if ($expected{0} === '#') { + if ($expected[0] === '#') { // Expecting an error, so we do a straight string comparison if ($expected === $actual) { return true; diff --git a/tests/PhpSpreadsheetTests/IOFactoryTest.php b/tests/PhpSpreadsheetTests/IOFactoryTest.php index 13658f81..65aa8c43 100644 --- a/tests/PhpSpreadsheetTests/IOFactoryTest.php +++ b/tests/PhpSpreadsheetTests/IOFactoryTest.php @@ -8,6 +8,9 @@ class IOFactoryTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider providerIdentify + * + * @param mixed $file + * @param mixed $expected */ public function testIdentify($file, $expected) { diff --git a/tests/PhpSpreadsheetTests/Reader/XEEValidatorTest.php b/tests/PhpSpreadsheetTests/Reader/XEEValidatorTest.php index 421f23ab..a9a97314 100644 --- a/tests/PhpSpreadsheetTests/Reader/XEEValidatorTest.php +++ b/tests/PhpSpreadsheetTests/Reader/XEEValidatorTest.php @@ -9,6 +9,8 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase /** * @dataProvider providerInvalidXML * @expectedException \PhpOffice\PhpSpreadsheet\Reader\Exception + * + * @param mixed $filename */ public function testInvalidXML($filename) { @@ -30,6 +32,9 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase /** * @dataProvider providerValidXML + * + * @param mixed $filename + * @param mixed $expectedResult */ public function testValidXML($filename, $expectedResult) { diff --git a/tests/PhpSpreadsheetTests/SampleTest.php b/tests/PhpSpreadsheetTests/SampleTest.php index e6d75f3b..d30c5a26 100644 --- a/tests/PhpSpreadsheetTests/SampleTest.php +++ b/tests/PhpSpreadsheetTests/SampleTest.php @@ -8,6 +8,8 @@ class SampleTest extends \PHPUnit_Framework_TestCase * @runInSeparateProcess * @preserveGlobalState disabled * @dataProvider providerSample + * + * @param mixed $sample */ public function testSample($sample) { diff --git a/tests/PhpSpreadsheetTests/SettingsTest.php b/tests/PhpSpreadsheetTests/SettingsTest.php index c35c63d4..902f1788 100644 --- a/tests/PhpSpreadsheetTests/SettingsTest.php +++ b/tests/PhpSpreadsheetTests/SettingsTest.php @@ -8,16 +8,12 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { } - /** - */ public function testGetXMLSettings() { $result = \PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions(); $this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result)); } - /** - */ public function testSetXMLSettings() { call_user_func_array([\PhpOffice\PhpSpreadsheet\Settings::class, 'setLibXmlLoaderOptions'], [LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID]); diff --git a/tests/PhpSpreadsheetTests/Shared/StringTest.php b/tests/PhpSpreadsheetTests/Shared/StringTest.php index c9b46777..ac87c7ac 100644 --- a/tests/PhpSpreadsheetTests/Shared/StringTest.php +++ b/tests/PhpSpreadsheetTests/Shared/StringTest.php @@ -65,7 +65,7 @@ class StringTest extends \PHPUnit_Framework_TestCase public function testGetCurrencyCode() { $localeconv = localeconv(); - $expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol']: '$')); + $expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol'] : '$')); $result = StringHelper::getCurrencyCode(); $this->assertEquals($expectedResult, $result); } diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php index ed9dfc9b..85b888df 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php @@ -129,7 +129,7 @@ class ColumnTest extends \PHPUnit_Framework_TestCase $this->testAutoFilterColumnObject->setAttributes($attributeSet); $result = $this->testAutoFilterColumnObject->getAttributes(); - $this->assertTrue(is_array($result)); + $this->assertInternalType('array', $result); $this->assertEquals(count($attributeSet), count($result)); }