From 0d519a23daa50f3df306bfc12b3cc92b78da830e Mon Sep 17 00:00:00 2001 From: Daniel Bannert Date: Mon, 20 Feb 2017 20:00:33 +0100 Subject: [PATCH] Develop (#21) * rename function * update readme * rename function (#11) (#15) * rename function * update readme * fixes #14 | added missing MisdirectedRequestException for error code 421 (#17) * fixes #14, fixes #13 and added missing MisdirectedRequestException for error code 421 * Issue 16 (#20) fixes #16 --- .php_cs | 1 - .scrutinizer.yml | 104 --- .styleci.yml | 84 +- .travis.yml | 11 +- CHANGELOG.md | 18 + LICENSE | 2 +- README.md | 18 +- composer.json | 9 +- composer.lock | 730 ++++++++++++------ .../AbstractClientErrorException.php | 1 + .../AbstractServerErrorException.php | 1 + src/Exception/BadGatewayException.php | 1 + src/Exception/BadRequestException.php | 1 + src/Exception/ConflictException.php | 1 + src/Exception/ExpectationFailedException.php | 1 + src/Exception/FailedDependencyException.php | 1 + src/Exception/ForbiddenException.php | 1 + src/Exception/GatewayTimeoutException.php | 1 + src/Exception/GoneException.php | 1 + .../HttpVersionNotSupportedException.php | 1 + src/Exception/ImATeapotException.php | 1 + .../InsufficientStorageException.php | 1 + .../InternalServerErrorException.php | 1 + src/Exception/LengthRequiredException.php | 1 + src/Exception/LockedException.php | 1 + src/Exception/LoopDetectedException.php | 1 + src/Exception/MethodNotAllowedException.php | 1 + src/Exception/MisdirectedRequestException.php | 16 + ...NetworkAuthenticationRequiredException.php | 1 + src/Exception/NotAcceptableException.php | 1 + src/Exception/NotExtendedException.php | 1 + src/Exception/NotFoundException.php | 1 + src/Exception/NotImplementedException.php | 1 + ...ption.php => PayloadTooLargeException.php} | 5 +- src/Exception/PaymentRequiredException.php | 1 + src/Exception/PreconditionFailedException.php | 1 + .../PreconditionRequiredException.php | 1 + .../ProxyAuthenticationRequiredException.php | 1 + .../RequestHeaderFieldsTooLargeException.php | 1 + src/Exception/RequestTimeoutException.php | 1 + src/Exception/RequestUriTooLongException.php | 3 +- .../RequestedRangeNotSatisfiableException.php | 3 +- src/Exception/ServiceUnavailableException.php | 1 + src/Exception/TooManyRequestsException.php | 1 + src/Exception/UnauthorizedException.php | 1 + .../UnavailableForLegalReasonsException.php | 1 + .../UnprocessableEntityException.php | 1 + .../UnsupportedMediaTypeException.php | 1 + src/Exception/UpgradeRequiredException.php | 1 + .../VariantAlsoNegotiatesException.php | 1 + src/HttpStatus.php | 82 +- tests/HttpStatusTest.php | 117 ++- 52 files changed, 790 insertions(+), 450 deletions(-) delete mode 100644 .scrutinizer.yml create mode 100644 src/Exception/MisdirectedRequestException.php rename src/Exception/{RequestEntityTooLargeException.php => PayloadTooLargeException.php} (51%) diff --git a/.php_cs b/.php_cs index 28f0f86..ff8edfd 100644 --- a/.php_cs +++ b/.php_cs @@ -7,7 +7,6 @@ $config->getFinder() ->in(__DIR__) ->exclude('build') ->exclude('vendor') - ->exclude('tests') ->name('*.php') ->ignoreDotFiles(true) ->ignoreVCS(true); diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 399c8c7..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,104 +0,0 @@ - -filter: - paths: ['src/*'] - excluded_paths: [tests/*, vendor/*] - -checks: - php: - code_rating: true - remove_extra_empty_lines: true - remove_php_closing_tag: true - remove_trailing_whitespace: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: true - order_alphabetically: true - fix_php_opening_tag: true - fix_linefeed: true - fix_line_ending: true - fix_identation_4spaces: true - fix_doc_comments: true - no_unnecessary_function_call_in_for_loop: true - avoid_unnecessary_concatenation: true - duplication: true - prefer_sapi_constant: true - variable_existence: true - useless_calls: true - use_statement_alias_conflict: true - unused_variables: true - unused_properties: true - unused_parameters: true - unused_methods: true - unreachable_code: true - sql_injection_vulnerabilities: true - security_vulnerabilities: true - precedence_mistakes: true - precedence_in_conditions: true - parameter_non_unique: true - no_property_on_interface: true - no_non_implemented_abstract_methods: true - deprecated_code_usage: true - closure_use_not_conflicting: true - closure_use_modifiable: true - avoid_useless_overridden_methods: true - avoid_conflicting_incrementers: true - assignment_of_null_return: true - verify_access_scope_valid: true - too_many_arguments: true - symfony_request_injection: true - parameter_doc_comments: true - argument_type_checks: true - avoid_corrupting_byteorder_marks: true - avoid_entity_manager_injection: true - catch_class_exists: true - encourage_shallow_comparison: false - foreach_traversable: true - foreach_usable_as_reference: true - instanceof_class_exists: true - method_calls_on_non_object: true - missing_arguments: true - no_duplicate_arguments: false - require_php_tag_first: true - return_doc_comments: true - verify_property_names: true - verify_argument_usable_as_reference: true - use_self_instead_of_fqcn: true - uppercase_constants: true - simplify_boolean_return: true - properties_in_camelcaps: true - prefer_while_loop_over_for_loop: true - phpunit_assertions: true - parameters_in_camelcaps: true - param_doc_comment_if_not_inferrable: true - optional_parameters_at_the_end: true - no_short_variable_names: - minimum: '3' - no_short_method_names: - minimum: '' - no_goto: true - newline_at_end_of_file: true - more_specific_types_in_doc_comments: true - line_length: - max_length: '160' - function_in_camel_caps: true - fix_line_ending: true - encourage_single_quotes: true - encourage_postdec_operator: true - classes_in_camel_caps: true - avoid_unnecessary_concatenation: true - avoid_todo_comments: true - avoid_multiple_statements_on_same_line: true - avoid_fixme_comments: true - -build: - environment: - php: '5.6' - dependencies: - override: - - 'composer install' - -tools: - external_code_coverage: - timeout: 600 - runs: 3 diff --git a/.styleci.yml b/.styleci.yml index ea5b31e..c44cfca 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,60 +1,44 @@ -preset: psr2 +preset: recommended -risky: false +risky: true linting: true +finder: + exclude: + - vendor + - build + enabled: + - align_equals + - combine_consecutive_unsets - concat_with_spaces - - function_typehint_space - - newline_after_open_tag + - declare_strict_types + - dir_constant + - ereg_to_preg + - mb_str_functions + - modernize_types_casting + - no_blank_lines_after_return - no_blank_lines_before_namespace - - ordered_use - - phpdoc_order - - short_array_syntax - - alias_functions - - array_element_no_space_before_comma - - array_element_white_space_after_comma - - double_arrow_multiline_whitespaces - - duplicate_semicolon - - empty_return - - extra_empty_lines - - include - - list_commas - - method_separation - - multiline_array_trailing_comma - - namespace_no_leading_whitespace - - new_with_braces - - no_blank_lines_after_class_opening - - no_empty_lines_after_phpdocs - - object_operator - - operators_spaces - - phpdoc_align - - phpdoc_indent - - phpdoc_inline_tag - - phpdoc_no_access - - phpdoc_no_empty_return - - phpdoc_no_package - - phpdoc_scalar - - phpdoc_separation - - phpdoc_to_comment - - phpdoc_trim - - phpdoc_types - - phpdoc_type_to_var - - phpdoc_var_without_name - - remove_leading_slash_use - - return - - short_bool_cast - - single_array_no_trailing_comma - - single_quote - - spaces_after_semicolon - - spaces_before_semicolon - - spaces_cast - - standardize_not_equal - - ternary_spaces - - trim_array_spaces - - unneeded_control_parentheses - - whitespacy_lines + - no_empty_comment + - no_useless_else + - ordered_class_elements + - php_unit_construct + - php_unit_dedicate_assert + - phpdoc_add_missing_param_annotation + - pow_to_exponentiation + - protected_to_private + - random_api_migration + - return_type_declaration + - not_operator_with_successor_space + +disabled: + - blank_line_after_opening_tag + - unalign_equals + - self_accessor + - concat_without_spaces + - single_blank_line_before_namespace + - simplified_null_return finder: exclude: diff --git a/.travis.yml b/.travis.yml index 716e5f5..f43709e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,18 +3,10 @@ language: php sudo: false php: - - 5.6 - 7.0 + - 7.1 matrix: - include: - # Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version - - php: hhvm - sudo: required - dist: trusty - group: edge - allow_failures: - - php: hhvm fast_finish: true cache: @@ -23,7 +15,6 @@ cache: - $HOME/.php-cs-fixer before_install: - - composer self-update - composer validate install: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b13b99..c0d066e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,24 @@ # Changelog All Notable changes to `http-status` will be documented in this file +## NEXT - 2017-02-20 + +### Added +- MisdirectedRequestException, the error code 421 and the status message. +- Support for [http-message-util](//github.com/php-fig/http-message-util) +- Tests against iana.org + +### Deprecated +- Nothing + +### Fixed +- Nothing + +### Removed +- Support for php 5.6 and hhvm + +### Security +- Nothing ## NEXT - 2016-06-22 diff --git a/LICENSE b/LICENSE index 5869406..bb25cbe 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2016 Narrowspark +Copyright (c) 2015-2017 Narrowspark Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d720b3b..1e30536 100644 --- a/README.md +++ b/README.md @@ -21,25 +21,29 @@ $ composer require narrowspark/http-status ## Usage ``` php - use Narrowspark\HttpStatus\HttpStatus; // get status message from code echo HttpStatus::getReasonMessage(301); // This and all future requests should be directed to the given URI. -// get status name from code -echo HttpStatus::getReasonPhrase(301); // Moved Permanently - try { HttpStatus::getReasonException(301): } catch(/Exception $e) { echo $e->getMessage(); // 301 Moved Permanently echo $e->getCode(); // 301 } +``` + +### Now we have support for ([http-message-util](//github.com/php-fig/http-message-util)) so you can do something like this: +``` php +use Narrowspark\HttpStatus\HttpStatus; + +// get status name from code +echo HttpStatus::getReasonPhrase(HttpStatus::STATUS_MOVED_PERMANENTLY); // Moved Permanently ``` -## HTTP status code classes ([from RFC7231](https://tools.ietf.org/html/rfc7231#section-6)) +## HTTP status code classes ([from RFC7231](//tools.ietf.org/html/rfc7231#section-6)) The first digit of the status-code defines the class of response. The last two digits do not have any categorization role. There are five values for the first digit: @@ -111,7 +115,9 @@ Code | Message | RFC 429 | Too Many Requests | [RFC6585] 430 | *Unassigned* | 431 | Request Header Fields Too Large | [RFC6585] -432-499 | *Unassigned* | +432-450 | *Unassigned* | +451 | Unavailable For Legal | [RFC7725] +452-499 | *Unassigned* | 500 | Internal Server Error | [RFC7231, Section 6.6.1] 501 | Not Implemented | [RFC7231, Section 6.6.2] 502 | Bad Gateway | [RFC7231, Section 6.6.3] diff --git a/composer.json b/composer.json index c9226a3..373b112 100644 --- a/composer.json +++ b/composer.json @@ -20,11 +20,12 @@ } ], "require": { - "php" : "^5.6 || ^7.0" + "php" : "^7.0", + "fig/http-message-util" : "^1.1" }, "require-dev": { - "narrowspark/php-cs-fixer-config" : "^1.4", - "phpunit/phpunit" : "^4.8 || ^5.1" + "narrowspark/php-cs-fixer-config" : "^2.2", + "phpunit/phpunit" : "^6.0" }, "provide": { "psr/http-message-implementation" : "^1.0" @@ -41,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-master" : "2.0-dev" + "dev-master" : "3.0-dev" } }, "suggest": { diff --git a/composer.lock b/composer.lock index 8622e28..5e023e1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,109 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "21aa17a168c01f8c5328eb78c344c109", - "content-hash": "1b37a4675649861f5d44721ae83da1b4", - "packages": [], + "content-hash": "5d57434fefa40f3cf286961d4aa879ea", + "packages": [ + { + "name": "fig/http-message-util", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "20b2c280cb6914b7b83089720df44e490f4b42f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/20b2c280cb6914b7b83089720df44e490f4b42f0", + "reference": "20b2c280cb6914b7b83089720df44e490f4b42f0", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2017-02-09T16:10:21+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + } + ], "packages-dev": [ { "name": "doctrine/instantiator", @@ -60,46 +160,47 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.0.0-alpha", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "d0d76b434728fcf522270b67b454ed7e84e850ed" + "reference": "2c69f4d424f85062fe40f7689797d6d32c76b711" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d0d76b434728fcf522270b67b454ed7e84e850ed", - "reference": "d0d76b434728fcf522270b67b454ed7e84e850ed", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/2c69f4d424f85062fe40f7689797d6d32c76b711", + "reference": "2c69f4d424f85062fe40f7689797d6d32c76b711", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^5.3.6 || ^7.0", + "php": "^5.3.6 || >=7.0 <7.2", "sebastian/diff": "^1.1", "symfony/console": "^2.3 || ^3.0", "symfony/event-dispatcher": "^2.1 || ^3.0", - "symfony/filesystem": "^2.7 || ^3.0", + "symfony/filesystem": "^2.4 || ^3.0", "symfony/finder": "^2.2 || ^3.0", "symfony/polyfill-php54": "^1.0", + "symfony/polyfill-php55": "^1.3", "symfony/process": "^2.3 || ^3.0", "symfony/stopwatch": "^2.5 || ^3.0" }, + "conflict": { + "hhvm": "<3.9" + }, "require-dev": { + "gecko-packages/gecko-php-unit": "^2.0", + "phpunit/phpunit": "^4.5|^5", "satooshi/php-coveralls": "^1.0" }, "bin": [ "php-cs-fixer" ], "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -120,20 +221,62 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2016-05-26 23:59:22" + "time": "2017-02-10T15:37:50+00:00" + }, + { + "name": "ircmaxell/password-compat", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/password_compat.git", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/password.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@php.net", + "homepage": "http://blog.ircmaxell.com" + } + ], + "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", + "homepage": "https://github.com/ircmaxell/password_compat", + "keywords": [ + "hashing", + "password" + ], + "time": "2014-11-20T16:49:30+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "a8773992b362b58498eed24bf85005f363c34771" + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a8773992b362b58498eed24bf85005f363c34771", - "reference": "a8773992b362b58498eed24bf85005f363c34771", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", "shasum": "" }, "require": { @@ -162,28 +305,28 @@ "object", "object graph" ], - "time": "2015-11-20 12:04:31" + "time": "2017-01-26T22:05:40+00:00" }, { "name": "narrowspark/php-cs-fixer-config", - "version": "v1.4.1", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/narrowspark/php-cs-fixer-config.git", - "reference": "1b91ec2ec9d9b1ff38c4ebfeeec7bc9b75b1b980" + "reference": "60d8eb5d17f30beeb5fde8dcd56736fea7359b27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/narrowspark/php-cs-fixer-config/zipball/1b91ec2ec9d9b1ff38c4ebfeeec7bc9b75b1b980", - "reference": "1b91ec2ec9d9b1ff38c4ebfeeec7bc9b75b1b980", + "url": "https://api.github.com/repos/narrowspark/php-cs-fixer-config/zipball/60d8eb5d17f30beeb5fde8dcd56736fea7359b27", + "reference": "60d8eb5d17f30beeb5fde8dcd56736fea7359b27", "shasum": "" }, "require": { - "friendsofphp/php-cs-fixer": "2.0.0-alpha", - "php": "^5.6 || ^7.0" + "friendsofphp/php-cs-fixer": "^2.0", + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.3" + "phpunit/phpunit": "^5.1" }, "type": "library", "autoload": { @@ -212,7 +355,7 @@ "narrowspark", "php-cs-fixer" ], - "time": "2016-06-01 18:55:38" + "time": "2016-12-18T12:53:34+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -266,20 +409,20 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2015-12-27T11:43:31+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { @@ -311,20 +454,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-06-10 09:48:41" + "time": "2016-09-30T07:12:33+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", "shasum": "" }, "require": { @@ -358,20 +501,20 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-06-10 07:14:17" + "time": "2016-11-25T06:54:22+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.1", + "version": "v1.6.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", "shasum": "" }, "require": { @@ -379,10 +522,11 @@ "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0" + "sebastian/recursion-context": "^1.0|^2.0" }, "require-dev": { - "phpspec/phpspec": "^2.0" + "phpspec/phpspec": "^2.0", + "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", "extra": { @@ -420,44 +564,43 @@ "spy", "stub" ], - "time": "2016-06-07 08:13:47" + "time": "2016-11-21T14:58:47+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "900370c81280cc0d942ffbc5912d80464eaee7e9" + "reference": "e7d7a4acca58e45bdfd00221563d131cfb04ba96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/900370c81280cc0d942ffbc5912d80464eaee7e9", - "reference": "900370c81280cc0d942ffbc5912d80464eaee7e9", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e7d7a4acca58e45bdfd00221563d131cfb04ba96", + "reference": "e7d7a4acca58e45bdfd00221563d131cfb04ba96", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0|~2.0" + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^2.0", + "sebastian/version": "^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-dom": "*", - "ext-xdebug": ">=2.4.0", "ext-xmlwriter": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -483,20 +626,20 @@ "testing", "xunit" ], - "time": "2016-06-03 05:03:56" + "time": "2017-02-02T10:35:41+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { @@ -530,7 +673,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -571,7 +714,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -615,20 +758,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2016-05-12T18:03:57+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", "shasum": "" }, "require": { @@ -664,51 +807,55 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2016-11-15T14:06:22+00:00" }, { "name": "phpunit/phpunit", - "version": "5.4.6", + "version": "6.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2f1fc94b77ea6418bd6a06c64a1dac0645fbce59" + "reference": "4601a46c162eccadffc7d5a6b1f5334df5d99713" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2f1fc94b77ea6418bd6a06c64a1dac0645fbce59", - "reference": "2f1fc94b77ea6418bd6a06c64a1dac0645fbce59", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4601a46c162eccadffc7d5a6b1f5334df5d99713", + "reference": "4601a46c162eccadffc7d5a6b1f5334df5d99713", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "^4.0", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.3", + "php": "^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^5.0", + "phpunit/php-file-iterator": "^1.4", + "phpunit/php-text-template": "^1.2", "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3 || ^2.0", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/object-enumerator": "~1.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", - "symfony/yaml": "~2.1|~3.0" + "phpunit/phpunit-mock-objects": "^4.0", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.2", + "sebastian/environment": "^2.0", + "sebastian/exporter": "^2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "^2.0", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -716,7 +863,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.4.x-dev" + "dev-master": "6.0.x-dev" } }, "autoload": { @@ -742,33 +889,33 @@ "testing", "xunit" ], - "time": "2016-06-16 06:01:15" + "time": "2017-02-19T07:25:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.2.3", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "b13d0d9426ced06958bd32104653526a6c998a52" + "reference": "3819745c44f3aff9518fd655f320c4535d541af7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b13d0d9426ced06958bd32104653526a6c998a52", - "reference": "b13d0d9426ced06958bd32104653526a6c998a52", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3819745c44f3aff9518fd655f320c4535d541af7", + "reference": "3819745c44f3aff9518fd655f320c4535d541af7", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", + "php": "^7.0", "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2" + "sebastian/exporter": "^2.0" }, "conflict": { - "phpunit/phpunit": "<5.4.0" + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-soap": "*" @@ -776,7 +923,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -801,7 +948,54 @@ "mock", "xunit" ], - "time": "2016-06-12 07:37:26" + "time": "2017-02-02T10:36:38+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -846,26 +1040,26 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2016-02-13T06:45:14+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -910,7 +1104,7 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", @@ -962,32 +1156,32 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", - "version": "1.3.7", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1012,25 +1206,25 @@ "environment", "hhvm" ], - "time": "2016-05-17 03:18:57" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "~2.0" }, "require-dev": { "ext-mbstring": "*", @@ -1039,7 +1233,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1079,7 +1273,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-11-19T08:54:04+00:00" }, { "name": "sebastian/global-state", @@ -1130,25 +1324,25 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/object-enumerator", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", - "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", "shasum": "" }, "require": { "php": ">=5.6", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "~2.0" }, "require-dev": { "phpunit/phpunit": "~5" @@ -1156,7 +1350,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1176,20 +1370,20 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-01-28 13:25:10" + "time": "2017-02-18T15:18:39+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", "shasum": "" }, "require": { @@ -1201,7 +1395,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1229,7 +1423,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2016-11-19T07:33:16+00:00" }, { "name": "sebastian/resource-operations", @@ -1271,20 +1465,20 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { @@ -1314,40 +1508,43 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-02-04 12:56:52" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/console", - "version": "v3.1.1", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "64a4d43b045f07055bb197650159769604cb2a92" + "reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/64a4d43b045f07055bb197650159769604cb2a92", - "reference": "64a4d43b045f07055bb197650159769604cb2a92", + "url": "https://api.github.com/repos/symfony/console/zipball/0e5e6899f82230fcb1153bcaf0e106ffaa44b870", + "reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870", "shasum": "" }, "require": { "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1374,20 +1571,77 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-06-14 11:18:07" + "time": "2017-02-16T14:07:22+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/9b98854cb45bc59d100b7d4cc4cf9e05f21026b9", + "reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-02-16T16:34:18+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.1.1", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f5b7563f67779c6d3d5370e23448e707c858df3e" + "reference": "9137eb3a3328e413212826d63eeeb0217836e2b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f5b7563f67779c6d3d5370e23448e707c858df3e", - "reference": "f5b7563f67779c6d3d5370e23448e707c858df3e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9137eb3a3328e413212826d63eeeb0217836e2b6", + "reference": "9137eb3a3328e413212826d63eeeb0217836e2b6", "shasum": "" }, "require": { @@ -1407,7 +1661,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1434,20 +1688,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:42:41" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/filesystem", - "version": "v3.1.1", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058" + "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5751e80d6f94b7c018f338a4a7be0b700d6f3058", - "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", + "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", "shasum": "" }, "require": { @@ -1456,7 +1710,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1483,20 +1737,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-04-12 18:27:47" + "time": "2017-01-08T20:47:33+00:00" }, { "name": "symfony/finder", - "version": "v3.1.1", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "40d17ed287bf51a2f884c4619ce8ff2a1c5cd219" + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/40d17ed287bf51a2f884c4619ce8ff2a1c5cd219", - "reference": "40d17ed287bf51a2f884c4619ce8ff2a1c5cd219", + "url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6", + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6", "shasum": "" }, "require": { @@ -1505,7 +1759,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1532,20 +1786,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-05-13 18:06:41" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "shasum": "" }, "require": { @@ -1557,7 +1811,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1591,20 +1845,20 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-php54", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1" + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1", - "reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", "shasum": "" }, "require": { @@ -1613,7 +1867,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1649,37 +1903,38 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14T01:06:16+00:00" }, { - "name": "symfony/process", - "version": "v3.1.1", + "name": "symfony/polyfill-php55", + "version": "v1.3.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "6350e63ed9c232da50e00f00a7e0330f066387a2" + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6350e63ed9c232da50e00f00a7e0330f066387a2", - "reference": "6350e63ed9c232da50e00f00a7e0330f066387a2", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", + "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", "shasum": "" }, "require": { - "php": ">=5.5.9" + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "1.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Process\\": "" + "Symfony\\Polyfill\\Php55\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1688,30 +1943,36 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", "homepage": "https://symfony.com", - "time": "2016-06-06 11:42:41" + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" }, { - "name": "symfony/stopwatch", - "version": "v3.1.1", + "name": "symfony/process", + "version": "v3.2.4", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "e7238f98c90b99e9b53f3674a91757228663b04d" + "url": "https://github.com/symfony/process.git", + "reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e7238f98c90b99e9b53f3674a91757228663b04d", - "reference": "e7238f98c90b99e9b53f3674a91757228663b04d", + "url": "https://api.github.com/repos/symfony/process/zipball/0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", + "reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", "shasum": "" }, "require": { @@ -1720,12 +1981,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" + "Symfony\\Component\\Process\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1745,22 +2006,22 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:42:41" + "time": "2017-02-16T14:07:22+00:00" }, { - "name": "symfony/yaml", - "version": "v3.1.1", + "name": "symfony/stopwatch", + "version": "v3.2.4", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623" + "url": "https://github.com/symfony/stopwatch.git", + "reference": "9aa0b51889c01bca474853ef76e9394b02264464" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623", - "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/9aa0b51889c01bca474853ef76e9394b02264464", + "reference": "9aa0b51889c01bca474853ef76e9394b02264464", "shasum": "" }, "require": { @@ -1769,12 +2030,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Component\\Stopwatch\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1794,34 +2055,35 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2016-06-14 11:18:07" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "webmozart/assert", - "version": "1.0.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde" + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", - "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1845,7 +2107,7 @@ "check", "validate" ], - "time": "2015-08-24 13:29:44" + "time": "2016-11-23T20:04:58+00:00" } ], "aliases": [], @@ -1854,7 +2116,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^5.6 || ^7.0" + "php": "^7.0" }, "platform-dev": [] } diff --git a/src/Exception/AbstractClientErrorException.php b/src/Exception/AbstractClientErrorException.php index 87635f8..7466556 100644 --- a/src/Exception/AbstractClientErrorException.php +++ b/src/Exception/AbstractClientErrorException.php @@ -1,4 +1,5 @@ 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', + 413 => 'Payload Too Large', + 414 => 'URI Too Long', 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', + 416 => 'Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', + 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', @@ -170,6 +174,7 @@ class HttpStatus 416 => 'The client has asked for a portion of the file, but the server cannot supply that portion.', 417 => 'The expectation given could not be met by at least one of the inbound servers.', 418 => 'I\'m a teapot', + 421 => 'The request was directed at a server that is not able to produce a response.', 422 => 'The request was well-formed but was unable to be followed due to semantic errors.', 423 => 'The resource that is being accessed is locked.', 424 => 'The request failed due to failure of a previous request.', @@ -211,12 +216,13 @@ class HttpStatus 410 => GoneException::class, 411 => LengthRequiredException::class, 412 => PreconditionFailedException::class, - 413 => RequestEntityTooLargeException::class, + 413 => PayloadTooLargeException::class, 414 => RequestUriTooLongException::class, 415 => UnsupportedMediaTypeException::class, 416 => RequestedRangeNotSatisfiableException::class, 417 => ExpectationFailedException::class, 418 => ImATeapotException::class, + 421 => MisdirectedRequestException::class, 422 => UnprocessableEntityException::class, 423 => LockedException::class, 424 => FailedDependencyException::class, @@ -252,12 +258,12 @@ private function __construct() * * @param int $code http status code * - * @throws InvalidArgumentException If the requested $code is not valid - * @throws OutOfBoundsException If the requested $code is not found + * @throws \InvalidArgumentException If the requested $code is not valid + * @throws \OutOfBoundsException If the requested $code is not found * * @return string Returns message for the given status code */ - public static function getReasonMessage($code) + public static function getReasonMessage(int $code): string { $code = static::filterStatusCode($code); @@ -273,12 +279,12 @@ public static function getReasonMessage($code) * * @param int $code http status code * - * @throws InvalidArgumentException If the requested $code is not valid - * @throws OutOfBoundsException If the requested $code is not found + * @throws \InvalidArgumentException If the requested $code is not valid + * @throws \\OutOfBoundsException If the requested $code is not found * * @return string Returns name for the given status code */ - public static function getReasonPhrase($code) + public static function getReasonPhrase(int $code): string { $code = static::filterStatusCode($code); @@ -290,13 +296,51 @@ public static function getReasonPhrase($code) } /** - * Get the text for a given status code + * Get the text for a given status code. * * @param int $code http status code * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException + * @throws \Narrowspark\HttpStatus\Exception\BadGatewayException + * @throws \Narrowspark\HttpStatus\Exception\BadRequestException + * @throws \Narrowspark\HttpStatus\Exception\ConflictException + * @throws \Narrowspark\HttpStatus\Exception\ExpectationFailedException + * @throws \Narrowspark\HttpStatus\Exception\FailedDependencyException + * @throws \Narrowspark\HttpStatus\Exception\ForbiddenException + * @throws \Narrowspark\HttpStatus\Exception\GatewayTimeoutException + * @throws \Narrowspark\HttpStatus\Exception\GoneException + * @throws \Narrowspark\HttpStatus\Exception\HttpVersionNotSupportedException + * @throws \Narrowspark\HttpStatus\Exception\ImATeapotException + * @throws \Narrowspark\HttpStatus\Exception\InsufficientStorageException + * @throws \Narrowspark\HttpStatus\Exception\InternalServerErrorException + * @throws \Narrowspark\HttpStatus\Exception\LengthRequiredException + * @throws \Narrowspark\HttpStatus\Exception\LockedException + * @throws \Narrowspark\HttpStatus\Exception\LoopDetectedException + * @throws \Narrowspark\HttpStatus\Exception\MethodNotAllowedException + * @throws \Narrowspark\HttpStatus\Exception\NetworkAuthenticationRequiredException + * @throws \Narrowspark\HttpStatus\Exception\NotAcceptableException + * @throws \Narrowspark\HttpStatus\Exception\NotExtendedException + * @throws \Narrowspark\HttpStatus\Exception\NotFoundException + * @throws \Narrowspark\HttpStatus\Exception\NotImplementedException + * @throws \Narrowspark\HttpStatus\Exception\PaymentRequiredException + * @throws \Narrowspark\HttpStatus\Exception\PreconditionFailedException + * @throws \Narrowspark\HttpStatus\Exception\PreconditionRequiredException + * @throws \Narrowspark\HttpStatus\Exception\ProxyAuthenticationRequiredException + * @throws \Narrowspark\HttpStatus\Exception\RequestedRangeNotSatisfiableException + * @throws \Narrowspark\HttpStatus\Exception\RequestEntityTooLargeException + * @throws \Narrowspark\HttpStatus\Exception\RequestHeaderFieldsTooLargeException + * @throws \Narrowspark\HttpStatus\Exception\RequestTimeoutException + * @throws \Narrowspark\HttpStatus\Exception\RequestUriTooLongException + * @throws \Narrowspark\HttpStatus\Exception\ServiceUnavailableException + * @throws \Narrowspark\HttpStatus\Exception\TooManyRequestsException + * @throws \Narrowspark\HttpStatus\Exception\UnauthorizedException + * @throws \Narrowspark\HttpStatus\Exception\UnavailableForLegalReasonsException + * @throws \Narrowspark\HttpStatus\Exception\UnprocessableEntityException + * @throws \Narrowspark\HttpStatus\Exception\UnsupportedMediaTypeException + * @throws \Narrowspark\HttpStatus\Exception\UpgradeRequiredException + * @throws \Narrowspark\HttpStatus\Exception\VariantAlsoNegotiatesException */ - public static function getReasonException($code) + public static function getReasonException(int $code) { $code = static::filterStatusCode($code); @@ -310,15 +354,15 @@ public static function getReasonException($code) } /** - * Filter a HTTP Status code + * Filter a HTTP Status code. * * @param int $code * - * @throws InvalidArgumentException if the HTTP status code is invalid + * @throws \InvalidArgumentException if the HTTP status code is invalid * * @return int */ - public static function filterStatusCode($code) + public static function filterStatusCode(int $code): int { $code = filter_var($code, FILTER_VALIDATE_INT, ['options' => [ 'min_range' => self::MINIMUM, diff --git a/tests/HttpStatusTest.php b/tests/HttpStatusTest.php index ebafd77..ee93321 100644 --- a/tests/HttpStatusTest.php +++ b/tests/HttpStatusTest.php @@ -1,10 +1,15 @@ 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', + 413 => 'Payload Too Large', + 414 => 'URI Too Long', 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', + 416 => 'Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', + 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', @@ -116,6 +122,7 @@ class HttpStatusTest extends \PHPUnit_Framework_TestCase 416 => 'The client has asked for a portion of the file, but the server cannot supply that portion.', 417 => 'The expectation given could not be met by at least one of the inbound servers.', 418 => 'I\'m a teapot', + 421 => 'The request was directed at a server that is not able to produce a response.', 422 => 'The request was well-formed but was unable to be followed due to semantic errors.', 423 => 'The resource that is being accessed is locked.', 424 => 'The request failed due to failure of a previous request.', @@ -152,12 +159,13 @@ class HttpStatusTest extends \PHPUnit_Framework_TestCase 410 => Exception\GoneException::class, 411 => Exception\LengthRequiredException::class, 412 => Exception\PreconditionFailedException::class, - 413 => Exception\RequestEntityTooLargeException::class, + 413 => Exception\PayloadTooLargeException::class, 414 => Exception\RequestUriTooLongException::class, 415 => Exception\UnsupportedMediaTypeException::class, 416 => Exception\RequestedRangeNotSatisfiableException::class, 417 => Exception\ExpectationFailedException::class, 418 => Exception\ImATeapotException::class, + 421 => Exception\MisdirectedRequestException::class, 422 => Exception\UnprocessableEntityException::class, 423 => Exception\LockedException::class, 424 => Exception\FailedDependencyException::class, @@ -183,7 +191,7 @@ class HttpStatusTest extends \PHPUnit_Framework_TestCase public function testGetReasonPhrase() { foreach ($this->errorNames as $code => $text) { - $this->assertSame( + self::assertSame( $text, HttpStatus::getReasonPhrase($code), 'Expected HttpStatus::getReasonPhrase(' . $code . ') to return ' . $text @@ -194,7 +202,7 @@ public function testGetReasonPhrase() public function testGetReasonMessage() { foreach ($this->errorPhrases as $code => $text) { - $this->assertSame( + self::assertSame( $text, HttpStatus::getReasonMessage($code), 'Expected HttpStatus::getReasonPhrase(' . $code . ') to return ' . $text @@ -203,7 +211,7 @@ public function testGetReasonMessage() } /** - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException * @expectedExceptionMessage The submitted code must be a positive integer between 100 and 599. */ public function testGetReasonPhraseToThrowInvalidArgumentException() @@ -212,7 +220,7 @@ public function testGetReasonPhraseToThrowInvalidArgumentException() } /** - * @expectedException OutOfBoundsException + * @expectedException \OutOfBoundsException * @expectedExceptionMessage Unknown http status code: `509`. */ public function testGetReasonPhraseToThrowOutOfBoundsException() @@ -221,7 +229,7 @@ public function testGetReasonPhraseToThrowOutOfBoundsException() } /** - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException * @expectedExceptionMessage The submitted code must be a positive integer between 100 and 599. */ public function testGetReasonMessageToThrowInvalidArgumentException() @@ -230,7 +238,7 @@ public function testGetReasonMessageToThrowInvalidArgumentException() } /** - * @expectedException OutOfBoundsException + * @expectedException \OutOfBoundsException * @expectedExceptionMessage Unknown http status code: `509`. */ public function testGetReasonMessageToThrowOutOfBoundsException() @@ -243,14 +251,14 @@ public function testGetReasonException() foreach ($this->errorNames as $code => $text) { try { HttpStatus::getReasonException($code); - } catch (\Exception $exception) { - $this->assertSame( + } catch (Throwable $exception) { + self::assertSame( $code . ' ' . $text, $exception->getMessage(), 'Expected HttpStatus::getReasonException(' . $code . ') to return ' . $text ); - $this->assertSame( + self::assertSame( $code, $exception->getCode(), 'Expected HttpStatus::getReasonException(' . $code . ') to return ' . $text @@ -274,7 +282,82 @@ public function testIfAllExceptionsAreExtendetFromTheRightClient() } } - $this->assertSame(27, $clientCount); - $this->assertSame(11, $serverCount); + self::assertSame(28, $clientCount); + self::assertSame(11, $serverCount); + } + + /** + * @dataProvider ianaCodesReasonPhrasesProvider + * + * @param mixed $code + * @param mixed $reasonPhrase + */ + public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase) + { + self::assertEquals($reasonPhrase, HttpStatus::getReasonPhrase((int) $code)); + } + + /** + * @dataProvider ianaCodesReasonPhrasesProvider + * + * @param mixed $code + * @param mixed $reasonPhrase + */ + public function testGetReasonExceptionAgainstIana($code, $reasonPhrase) + { + // skip http code from 100 to 399 + if ((100 <= $code) && ($code <= 399)) { + self::assertTrue(true); + } + + try { + HttpStatus::getReasonException((int) $code); + } catch (Throwable $exception) { + self::assertSame( + $code . ' ' . $reasonPhrase, + $exception->getMessage(), + 'Expected HttpStatus::getReasonException(' . $code . ') to return ' . $reasonPhrase + ); + + self::assertSame( + (int) $code, + $exception->getCode(), + 'Expected HttpStatus::getReasonException(' . $code . ') to return ' . $reasonPhrase + ); + } + } + + public function ianaCodesReasonPhrasesProvider(): array + { + $ianaHttpStatusCodes = new DOMDocument(); + $ianaHttpStatusCodes->loadXML(file_get_contents('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml')); + + $ianaCodesReasonPhrases = []; + + $xpath = new DomXPath($ianaHttpStatusCodes); + $xpath->registerNamespace('ns', 'http://www.iana.org/assignments'); + + $records = $xpath->query('//ns:record'); + + foreach ($records as $record) { + $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue; + $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue; + + if ($description === 'Unassigned' | $description === '(Unused)') { + continue; + } + + $range = preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches); + + if (! $range) { + $ianaCodesReasonPhrases[] = [$value, $description]; + } else { + for ($value = $matches[1]; $value <= $matches[2]; ++$value) { + $ianaCodesReasonPhrases[] = [$value, $description]; + } + } + } + + return $ianaCodesReasonPhrases; } }