diff --git a/.coveralls.yml b/.coveralls.yml index 53bda82..bc71b62 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1,3 +1,2 @@ coverage_clover: clover.xml json_path: coveralls-upload.json -src_dir: src diff --git a/.gitignore b/.gitignore index f146c86..10650b5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,7 @@ nbproject doc/html/ tmp/ zf-mkdoc-theme/ - clover.xml -composer.lock coveralls-upload.json phpunit.xml vendor diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 8f4dd5a..0000000 --- a/.php_cs +++ /dev/null @@ -1,45 +0,0 @@ -in('src') - ->in('test') - ->notPath('TestAsset') - ->notPath('_files') - ->filter(function (SplFileInfo $file) { - if (strstr($file->getPath(), 'compatibility')) { - return false; - } - }); -$config = Symfony\CS\Config\Config::create(); -$config->level(null); -$config->fixers( - array( - 'braces', - 'duplicate_semicolon', - 'elseif', - 'empty_return', - 'encoding', - 'eof_ending', - 'function_call_space', - 'function_declaration', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'lowercase_keywords', - 'parenthesis', - 'multiple_use', - 'method_argument_space', - 'object_operator', - 'php_closing_tag', - 'remove_lines_between_uses', - 'short_array_syntax', - 'short_tag', - 'standardize_not_equal', - 'trailing_spaces', - 'unused_use', - 'visibility', - 'whitespacy_lines', - ) -); -$config->finder($finder); -return $config; diff --git a/.travis.yml b/.travis.yml index c6697d0..13d1a00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,37 +15,46 @@ cache: env: global: - - SITE_URL: https://zendframework.github.io/zend-console - - GH_USER_NAME: "Matthew Weier O'Phinney" - - GH_USER_EMAIL: matthew@weierophinney.net - - GH_REF: github.com/zendframework/zend-console.git + - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" + - SITE_URL="https://zendframework.github.io/zend-console" + - GH_USER_NAME="Matthew Weier O'Phinney" + - GH_USER_EMAIL="matthew@weierophinney.net" + - GH_REF="github.com/zendframework/zend-console.git" - secure: "can3MouUZEPZnJUSetVwM7dZ4Wm876zomJnY2PpbWheZm1vE9nEFIVntk5oL4GJfHd2rr8l3Ot2o/IeD//8Zvinf0lVqaX8sPgq8xLcKSozeIiSzblbGKVCwDHZO5LnKTyXo+dWgKRziajBd4A6cNeO1s7srrYlroF/G4gajf29KAXJhQ8b2JtwIgjpK/n7M9pACBwzDs+5BcGfKLh6KhNJQv41tTzH69+9wMV1Lsn2ksA/CJoOGWKO0EJyu7FcXh7PugfqfmW988074WnJ57pPsOToLrYUHtaIh/6iv6S9/yYXqYw+Pdjkc3SJvWRfnAvvOaASkRsQT2jD3NknLrK0tbu7Z0EWfHYdTpAqsX9S0u/vAeyQKxG/5SotWwLH9zUxgoPgZ4rnVZwoVkOxv1rzOD/28CNToaQZ/GDQTsaEvLNg51TGCMmmyJDzK4p7WSVxLKmiM106SGj/H3brmTr0l32u8itvyfyZaJwIk7aQP/xIFgqA/qpApd/ykSTRs7u8CIj1PhdRP6FyYwUc+xn8d9Ylat1NoKJI4P6BajuUEPCij8joowb0ep05DgIMGqgU8aHuCBeIz0RiWQrbn4V9pzchVFfmd5KCUV87hoCsXYo1RNVDW4kpaOj7OG9R1tKSHVmyHmmKgy8dElYQrDIQDDgDEWFUxzE9gMQb4vQM=" matrix: - fast_finish: true include: - - php: 5.5 + - php: 5.6 env: - - EXECUTE_CS_CHECK=true + - DEPS=lowest - php: 5.6 env: - - EXECUTE_TEST_COVERALLS=true + - DEPS=locked + - TEST_COVERAGE=true - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)" - PATH="$HOME/.local/bin:$PATH" + - php: 5.6 + env: + - DEPS=latest - php: 7 - - php: hhvm - - php: 5.5 env: - - EXCLUDE_VALIDATOR=true - - php: 5.6 + - DEPS=lowest + - php: 7 env: - - EXCLUDE_VALIDATOR=true + - DEPS=locked + - CS_CHECK=true - php: 7 env: - - EXCLUDE_VALIDATOR=true - - php: hhvm + - DEPS=latest + - php: hhvm + env: + - DEPS=lowest + - php: hhvm + env: + - DEPS=locked + - php: hhvm env: - - EXCLUDE_VALIDATOR=true + - DEPS=latest allow_failures: - php: hhvm @@ -54,21 +63,21 @@ notifications: email: false before_install: - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - - composer self-update - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi + - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi install: - - travis_retry composer install --no-interaction --ignore-platform-reqs + - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi + - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS satooshi/php-coveralls:^1.0 ; fi + - travis_retry composer install $COMPOSER_ARGS + - composer show script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi - - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi - - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi + - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi after_success: - if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi after_script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa70494..55ea538 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,24 +77,24 @@ To do so: ## Running Coding Standards Checks -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding +This component uses [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for coding standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. +`phpcs` is installed by default via Composer. To run checks only: ```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs +$ composer cs-check ``` -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: +`phpcs` also includes a tool for fixing most CS violations, `phpcbf`: + ```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs +$ composer cs-fix ``` -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure +If you allow `phpcbf` to fix CS issues, please re-run the tests to ensure they pass, and make sure you add and commit the changes after verification. ## Recommended Workflow for Contributions diff --git a/composer.json b/composer.json index e84160b..ec1e696 100644 --- a/composer.json +++ b/composer.json @@ -24,18 +24,29 @@ } }, "require": { - "php": "^5.5 || ^7.0", + "php": "^5.6 || ^7.0", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "^4.0", + "phpunit/PHPUnit": "^4.8", "zendframework/zend-filter": "^2.6", "zendframework/zend-json": "^2.6", - "zendframework/zend-validator": "^2.6" + "zendframework/zend-validator": "^2.6", + "zendframework/zend-coding-standard": "~1.0.0" }, "suggest": { "zendframework/zend-filter": "To support DefaultRouteMatcher usage", "zendframework/zend-validator": "To support DefaultRouteMatcher usage" + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", + "upload-coverage": "coveralls -v" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..9c370db --- /dev/null +++ b/composer.lock @@ -0,0 +1,1814 @@ +{ + "_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": "427aaa0b0c2e52929d7cd8ed2a3807da", + "content-hash": "e3f2c7064db34ea3a342da842bf6243c", + "packages": [ + { + "name": "zendframework/zend-stdlib", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "debedcfc373a293f9250cc9aa03cf121428c8e78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/debedcfc373a293f9250cc9aa03cf121428c8e78", + "reference": "debedcfc373a293f9250cc9aa03cf121428c8e78", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "~0.1", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev", + "dev-develop": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-stdlib", + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2016-09-13 14:38:50" + } + ], + "packages-dev": [ + { + "name": "container-interop/container-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "time": "2014-12-30 15:22:37" + }, + { + "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": "fabpot/php-cs-fixer", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "8785276c44a36ca5235a3b6133e3ffbe989ee431" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/8785276c44a36ca5235a3b6133e3ffbe989ee431", + "reference": "8785276c44a36ca5235a3b6133e3ffbe989ee431", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.6", + "sebastian/diff": "~1.1", + "symfony/console": "~2.3", + "symfony/event-dispatcher": "~2.1", + "symfony/filesystem": "~2.1", + "symfony/finder": "~2.1", + "symfony/process": "~2.3", + "symfony/stopwatch": "~2.5" + }, + "require-dev": { + "satooshi/php-coveralls": "0.7.*@dev" + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "Symfony\\CS\\": "Symfony/CS/" + } + }, + "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 script to automatically fix Symfony Coding Standard", + "abandoned": "friendsofphp/php-cs-fixer", + "time": "2015-05-04 16:56:09" + }, + { + "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.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "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-09-30 07:12:33" + }, + { + "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.8.27", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90", + "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "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.8.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": "2016-07-21 06:48:14" + }, + { + "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.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "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-08-18 05:49:44" + }, + { + "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": "symfony/console", + "version": "v2.8.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "3d3e4fa5f0614c8e45220e5de80332322e33bd90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/3d3e4fa5f0614c8e45220e5de80332322e33bd90", + "reference": "3d3e4fa5f0614c8e45220e5de80332322e33bd90", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-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-09-06 10:55:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.8.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/889983a79a043dfda68f38c38b6dba092dd49cd8", + "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-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-28 16:56:28" + }, + { + "name": "symfony/filesystem", + "version": "v2.8.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "44b499521defddf2eae17a18c811bbdae4f98bdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/44b499521defddf2eae17a18c811bbdae4f98bdf", + "reference": "44b499521defddf2eae17a18c811bbdae4f98bdf", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-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-09-06 10:55:00" + }, + { + "name": "symfony/finder", + "version": "v2.8.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "bec5533e6ed650547d6ec8de4b541dc9929066f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/bec5533e6ed650547d6ec8de4b541dc9929066f7", + "reference": "bec5533e6ed650547d6ec8de4b541dc9929066f7", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-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-08-26 11:57:43" + }, + { + "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/process", + "version": "v2.8.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "05a03ed27073638658cab9405d99a67dd1014987" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/05a03ed27073638658cab9405d99a67dd1014987", + "reference": "05a03ed27073638658cab9405d99a67dd1014987", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-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-09-06 10:55:00" + }, + { + "name": "symfony/stopwatch", + "version": "v2.8.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "35bae476693150728b0eb51647faac82faf9aaca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/35bae476693150728b0eb51647faac82faf9aaca", + "reference": "35bae476693150728b0eb51647faac82faf9aaca", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-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:29:29" + }, + { + "name": "symfony/yaml", + "version": "v3.1.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d", + "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d", + "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-09-02 02:12:52" + }, + { + "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" + }, + { + "name": "zendframework/zend-filter", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-filter.git", + "reference": "84c50246428efb0a1e52868e162dab3e149d5b80" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/84c50246428efb0a1e52868e162dab3e149d5b80", + "reference": "84c50246428efb0a1e52868e162dab3e149d5b80", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "pear/archive_tar": "^1.4", + "phpunit/phpunit": "~4.0", + "zendframework/zend-crypt": "^2.6", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-uri": "^2.5" + }, + "suggest": { + "zendframework/zend-crypt": "Zend\\Crypt component, for encryption filters", + "zendframework/zend-i18n": "Zend\\I18n component for filters depending on i18n functionality", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for using the filter chain functionality", + "zendframework/zend-uri": "Zend\\Uri component, for the UriNormalize filter" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + }, + "zf": { + "component": "Zend\\Filter", + "config-provider": "Zend\\Filter\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Filter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a set of commonly needed data filters", + "homepage": "https://github.com/zendframework/zend-filter", + "keywords": [ + "filter", + "zf2" + ], + "time": "2016-04-18 18:32:43" + }, + { + "name": "zendframework/zend-json", + "version": "2.6.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-json.git", + "reference": "4c8705dbe4ad7d7e51b2876c5b9eea0ef916ba28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-json/zipball/4c8705dbe4ad7d7e51b2876c5b9eea0ef916ba28", + "reference": "4c8705dbe4ad7d7e51b2876c5b9eea0ef916ba28", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-server": "^2.6.1", + "zendframework/zend-stdlib": "^2.5 || ^3.0", + "zendframework/zendxml": "^1.0.2" + }, + "suggest": { + "zendframework/zend-http": "Zend\\Http component, required to use Zend\\Json\\Server", + "zendframework/zend-server": "Zend\\Server component, required to use Zend\\Json\\Server", + "zendframework/zend-stdlib": "Zend\\Stdlib component, for use with caching Zend\\Json\\Server responses", + "zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Json\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", + "homepage": "https://github.com/zendframework/zend-json", + "keywords": [ + "json", + "zf2" + ], + "time": "2016-02-04 21:20:26" + }, + { + "name": "zendframework/zend-validator", + "version": "2.8.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-validator.git", + "reference": "8ec9f57a717dd37340308aa632f148a2c2be1cfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/8ec9f57a717dd37340308aa632f148a2c2be1cfc", + "reference": "8ec9f57a717dd37340308aa632f148a2c2be1cfc", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "^4.0", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-config": "^2.6", + "zendframework/zend-db": "^2.7", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-i18n": "^2.6", + "zendframework/zend-math": "^2.6", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-session": "^2.6.2", + "zendframework/zend-uri": "^2.5" + }, + "suggest": { + "zendframework/zend-db": "Zend\\Db component", + "zendframework/zend-filter": "Zend\\Filter component, required by the Digits validator", + "zendframework/zend-i18n": "Zend\\I18n component to allow translation of validation error messages as well as to use the various Date validators", + "zendframework/zend-i18n-resources": "Translations of validator messages", + "zendframework/zend-math": "Zend\\Math component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component to allow using the ValidatorPluginManager and validator chains", + "zendframework/zend-session": "Zend\\Session component", + "zendframework/zend-uri": "Zend\\Uri component, required by the Uri and Sitemap\\Loc validators" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev", + "dev-develop": "2.9-dev" + }, + "zf": { + "component": "Zend\\Validator", + "config-provider": "Zend\\Validator\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Validator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a set of commonly needed validators", + "homepage": "https://github.com/zendframework/zend-validator", + "keywords": [ + "validator", + "zf2" + ], + "time": "2016-06-23 13:44:31" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.6 || ^7.0" + }, + "platform-dev": [] +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..9e6a751 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,8 @@ +ï»ż + + + + + src + test + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6669565..37d4348 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ @@ -23,16 +23,5 @@ - - - - - - diff --git a/src/Adapter/AbstractAdapter.php b/src/Adapter/AbstractAdapter.php index 8c7cbf3..48c0809 100644 --- a/src/Adapter/AbstractAdapter.php +++ b/src/Adapter/AbstractAdapter.php @@ -152,7 +152,7 @@ public function writeBox( || $y1 < 0 || $x2 < $x1 || $y2 < $y1 - ) { + ) { throw new Exception\BadMethodCallException('Supplied X,Y coordinates are invalid.'); } diff --git a/src/Adapter/Posix.php b/src/Adapter/Posix.php index 12d22d4..d4fd408 100644 --- a/src/Adapter/Posix.php +++ b/src/Adapter/Posix.php @@ -133,7 +133,7 @@ public function getWidth() * Try to read console size from "tput" command */ $result = exec('tput cols', $output, $return); - if (!$return && is_numeric($result)) { + if (! $return && is_numeric($result)) { return $width = (int) $result; } @@ -159,7 +159,7 @@ public function getHeight() // Try to read console size from "tput" command $result = exec('tput lines', $output, $return); - if (!$return && is_numeric($result)) { + if (! $return && is_numeric($result)) { return $height = (int) $result; } @@ -174,7 +174,7 @@ public function getHeight() protected function runModeCommand() { exec('mode', $output, $return); - if ($return || !count($output)) { + if ($return || ! count($output)) { $this->modeResult = ''; } else { $this->modeResult = trim(implode('', $output)); @@ -391,7 +391,7 @@ protected function getColorCode($color, $type = 'fg') } if ($color !== null) { - if (!isset(static::$ansiColorMap[$type][$color])) { + if (! isset(static::$ansiColorMap[$type][$color])) { throw new Exception\BadMethodCallException(sprintf( 'Unknown color "%s". Please use one of the Zend\Console\ColorInterface constants ' . 'or use Zend\Console\Color\Xterm256::calculate', diff --git a/src/Adapter/Virtual.php b/src/Adapter/Virtual.php index 752a26d..9f98134 100644 --- a/src/Adapter/Virtual.php +++ b/src/Adapter/Virtual.php @@ -90,7 +90,7 @@ public function getHeight() protected function runProbeCommand() { exec('mode', $output, $return); - if ($return || !count($output)) { + if ($return || ! count($output)) { $this->modeResult = ''; } else { $this->modeResult = trim(implode('', $output)); @@ -125,7 +125,7 @@ public function getTitle() { // Try to use powershell to retrieve console window title exec('powershell -command "write $Host.UI.RawUI.WindowTitle"', $output, $result); - if ($result || !$output) { + if ($result || ! $output) { return ''; } diff --git a/src/Adapter/Windows.php b/src/Adapter/Windows.php index 90b67dc..2b9942b 100644 --- a/src/Adapter/Windows.php +++ b/src/Adapter/Windows.php @@ -99,7 +99,8 @@ public function getHeight() protected function runProbeCommand() { exec( - 'echo $size = $Host.ui.rawui.windowsize; write $($size.width) $($size.height) | powershell -NonInteractive -NoProfile -NoLogo -OutputFormat Text -Command -', + 'echo $size = $Host.ui.rawui.windowsize; write $($size.width) ' + . '$($size.height) | powershell -NonInteractive -NoProfile -NoLogo -OutputFormat Text -Command -', $output, $return ); @@ -118,7 +119,7 @@ protected function runProbeCommand() protected function runModeCommand() { exec('mode', $output, $return); - if ($return || !count($output)) { + if ($return || ! count($output)) { $this->modeResult = ''; } else { $this->modeResult = trim(implode('', $output)); @@ -153,7 +154,7 @@ public function getTitle() { // Try to use powershell to retrieve console window title exec('powershell -command "write $Host.UI.RawUI.WindowTitle"', $output, $result); - if ($result || !$output) { + if ($result || ! $output) { return ''; } @@ -243,7 +244,9 @@ public function readChar($mask = null) do { exec('choice /n /cs /c:' . $mask, $output, $return); if ($return == 255 || $return < 1 || $return > strlen($mask)) { - throw new Exception\RuntimeException('"choice" command failed to run. Are you using Windows XP or newer?'); + throw new Exception\RuntimeException( + '"choice" command failed to run. Are you using Windows XP or newer?' + ); } // Fetch the char from mask @@ -269,9 +272,9 @@ public function readChar($mask = null) ); // Retrieve char from the result. - $char = !empty($result) ? implode('', $result) : null; + $char = ! empty($result) ? implode('', $result) : null; - if (!empty($char) && !$return) { + if (! empty($char) && ! $return) { // We have obtained an ASCII code, convert back to a char ... $char = chr($char); @@ -309,9 +312,9 @@ public function readChar($mask = null) $return ); - $char = !empty($result) ? trim(implode('', $result)) : null; + $char = ! empty($result) ? trim(implode('', $result)) : null; - if (!$return && $char && ($mask === null || in_array($char, $asciiMask))) { + if (! $return && $char && ($mask === null || in_array($char, $asciiMask))) { // Normalize CR to LF if ($char == 13) { $char = 10; @@ -333,7 +336,7 @@ public function readChar($mask = null) do { $char = fgetc($stream); $char = substr(trim($char), 0, 1); - } while (!$char || ($mask !== null && !stristr($mask, $char))); + } while (! $char || ($mask !== null && ! stristr($mask, $char))); fclose($stream); return $char; diff --git a/src/Adapter/WindowsAnsicon.php b/src/Adapter/WindowsAnsicon.php index 1ffc728..d993212 100644 --- a/src/Adapter/WindowsAnsicon.php +++ b/src/Adapter/WindowsAnsicon.php @@ -94,7 +94,7 @@ public function getHeight() protected function runModeCommand() { exec('mode', $output, $return); - if ($return || !count($output)) { + if ($return || ! count($output)) { $this->modeResult = ''; } else { $this->modeResult = trim(implode('', $output)); @@ -129,7 +129,7 @@ public function getTitle() { // Try to use powershell to retrieve console window title exec('powershell -command "write $Host.UI.RawUI.WindowTitle"', $output, $result); - if ($result || !$output) { + if ($result || ! $output) { return ''; } @@ -203,7 +203,9 @@ public function readChar($mask = null) do { exec('choice /n /cs /c:' . $mask, $output, $return); if ($return == 255 || $return < 1 || $return > strlen($mask)) { - throw new Exception\RuntimeException('"choice" command failed to run. Are you using Windows XP or newer?'); + throw new Exception\RuntimeException( + '"choice" command failed to run. Are you using Windows XP or newer?' + ); } // Fetch the char from mask @@ -229,9 +231,9 @@ public function readChar($mask = null) ); // Retrieve char from the result. - $char = !empty($result) ? implode('', $result) : null; + $char = ! empty($result) ? implode('', $result) : null; - if (!empty($char) && !$return) { + if (! empty($char) && ! $return) { // We have obtained an ASCII code, convert back to a char ... $char = chr($char); @@ -268,9 +270,9 @@ public function readChar($mask = null) $return ); - $char = !empty($result) ? trim(implode('', $result)) : null; + $char = ! empty($result) ? trim(implode('', $result)) : null; - if (!$return && $char && ($mask === null || in_array($char, $asciiMask))) { + if (! $return && $char && ($mask === null || in_array($char, $asciiMask))) { // We have obtained an ASCII code, check if it is a carriage // return and normalize it as needed if ($char == 13) { @@ -293,7 +295,7 @@ public function readChar($mask = null) do { $char = fgetc($stream); $char = substr(trim($char), 0, 1); - } while (!$char || ($mask !== null && !stristr($mask, $char))); + } while (! $char || ($mask !== null && ! stristr($mask, $char))); fclose($stream); return $char; diff --git a/src/Color/Xterm256.php b/src/Color/Xterm256.php index 54870cd..a75c4a1 100644 --- a/src/Color/Xterm256.php +++ b/src/Color/Xterm256.php @@ -45,20 +45,20 @@ protected function __construct($color = null) public static function calculate($hexColor) { $hex = str_split($hexColor, 2); - if (count($hex) !== 3 || !preg_match('#[0-9A-F]{6}#i', $hexColor)) { + if (count($hex) !== 3 || ! preg_match('#[0-9A-F]{6}#i', $hexColor)) { // Invalid/unknown color string return new static(); } $ahex = array_map(function ($hex) { - $val = round(((hexdec($hex) - 55)/40), 0); + $val = round(((hexdec($hex) - 55) / 40), 0); return $val > 0 ? (int) $val : 0; }, $hex); $dhex = array_map('hexdec', $hex); if (array_fill(0, 3, $dhex[0]) === $dhex && (int) substr($dhex[0], -1) === 8) { - $x11 = 232 + (int) floor($dhex[0]/10); + $x11 = 232 + (int) floor($dhex[0] / 10); return new static($x11); } diff --git a/src/Console.php b/src/Console.php index 69e17ea..d456eda 100644 --- a/src/Console.php +++ b/src/Console.php @@ -58,7 +58,7 @@ public static function getInstance($forceAdapter = null, $forceCharset = null) $className = __NAMESPACE__ . '\\Adapter\\' . $forceAdapter; } - if (!class_exists($className)) { + if (! class_exists($className)) { throw new Exception\InvalidArgumentException(sprintf( 'Cannot find Console adapter class "%s"', $className @@ -69,7 +69,7 @@ public static function getInstance($forceAdapter = null, $forceCharset = null) $className = static::detectBestAdapter(); // Check if we were able to detect console adapter - if (!$className) { + if (! $className) { throw new Exception\RuntimeException('Cannot create Console adapter - am I running in a console?'); } } @@ -87,7 +87,7 @@ public static function getInstance($forceAdapter = null, $forceCharset = null) $className = __NAMESPACE__ . '\\Charset\\' . $forceCharset; } - if (!class_exists($className)) { + if (! class_exists($className)) { throw new Exception\InvalidArgumentException(sprintf( 'Cannot find Charset class "%s"', $className @@ -169,7 +169,7 @@ public static function overrideIsConsole($flag) public static function detectBestAdapter() { // Check if we are in a console environment - if (!static::isConsole()) { + if (! static::isConsole()) { return; } diff --git a/src/Getopt.php b/src/Getopt.php index 64b6c97..00822bb 100644 --- a/src/Getopt.php +++ b/src/Getopt.php @@ -205,7 +205,7 @@ class Getopt */ public function __construct($rules, $argv = null, $getoptConfig = []) { - if (!isset($_SERVER['argv'])) { + if (! isset($_SERVER['argv'])) { $errorDescription = (ini_get('register_argc_argv') == false) ? "argv is not available, because ini option 'register_argc_argv' is set Off" : '$_SERVER["argv"] is not set, but Zend\Console\Getopt cannot work without this information.'; @@ -215,7 +215,7 @@ public function __construct($rules, $argv = null, $getoptConfig = []) $this->progname = $_SERVER['argv'][0]; $this->setOptions($getoptConfig); $this->addRules($rules); - if (!is_array($argv)) { + if (! is_array($argv)) { $argv = array_slice($_SERVER['argv'], 1); } if (isset($argv)) { @@ -305,7 +305,7 @@ public function __unset($key) */ public function addArguments($argv) { - if (!is_array($argv)) { + if (! is_array($argv)) { throw new Exception\InvalidArgumentException("Parameter #1 to addArguments should be an array"); } $this->argv = array_merge($this->argv, $argv); @@ -323,7 +323,7 @@ public function addArguments($argv) */ public function setArguments($argv) { - if (!is_array($argv)) { + if (! is_array($argv)) { throw new Exception\InvalidArgumentException("Parameter #1 to setArguments should be an array"); } $this->argv = $argv; @@ -609,7 +609,7 @@ public function setAliases($aliasMap) $flag = strtolower($flag); $alias = strtolower($alias); } - if (!isset($this->ruleMap[$flag])) { + if (! isset($this->ruleMap[$flag])) { continue; } $flag = $this->ruleMap[$flag]; @@ -635,7 +635,7 @@ public function setAliases($aliasMap) public function setHelp($helpMap) { foreach ($helpMap as $flag => $help) { - if (!isset($this->ruleMap[$flag])) { + if (! isset($this->ruleMap[$flag])) { continue; } $flag = $this->ruleMap[$flag]; @@ -672,7 +672,7 @@ public function parse() } if (substr($argv[0], 0, 2) == '--') { $this->_parseLongOption($argv); - } elseif (substr($argv[0], 0, 1) == '-' && ('-' != $argv[0] || count($argv) >1)) { + } elseif (substr($argv[0], 0, 1) == '-' && ('-' != $argv[0] || count($argv) > 1)) { $this->_parseShortOptionCluster($argv); } elseif ($this->getoptConfig[self::CONFIG_PARSEALL]) { $this->remainingArgs[] = array_shift($argv); @@ -739,8 +739,10 @@ protected function triggerCallbacks() * * @param mixed &$argv */ + // @codingStandardsIgnoreStart protected function _parseLongOption(&$argv) { + // @codingStandardsIgnoreEnd $optionWithParam = ltrim(array_shift($argv), '-'); $l = explode('=', $optionWithParam, 2); $flag = array_shift($l); @@ -758,8 +760,10 @@ protected function _parseLongOption(&$argv) * * @param mixed &$argv */ + // @codingStandardsIgnoreStart protected function _parseShortOptionCluster(&$argv) { + // @codingStandardsIgnoreEnd $flagCluster = ltrim(array_shift($argv), '-'); foreach (str_split($flagCluster) as $flag) { $this->_parseSingleOption($flag, $argv); @@ -773,8 +777,10 @@ protected function _parseShortOptionCluster(&$argv) * @param mixed $argv * @throws Exception\ExceptionInterface */ + // @codingStandardsIgnoreStart protected function _parseSingleOption($flag, &$argv) { + // @codingStandardsIgnoreEnd if ($this->getoptConfig[self::CONFIG_IGNORECASE]) { $flag = strtolower($flag); } @@ -784,9 +790,9 @@ protected function _parseSingleOption($flag, &$argv) return $this->_setNumericOptionValue($flag); } - if (!isset($this->ruleMap[$flag])) { + if (! isset($this->ruleMap[$flag])) { // Don't throw Exception for flag-like param in case when freeform flags are allowed - if (!$this->getoptConfig[self::CONFIG_FREEFORM_FLAGS]) { + if (! $this->getoptConfig[self::CONFIG_FREEFORM_FLAGS]) { throw new Exception\RuntimeException( "Option \"$flag\" is not recognized.", $this->getUsageMessage() @@ -841,9 +847,11 @@ protected function _parseSingleOption($flag, &$argv) * @throws Exception\RuntimeException * @return void */ + // @codingStandardsIgnoreStart protected function _setNumericOptionValue($value) { - if (!$this->getoptConfig[self::CONFIG_NUMERIC_FLAGS]) { + // @codingStandardsIgnoreEnd + if (! $this->getoptConfig[self::CONFIG_NUMERIC_FLAGS]) { throw new Exception\RuntimeException("Using of numeric flags are deny by configuration"); } @@ -864,8 +872,10 @@ protected function _setNumericOptionValue($value) * @param string $flag * @param string $value */ + // @codingStandardsIgnoreStart protected function _setSingleOptionValue($flag, $value) { + // @codingStandardsIgnoreEnd if (true === $value && $this->getoptConfig[self::CONFIG_CUMULATIVE_FLAGS]) { // For boolean values we have to create new flag, or increase number of flags' usage count return $this->_setBooleanFlagValue($flag); @@ -874,11 +884,11 @@ protected function _setSingleOptionValue($flag, $value) // Split multiple values, if necessary // Filter empty values from splited array $separator = $this->getoptConfig[self::CONFIG_PARAMETER_SEPARATOR]; - if (is_string($value) && !empty($separator) && is_string($separator) && substr_count($value, $separator)) { + if (is_string($value) && ! empty($separator) && is_string($separator) && substr_count($value, $separator)) { $value = array_filter(explode($separator, $value)); } - if (!array_key_exists($flag, $this->options)) { + if (! array_key_exists($flag, $this->options)) { $this->options[$flag] = $value; } elseif ($this->getoptConfig[self::CONFIG_CUMULATIVE_PARAMETERS]) { $this->options[$flag] = (array) $this->options[$flag]; @@ -894,8 +904,10 @@ protected function _setSingleOptionValue($flag, $value) * * @param string $flag */ + // @codingStandardsIgnoreStart protected function _setBooleanFlagValue($flag) { + // @codingStandardsIgnoreEnd $this->options[$flag] = array_key_exists($flag, $this->options) ? (int) $this->options[$flag] + 1 : true; @@ -911,8 +923,10 @@ protected function _setBooleanFlagValue($flag) * @throws Exception\ExceptionInterface * @return bool */ + // @codingStandardsIgnoreStart protected function _checkParameterType($flag, $param) { + // @codingStandardsIgnoreEnd $type = 'string'; if (isset($this->rules[$flag]['paramType'])) { $type = $this->rules[$flag]['paramType']; @@ -946,8 +960,10 @@ protected function _checkParameterType($flag, $param) * * @param string $rules */ + // @codingStandardsIgnoreStart protected function _addRulesModeGnu($rules) { + // @codingStandardsIgnoreEnd $ruleArray = []; /** @@ -980,8 +996,10 @@ protected function _addRulesModeGnu($rules) * @param array $rules * @throws Exception\ExceptionInterface */ + // @codingStandardsIgnoreStart protected function _addRulesModeZend($rules) { + // @codingStandardsIgnoreEnd foreach ($rules as $ruleCode => $helpMessage) { // this may have to translate the long parm type if there // are any complaints that =string will not work (even though that use diff --git a/src/Prompt/AbstractPrompt.php b/src/Prompt/AbstractPrompt.php index 225533c..f4cb961 100644 --- a/src/Prompt/AbstractPrompt.php +++ b/src/Prompt/AbstractPrompt.php @@ -43,7 +43,7 @@ public function getLastResponse() */ public function getConsole() { - if (!$this->console) { + if (! $this->console) { $this->console = Console::getInstance(); } diff --git a/src/Prompt/Checkbox.php b/src/Prompt/Checkbox.php index 32b42da..c96ac07 100644 --- a/src/Prompt/Checkbox.php +++ b/src/Prompt/Checkbox.php @@ -47,8 +47,12 @@ final class Checkbox extends AbstractPrompt * @param array|Transversable $options Allowed options * @param bool $echo True to display selected option? */ - public function __construct($promptText = 'Please select one option (Enter to finish) ', $options = [], $ignoreCase = true, $echo = false) - { + public function __construct( + $promptText = 'Please select one option (Enter to finish) ', + $options = [], + $ignoreCase = true, + $echo = false + ) { $this->promptText = (string) $promptText; $this->setOptions($options); @@ -128,7 +132,7 @@ private function prepareMask() /** * Normalize the mask if case is irrelevant */ - if (!$this->ignoreCase) { + if (! $this->ignoreCase) { return $mask; } diff --git a/src/Prompt/Line.php b/src/Prompt/Line.php index 3b2bb78..2dc7936 100644 --- a/src/Prompt/Line.php +++ b/src/Prompt/Line.php @@ -58,7 +58,7 @@ public function show() do { $this->getConsole()->write($this->promptText); $line = $this->getConsole()->readLine($this->maxLength); - } while (!$this->allowEmpty && !$line); + } while (! $this->allowEmpty && ! $line); return $this->lastResponse = $line; } diff --git a/src/Prompt/Number.php b/src/Prompt/Number.php index 7f096a7..c241104 100644 --- a/src/Prompt/Number.php +++ b/src/Prompt/Number.php @@ -81,14 +81,14 @@ public function show() do { $valid = true; $number = parent::show(); - if ($number === "" && !$this->allowEmpty) { + if ($number === "" && ! $this->allowEmpty) { $valid = false; } elseif ($number === "") { $number = null; - } elseif (!is_numeric($number)) { + } elseif (! is_numeric($number)) { $this->getConsole()->writeLine("$number is not a number\n"); $valid = false; - } elseif (!$this->allowFloat && (round($number) != $number)) { + } elseif (! $this->allowFloat && (round($number) != $number)) { $this->getConsole()->writeLine("Please enter a non-floating number, i.e. " . round($number) . "\n"); $valid = false; } elseif ($this->max !== null && $number > $this->max) { @@ -98,7 +98,7 @@ public function show() $this->getConsole()->writeLine("Please enter a number not smaller than " . $this->min . "\n"); $valid = false; } - } while (!$valid); + } while (! $valid); /** * Cast proper type diff --git a/src/Prompt/Select.php b/src/Prompt/Select.php index ae11f96..3be142c 100644 --- a/src/Prompt/Select.php +++ b/src/Prompt/Select.php @@ -47,7 +47,7 @@ public function __construct( $this->setPromptText($promptText); } - if (!count($options)) { + if (! count($options)) { throw new Exception\BadMethodCallException( 'Cannot construct a "select" prompt without any options' ); @@ -119,13 +119,13 @@ public function show() */ public function setOptions($options) { - if (!is_array($options) && !$options instanceof \Traversable) { + if (! is_array($options) && ! $options instanceof \Traversable) { throw new Exception\BadMethodCallException( 'Please specify an array or Traversable object as options' ); } - if (!is_array($options)) { + if (! is_array($options)) { $this->options = []; foreach ($options as $k => $v) { $this->options[$k] = $v; diff --git a/src/Request.php b/src/Request.php index 1c885c4..cac5300 100644 --- a/src/Request.php +++ b/src/Request.php @@ -40,7 +40,7 @@ class Request extends Message implements RequestInterface public function __construct(array $args = null, array $env = null) { if ($args === null) { - if (!isset($_SERVER['argv'])) { + if (! isset($_SERVER['argv'])) { $errorDescription = (ini_get('register_argc_argv') == false) ? "Cannot create Console\\Request because PHP ini option 'register_argc_argv' is set Off" : 'Cannot create Console\\Request because $_SERVER["argv"] is not set for unknown reason.'; diff --git a/src/Response.php b/src/Response.php index a96974d..70a4c7d 100644 --- a/src/Response.php +++ b/src/Response.php @@ -38,7 +38,7 @@ public function contentSent() */ public function setErrorLevel($errorLevel) { - if (is_string($errorLevel) && !ctype_digit($errorLevel)) { + if (is_string($errorLevel) && ! ctype_digit($errorLevel)) { return $this; } diff --git a/src/RouteMatcher/DefaultRouteMatcher.php b/src/RouteMatcher/DefaultRouteMatcher.php index 40f77ef..4675f33 100644 --- a/src/RouteMatcher/DefaultRouteMatcher.php +++ b/src/RouteMatcher/DefaultRouteMatcher.php @@ -71,8 +71,10 @@ public function __construct( if ($filters !== null) { foreach ($filters as $name => $filter) { - if (!$filter instanceof FilterInterface) { - throw new Exception\InvalidArgumentException('Cannot use ' . gettype($filters) . ' as filter for ' . __CLASS__); + if (! $filter instanceof FilterInterface) { + throw new Exception\InvalidArgumentException( + 'Cannot use ' . gettype($filters) . ' as filter for ' . __CLASS__ + ); } $this->filters[$name] = $filter; } @@ -80,8 +82,10 @@ public function __construct( if ($validators !== null) { foreach ($validators as $name => $validator) { - if (!$validator instanceof ValidatorInterface) { - throw new Exception\InvalidArgumentException('Cannot use ' . gettype($validator) . ' as validator for ' . __CLASS__); + if (! $validator instanceof ValidatorInterface) { + throw new Exception\InvalidArgumentException( + 'Cannot use ' . gettype($validator) . ' as validator for ' . __CLASS__ + ); } $this->validators[$name] = $validator; } @@ -118,8 +122,7 @@ protected function parseDefinition($def) 'positional' => true, 'hasValue' => true, ]; - } - /** + } /** * Mandatory value param, i.e. * SOMETHING */ @@ -131,8 +134,7 @@ protected function parseDefinition($def) 'positional' => true, 'hasValue' => true, ]; - } - /** + } /** * Optional literal param, i.e. * [something] */ @@ -144,8 +146,7 @@ protected function parseDefinition($def) 'positional' => true, 'hasValue' => false, ]; - } - /** + } /** * Optional value param, syntax 2, i.e. * [] */ @@ -157,8 +158,7 @@ protected function parseDefinition($def) 'positional' => true, 'hasValue' => true, ]; - } - /** + } /** * Mandatory value param, i.e. * */ @@ -170,8 +170,7 @@ protected function parseDefinition($def) 'positional' => true, 'hasValue' => true, ]; - } - /** + } /** * Mandatory literal param, i.e. * something */ @@ -183,28 +182,36 @@ protected function parseDefinition($def) 'positional' => true, 'hasValue' => false, ]; - } - /** + } /** * Mandatory long param * --param= * --param=whatever */ - elseif (preg_match('/\G--(?P[a-zA-Z0-9][a-zA-Z0-9\_\-]+)(?P=\S*?)?(?: +|$)/s', $def, $m, 0, $pos)) { + elseif (preg_match( + '/\G--(?P[a-zA-Z0-9][a-zA-Z0-9\_\-]+)(?P=\S*?)?(?: +|$)/s', + $def, + $m, + 0, + $pos + )) { $item = [ 'name' => $m['name'], 'short' => false, 'literal' => false, 'required' => true, 'positional' => false, - 'hasValue' => !empty($m['hasValue']), + 'hasValue' => ! empty($m['hasValue']), ]; - } - /** + } /** * Optional long flag * [--param] */ elseif (preg_match( - '/\G\[ *?--(?P[a-zA-Z0-9][a-zA-Z0-9\_\-]+) *?\](?: +|$)/s', $def, $m, 0, $pos + '/\G\[ *?--(?P[a-zA-Z0-9][a-zA-Z0-9\_\-]+) *?\](?: +|$)/s', + $def, + $m, + 0, + $pos )) { $item = [ 'name' => $m['name'], @@ -214,14 +221,17 @@ protected function parseDefinition($def) 'positional' => false, 'hasValue' => false, ]; - } - /** + } /** * Optional long param * [--param=] * [--param=whatever] */ elseif (preg_match( - '/\G\[ *?--(?P[a-zA-Z0-9][a-zA-Z0-9\_\-]+)(?P=\S*?)? *?\](?: +|$)/s', $def, $m, 0, $pos + '/\G\[ *?--(?P[a-zA-Z0-9][a-zA-Z0-9\_\-]+)(?P=\S*?)? *?\](?: +|$)/s', + $def, + $m, + 0, + $pos )) { $item = [ 'name' => $m['name'], @@ -229,10 +239,9 @@ protected function parseDefinition($def) 'literal' => false, 'required' => false, 'positional' => false, - 'hasValue' => !empty($m['hasValue']), + 'hasValue' => ! empty($m['hasValue']), ]; - } - /** + } /** * Mandatory short param * -a * -a=i @@ -246,26 +255,30 @@ protected function parseDefinition($def) 'literal' => false, 'required' => true, 'positional' => false, - 'hasValue' => !empty($m['type']) ? $m['type'] : null, + 'hasValue' => ! empty($m['type']) ? $m['type'] : null, ]; - } - /** + } /** * Optional short param * [-a] * [-a=n] * [-a=s] */ - elseif (preg_match('/\G\[ *?-(?P[a-zA-Z0-9])(?:=(?P[ns]))? *?\](?: +|$)/s', $def, $m, 0, $pos)) { + elseif (preg_match( + '/\G\[ *?-(?P[a-zA-Z0-9])(?:=(?P[ns]))? *?\](?: +|$)/s', + $def, + $m, + 0, + $pos + )) { $item = [ 'name' => $m['name'], 'short' => true, 'literal' => false, 'required' => false, 'positional' => false, - 'hasValue' => !empty($m['type']) ? $m['type'] : null, + 'hasValue' => ! empty($m['type']) ? $m['type'] : null, ]; - } - /** + } /** * Optional literal param alternative * [ something | somethingElse | anotherOne ] * [ something | somethingElse | anotherOne ]:namedGroup @@ -285,8 +298,7 @@ protected function parseDefinition($def) \] (?:\:(?P[a-zA-Z0-9]+))? (?:\ +|$) - /sx', $def, $m, 0, $pos - ) + /sx', $def, $m, 0, $pos) ) { // extract available options $options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY); @@ -296,16 +308,16 @@ protected function parseDefinition($def) // prepare item $item = [ - 'name' => isset($m['groupName']) ? $m['groupName'] : 'unnamedGroup' . $unnamedGroupCounter++, + 'name' => isset($m['groupName']) + ? $m['groupName'] + : 'unnamedGroup' . $unnamedGroupCounter++, 'literal' => true, 'required' => false, 'positional' => true, 'alternatives' => $options, 'hasValue' => false, ]; - } - - /** + } /** * Required literal param alternative * ( something | somethingElse | anotherOne ) * ( something | somethingElse | anotherOne ):namedGroup @@ -325,8 +337,7 @@ protected function parseDefinition($def) \) (?:\:(?P[a-zA-Z0-9]+))? (?:\ +|$) - /sx', $def, $m, 0, $pos - )) { + /sx', $def, $m, 0, $pos)) { // extract available options $options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY); @@ -335,15 +346,16 @@ protected function parseDefinition($def) // prepare item $item = [ - 'name' => isset($m['groupName']) ? $m['groupName']:'unnamedGroupAt' . $unnamedGroupCounter++, + 'name' => isset($m['groupName']) + ? $m['groupName'] + : 'unnamedGroupAt' . $unnamedGroupCounter++, 'literal' => true, 'required' => true, 'positional' => true, 'alternatives' => $options, 'hasValue' => false, ]; - } - /** + } /** * Required long/short flag alternative * ( --something | --somethingElse | --anotherOne | -s | -a ) * ( --something | --somethingElse | --anotherOne | -s | -a ):namedGroup @@ -363,8 +375,7 @@ protected function parseDefinition($def) \) (?:\:(?P[a-zA-Z0-9]+))? (?:\ +|$) - /sx', $def, $m, 0, $pos - )) { + /sx', $def, $m, 0, $pos)) { // extract available options $options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY); @@ -378,15 +389,16 @@ protected function parseDefinition($def) // prepare item $item = [ - 'name' => isset($m['groupName']) ? $m['groupName']:'unnamedGroupAt' . $unnamedGroupCounter++, + 'name' => isset($m['groupName']) + ? $m['groupName'] + : 'unnamedGroupAt' . $unnamedGroupCounter++, 'literal' => false, 'required' => true, 'positional' => false, 'alternatives' => $options, 'hasValue' => false, ]; - } - /** + } /** * Optional flag alternative * [ --something | --somethingElse | --anotherOne | -s | -a ] * [ --something | --somethingElse | --anotherOne | -s | -a ]:namedGroup @@ -406,8 +418,7 @@ protected function parseDefinition($def) \] (?:\:(?P[a-zA-Z0-9]+))? (?:\ +|$) - /sx', $def, $m, 0, $pos - )) { + /sx', $def, $m, 0, $pos)) { // extract available options $options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY); @@ -421,7 +432,9 @@ protected function parseDefinition($def) // prepare item $item = [ - 'name' => isset($m['groupName']) ? $m['groupName']:'unnamedGroupAt' . $unnamedGroupCounter++, + 'name' => isset($m['groupName']) + ? $m['groupName'] + : 'unnamedGroupAt' . $unnamedGroupCounter++, 'literal' => false, 'required' => false, 'positional' => false, @@ -563,15 +576,13 @@ public function match($params) } - if (!$param) { + if (! $param) { /* * Drop out if that was a mandatory param */ if ($part['required']) { return; - } - - /* + } /* * Continue to next positional param */ else { @@ -583,7 +594,7 @@ public function match($params) /* * Value for flags is always boolean */ - if ($param && !$part['hasValue']) { + if ($param && ! $part['hasValue']) { $value = true; } @@ -591,7 +602,7 @@ public function match($params) * Try to retrieve value if it is expected */ if ((null === $value || "" === $value) && $part['hasValue']) { - if ($x < count($params)+1 && isset($params[$x])) { + if ($x < count($params) + 1 && isset($params[$x])) { // retrieve value from adjacent param $value = $params[$x]; @@ -607,9 +618,7 @@ public function match($params) * Validate the value against constraints */ if ($part['hasValue'] && isset($this->constraints[$part['name']])) { - if ( - !preg_match($this->constraints[$part['name']], $value) - ) { + if (! preg_match($this->constraints[$part['name']], $value)) { // constraint failed return; } @@ -630,17 +639,17 @@ public function match($params) if (isset($part['alternatives'])) { if ($part['hasValue']) { foreach ($part['alternatives'] as $alt) { - if ($alt === $matchedName && !isset($matches[$alt])) { + if ($alt === $matchedName && ! isset($matches[$alt])) { $matches[$alt] = $value; - } elseif (!isset($matches[$alt])) { + } elseif (! isset($matches[$alt])) { $matches[$alt] = null; } } } else { foreach ($part['alternatives'] as $alt) { - if ($alt === $matchedName && !isset($matches[$alt])) { - $matches[$alt] = isset($this->defaults[$alt])? $this->defaults[$alt] : true; - } elseif (!isset($matches[$alt])) { + if ($alt === $matchedName && ! isset($matches[$alt])) { + $matches[$alt] = isset($this->defaults[$alt]) ? $this->defaults[$alt] : true; + } elseif (! isset($matches[$alt])) { $matches[$alt] = false; } } @@ -665,7 +674,7 @@ public function match($params) /* * Check if param exists */ - if (!isset($params[$argPos])) { + if (! isset($params[$argPos])) { if ($part['required']) { // cannot find required positional param return; @@ -681,9 +690,9 @@ public function match($params) * Check if literal param matches */ if ($part['literal']) { - if ( - (isset($part['alternatives']) && !in_array($value, $part['alternatives'])) || - (!isset($part['alternatives']) && $value != $part['name']) + if ((isset($part['alternatives']) + && ! in_array($value, $part['alternatives'])) + || (! isset($part['alternatives']) && $value != $part['name']) ) { return; } @@ -693,9 +702,7 @@ public function match($params) * Validate the value against constraints */ if ($part['hasValue'] && isset($this->constraints[$part['name']])) { - if ( - !preg_match($this->constraints[$part['name']], $value) - ) { + if (! preg_match($this->constraints[$part['name']], $value)) { // constraint failed return; } @@ -710,7 +717,7 @@ public function match($params) // from all alternatives set matching parameter to TRUE and the rest to FALSE foreach ($part['alternatives'] as $alt) { if ($alt == $value) { - $matches[$alt] = isset($this->defaults[$alt])? $this->defaults[$alt] : true; + $matches[$alt] = isset($this->defaults[$alt]) ? $this->defaults[$alt] : true; } else { $matches[$alt] = false; } @@ -718,10 +725,10 @@ public function match($params) // set alternatives group value $matches[$part['name']] = $value; - } elseif (!$part['required']) { + } elseif (! $part['required']) { // set optional parameter flag $name = $part['name']; - $matches[$name] = isset($this->defaults[$name])? $this->defaults[$name] : true; + $matches[$name] = isset($this->defaults[$name]) ? $this->defaults[$name] : true; } /* @@ -741,14 +748,14 @@ public function match($params) * Any optional flags that were not entered have value false */ foreach ($this->parts as &$part) { - if (!$part['required'] && !$part['hasValue']) { - if (!isset($matches[$part['name']])) { + if (! $part['required'] && ! $part['hasValue']) { + if (! isset($matches[$part['name']])) { $matches[$part['name']] = false; } // unset alternatives also should be false if (isset($part['alternatives'])) { foreach ($part['alternatives'] as $alt) { - if (!isset($matches[$alt])) { + if (! isset($matches[$alt])) { $matches[$alt] = false; } } @@ -771,7 +778,7 @@ public function match($params) } } - if (!$valid) { + if (! $valid) { return; } diff --git a/test/GetoptTest.php b/test/GetoptTest.php index 0c216e5..e6597fa 100644 --- a/test/GetoptTest.php +++ b/test/GetoptTest.php @@ -34,12 +34,14 @@ public function testGetoptShortOptionsGnuMode() public function testGetoptLongOptionsZendMode() { - $opts = new Getopt([ + $opts = new Getopt( + [ 'apple|a' => 'Apple option', 'banana|b' => 'Banana option', 'pear|p=s' => 'Pear option' ], - ['-a', '-p', 'p_arg']); + ['-a', '-p', 'p_arg'] + ); $this->assertTrue($opts->apple); $this->assertNull(@$opts->banana); $this->assertEquals($opts->pear, 'p_arg'); @@ -47,12 +49,14 @@ public function testGetoptLongOptionsZendMode() public function testGetoptZendModeEqualsParam() { - $opts = new Getopt([ + $opts = new Getopt( + [ 'apple|a' => 'Apple option', 'banana|b' => 'Banana option', 'pear|p=s' => 'Pear option' ], - ['--pear=pear.phpunit.de']); + ['--pear=pear.phpunit.de'] + ); $this->assertEquals($opts->pear, 'pear.phpunit.de'); } @@ -77,35 +81,45 @@ public function testGetoptDumpArray() public function testGetoptDumpJson() { $opts = new Getopt('abp:', ['-a', '-p', 'p_arg']); - $this->assertEquals($opts->toJson(), - '{"options":[{"option":{"flag":"a","parameter":true}},{"option":{"flag":"p","parameter":"p_arg"}}]}'); + $this->assertEquals( + $opts->toJson(), + '{"options":[{"option":{"flag":"a","parameter":true}},{"option":{"flag":"p","parameter":"p_arg"}}]}' + ); } public function testGetoptDumpXml() { $opts = new Getopt('abp:', ['-a', '-p', 'p_arg']); - $this->assertEquals($opts->toXml(), - "\n\n"); + $this->assertEquals( + $opts->toXml(), + "\n\n" + ); } public function testGetoptExceptionForMissingFlag() { - $this->setExpectedException('\Zend\Console\Exception\InvalidArgumentException', 'Blank flag not allowed in rule'); - $opts = new Getopt(['|a'=>'Apple option']); + $this->setExpectedException( + '\Zend\Console\Exception\InvalidArgumentException', + 'Blank flag not allowed in rule' + ); + $opts = new Getopt(['|a' => 'Apple option']); } public function testGetoptExceptionForKeyWithDuplicateFlagsViaOrOperator() { $this->setExpectedException('\Zend\Console\Exception\InvalidArgumentException', 'defined more than once'); $opts = new Getopt( - ['apple|apple'=>'apple-option']); + ['apple|apple' => 'apple-option'] + ); } public function testGetoptExceptionForKeysThatDuplicateFlags() { $this->setExpectedException('\Zend\Console\Exception\InvalidArgumentException', 'defined more than once'); $opts = new Getopt( - ['a'=>'Apple option', 'apple|a'=>'Apple option']); + ['a' => 'Apple option', 'apple|a' => 'Apple option'] + ); } public function testGetoptAddRules() @@ -115,7 +129,8 @@ public function testGetoptAddRules() 'apple|a' => 'Apple option', 'banana|b' => 'Banana option' ], - ['--pear', 'pear_param']); + ['--pear', 'pear_param'] + ); try { $opts->parse(); $this->fail('Expected to catch Zend\Console\Exception\RuntimeException'); @@ -133,7 +148,8 @@ public function testGetoptExceptionMissingParameter() 'apple|a=s' => 'Apple with required parameter', 'banana|b' => 'Banana' ], - ['--apple']); + ['--apple'] + ); $this->setExpectedException('\Zend\Console\Exception\RuntimeException', 'requires a parameter'); $opts->parse(); } @@ -145,15 +161,19 @@ public function testGetoptOptionalParameter() 'apple|a-s' => 'Apple with optional parameter', 'banana|b' => 'Banana' ], - ['--apple', '--banana']); + ['--apple', '--banana'] + ); $this->assertTrue($opts->apple); $this->assertTrue($opts->banana); } public function testGetoptIgnoreCaseGnuMode() { - $opts = new Getopt('aB', ['-A', '-b'], - [Getopt::CONFIG_IGNORECASE => true]); + $opts = new Getopt( + 'aB', + ['-A', '-b'], + [Getopt::CONFIG_IGNORECASE => true] + ); $this->assertEquals(true, $opts->a); $this->assertEquals(true, $opts->B); } @@ -166,7 +186,8 @@ public function testGetoptIgnoreCaseZendMode() 'Banana|B' => 'Banana-option' ], ['--Apple', '--bAnaNa'], - [Getopt::CONFIG_IGNORECASE => true]); + [Getopt::CONFIG_IGNORECASE => true] + ); $this->assertEquals(true, $opts->apple); $this->assertEquals(true, $opts->BANANA); } @@ -251,8 +272,11 @@ public function testGetoptRemainingArgs() public function testGetoptDashDashFalse() { - $opts = new Getopt('abp:', ['-a', '--', '--fakeflag'], - [Getopt::CONFIG_DASHDASH => false]); + $opts = new Getopt( + 'abp:', + ['-a', '--', '--fakeflag'], + [Getopt::CONFIG_DASHDASH => false] + ); $this->setExpectedException('\Zend\Console\Exception\RuntimeException', 'not recognized'); $opts->parse(); } @@ -266,31 +290,42 @@ public function testGetoptGetOptions() public function testGetoptGetUsageMessage() { $opts = new Getopt('abp:', ['-x']); - $message = preg_replace('/Usage: .* \[ options \]/', + $message = preg_replace( + '/Usage: .* \[ options \]/', 'Usage: [ options ]', - $opts->getUsageMessage()); + $opts->getUsageMessage() + ); $message = preg_replace('/ /', '_', $message); - $this->assertEquals($message, - "Usage:__[_options_]\n-a___________________\n-b___________________\n-p___________\n"); + $this->assertEquals( + $message, + "Usage:__[_options_]\n-a___________________\n-b___________________\n-p___________\n" + ); } public function testGetoptUsageMessageFromException() { try { - $opts = new Getopt([ + $opts = new Getopt( + [ 'apple|a-s' => 'apple', 'banana1|banana2|banana3|banana4' => 'banana', 'pear=s' => 'pear'], - ['-x']); + ['-x'] + ); $opts->parse(); $this->fail('Expected to catch \Zend\Console\Exception\RuntimeException'); } catch (\Zend\Console\Exception\RuntimeException $e) { - $message = preg_replace('/Usage: .* \[ options \]/', + $message = preg_replace( + '/Usage: .* \[ options \]/', 'Usage: [ options ]', - $e->getUsageMessage()); + $e->getUsageMessage() + ); $message = preg_replace('/ /', '_', $message); - $this->assertEquals($message, - "Usage:__[_options_]\n--apple|-a_[__]_________________apple\n--banana1|--banana2|--banana3|--banana4_banana\n--pear__________________________pear\n"); + $this->assertEquals( + $message, + "Usage:__[_options_]\n--apple|-a_[__]_________________apple\n" + . "--banana1|--banana2|--banana3|--banana4_banana\n--pear__________________________pear\n" + ); } } @@ -303,8 +338,11 @@ public function testGetoptSetAliases() public function testGetoptSetAliasesIgnoreCase() { - $opts = new Getopt('abp:', ['--apple'], - [Getopt::CONFIG_IGNORECASE => true]); + $opts = new Getopt( + 'abp:', + ['--apple'], + [Getopt::CONFIG_IGNORECASE => true] + ); $opts->setAliases(['a' => 'APPLE']); $this->assertTrue($opts->apple); } @@ -335,12 +373,17 @@ public function testGetoptSetHelp() 'a' => 'apple', 'b' => 'banana', 'p' => 'pear']); - $message = preg_replace('/Usage: .* \[ options \]/', + $message = preg_replace( + '/Usage: .* \[ options \]/', 'Usage: [ options ]', - $opts->getUsageMessage()); + $opts->getUsageMessage() + ); $message = preg_replace('/ /', '_', $message); - $this->assertEquals($message, - "Usage:__[_options_]\n-a___________________apple\n-b___________________banana\n-p___________pear\n"); + $this->assertEquals( + $message, + "Usage:__[_options_]\n-a___________________apple\n-b___________________banana\n" + . "-p___________pear\n" + ); } public function testGetoptSetHelpInvalid() @@ -351,12 +394,17 @@ public function testGetoptSetHelpInvalid() 'b' => 'banana', 'p' => 'pear', 'c' => 'cumquat']); - $message = preg_replace('/Usage: .* \[ options \]/', + $message = preg_replace( + '/Usage: .* \[ options \]/', 'Usage: [ options ]', - $opts->getUsageMessage()); + $opts->getUsageMessage() + ); $message = preg_replace('/ /', '_', $message); - $this->assertEquals($message, - "Usage:__[_options_]\n-a___________________apple\n-b___________________banana\n-p___________pear\n"); + $this->assertEquals( + $message, + "Usage:__[_options_]\n-a___________________apple\n-b___________________banana\n" + . "-p___________pear\n" + ); } public function testGetoptCheckParameterType() @@ -378,7 +426,10 @@ public function testGetoptCheckParameterType() $opts->parse(); $this->fail('Expected to catch \Zend\Console\Exception\RuntimeException'); } catch (\Zend\Console\Exception\RuntimeException $e) { - $this->assertEquals($e->getMessage(), 'Option "apple" requires an integer parameter, but was given "noninteger".'); + $this->assertEquals( + $e->getMessage(), + 'Option "apple" requires an integer parameter, but was given "noninteger".' + ); } $opts->setArguments(['-b', 'word']); @@ -389,7 +440,10 @@ public function testGetoptCheckParameterType() $opts->parse(); $this->fail('Expected to catch \Zend\Console\Exception\RuntimeException'); } catch (\Zend\Console\Exception\RuntimeException $e) { - $this->assertEquals($e->getMessage(), 'Option "banana" requires a single-word parameter, but was given "two words".'); + $this->assertEquals( + $e->getMessage(), + 'Option "banana" requires a single-word parameter, but was given "two words".' + ); } $opts->setArguments(['-p', 'string']); @@ -437,13 +491,13 @@ public function testDashWithinLongOptionGetsParsed() [ // rules 'man-bear|m-s' => 'ManBear with dash', 'man-bear-pig|b=s' => 'ManBearPid with dash', - ], + ], [ // arguments '--man-bear-pig=mbp', '--man-bear', 'foobar' - ] - ); + ] + ); $opts->parse(); $this->assertEquals('foobar', $opts->getOption('man-bear')); @@ -458,9 +512,9 @@ public function testAddRulesDoesNotThrowWarnings() // Fails if warning is thrown: Should not happen! $opts = new Getopt('abp:'); $opts->addRules( - [ + [ 'verbose|v' => 'Print verbose output' - ] + ] ); } @@ -533,8 +587,11 @@ public function testGetoptIgnoreCumulativeFlagsByDefault() public function testGetoptWithCumulativeFlagsOptionHandleCountOfEqualFlags() { - $opts = new Getopt('v', ['-v', '-v', '-v'], - [Getopt::CONFIG_CUMULATIVE_FLAGS => true]); + $opts = new Getopt( + 'v', + ['-v', '-v', '-v'], + [Getopt::CONFIG_CUMULATIVE_FLAGS => true] + ); $this->assertEquals(3, $opts->v); } @@ -604,9 +661,11 @@ public function testGetoptWithFreeformFlagOptionShowHelpAfterParseDoesNotShowFre ); $opts->parse(); - $message = preg_replace('/Usage: .* \[ options \]/', + $message = preg_replace( + '/Usage: .* \[ options \]/', 'Usage: [ options ]', - $opts->getUsageMessage()); + $opts->getUsageMessage() + ); $message = preg_replace('/ /', '_', $message); $this->assertEquals($message, "Usage:__[_options_]\n--colors_____________Colors-option\n"); } @@ -711,7 +770,9 @@ public function testOptionCallbackNotCalled() public function testOptionCallbackReturnsFallsAndThrowException() { $opts = new Getopt('x', ['-x']); - $opts->setOptionCallback('x', function () {return false;}); + $opts->setOptionCallback('x', function () { + return false; + }); $opts->parse(); } } diff --git a/test/ResponseTest.php b/test/ResponseTest.php index ba3f5d9..24a122b 100644 --- a/test/ResponseTest.php +++ b/test/ResponseTest.php @@ -67,7 +67,8 @@ public function testSetErrorLevelWithNonIntValueIsNotSet() public function testSetContentWithExit() { if (!function_exists('set_exit_overload')) { - $this->markTestSkipped("Install ext/test_helpers to test method with exit : https://github.com/sebastianbergmann/php-test-helpers."); + $this->markTestSkipped("Install ext/test_helpers to test method with exit : + https://github.com/sebastianbergmann/php-test-helpers."); } $self = $this; diff --git a/test/RouteMatcher/DefaultRouteMatcherTest.php b/test/RouteMatcher/DefaultRouteMatcherTest.php index 38f20b2..e7a004e 100644 --- a/test/RouteMatcher/DefaultRouteMatcherTest.php +++ b/test/RouteMatcher/DefaultRouteMatcherTest.php @@ -370,12 +370,12 @@ public static function routeProvider() 'mandatory-literal-namedAlternative-match-1' => [ 'foo ( bar | baz ):altGroup', ['foo','bar'], - ['foo' => null, 'altGroup'=>'bar', 'bar' => true, 'baz' => false] + ['foo' => null, 'altGroup' => 'bar', 'bar' => true, 'baz' => false] ], 'mandatory-literal-namedAlternative-match-2' => [ 'foo ( bar | baz ):altGroup9', ['foo','baz'], - ['foo' => null, 'altGroup9'=>'baz', 'bar' => false, 'baz' => true] + ['foo' => null, 'altGroup9' => 'baz', 'bar' => false, 'baz' => true] ], 'mandatory-literal-namedAlternative-mismatch' => [ 'foo ( bar | baz ):altGroup9', @@ -437,7 +437,7 @@ public static function routeProvider() 'optional-literal-namedAlternative-mismatch' => [ 'foo [ bar | baz ]:altGroup9', ['foo'], - ['foo' => null, 'altGroup9'=> null, 'bar' => false, 'baz' => false] + ['foo' => null, 'altGroup9' => null, 'bar' => false, 'baz' => false] ], // -- value params @@ -631,7 +631,7 @@ public static function routeProvider() 'baz' => true ] ], - // group with group name diferent than options (short) + // group with group name different than options (short) 'group-1' => [ 'group [-t|--test]:testgroup', ['group', '-t'], @@ -640,7 +640,7 @@ public static function routeProvider() 'testgroup' => true, ] ], - // group with group name diferent than options (long) + // group with group name different than options (long) 'group-2' => [ 'group [-t|--test]:testgroup', ['group', '--test'], @@ -955,7 +955,7 @@ public function testMatching($routeDefinition, array $arguments = [], array $par foreach ($params as $key => $value) { $this->assertEquals( $value, - isset($match[$key])?$match[$key]:null, + isset($match[$key]) ? $match[$key] : null, $value === null ? "Param $key is not present" : "Param $key is present and is equal to $value" ); } @@ -1066,7 +1066,7 @@ public function testMatchingWithDefaults( foreach ($params as $key => $value) { $this->assertSame( $value, - isset($match[$key])?$match[$key]:null, + isset($match[$key]) ? $match[$key] : null, $value === null ? "Param $key is not present" : "Param $key is present and is equal to '$value'" ); } @@ -1246,7 +1246,7 @@ public function testMatchingWithAliases( foreach ($params as $key => $value) { $this->assertEquals( $value, - isset($match[$key])?$match[$key]:null, + isset($match[$key]) ? $match[$key] : null, $value === null ? "Param $key is not present" : "Param $key is present and is equal to $value" ); } @@ -1379,7 +1379,7 @@ public function testParamsCanBeFiltered($routeDefinition, $filters, $arguments, foreach ($params as $key => $value) { $this->assertEquals( $value, - isset($match[$key])?$match[$key]:null, + isset($match[$key]) ? $match[$key] : null, $value === null ? "Param $key is not present" : "Param $key is present and is equal to $value" ); } diff --git a/test/TestAssets/ConsoleAdapter.php b/test/TestAssets/ConsoleAdapter.php index 2a0d511..90b3337 100644 --- a/test/TestAssets/ConsoleAdapter.php +++ b/test/TestAssets/ConsoleAdapter.php @@ -24,7 +24,7 @@ class ConsoleAdapter extends AbstractAdapter public $testIsUtf8 = true; - public $writtenData = array(); + public $writtenData = []; /** * Construct. diff --git a/test/bootstrap.php b/test/bootstrap.php deleted file mode 100644 index c09729d..0000000 --- a/test/bootstrap.php +++ /dev/null @@ -1,34 +0,0 @@ -