├── CHANGELOG.md ├── README.md ├── composer.json └── src ├── All.php ├── Http.php ├── RFC ├── PEP.php ├── RFC2295.php ├── RFC2324.php ├── RFC2326.php ├── RFC2518.php ├── RFC2616.php ├── RFC2774.php ├── RFC2817.php ├── RFC3229.php ├── RFC3648.php ├── RFC4918.php ├── RFC5842.php ├── RFC6585.php ├── RFC7168.php ├── RFC7231.php ├── RFC7232.php ├── RFC7233.php ├── RFC7234.php ├── RFC7235.php ├── RFC7538.php ├── RFC7540.php ├── RFC7725.php ├── Status │ ├── DraftStandard.php │ ├── Experimental.php │ ├── Expired.php │ ├── Informational.php │ └── ProposedStandard.php └── Stream │ ├── IETF.php │ ├── Independent.php │ └── Legacy.php ├── Vendor.php ├── Vendor ├── Apache.php ├── CloudFlare.php ├── Microsoft.php ├── Nginx.php ├── RFC7238.php ├── Symfony.php └── Twitter.php └── WebDAV.php /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## Unreleased 8 | 9 | For a full diff see [`2.4.0...main`][2.4.0...main]. 10 | 11 | ## [`2.4.0`][2.4.0] 12 | 13 | For a full diff see [`2.3.0...2.4.0`][2.3.0...2.4.0]. 14 | 15 | ### Changed 16 | 17 | - Added support for PHP 8.4, ([#159]), by [@holtkamp] 18 | 19 | ## [`2.3.0`][2.3.0] 20 | 21 | For a full diff see [`2.2.0...2.3.0`][2.2.0...2.3.0]. 22 | 23 | ### Changed 24 | 25 | - Added support for PHP 7.4, ([#114]), by [@localheinz] 26 | 27 | ## [`2.2.0`][2.2.0] 28 | 29 | For a full diff see [`2.1.0...2.2.0`][2.1.0...2.2.0]. 30 | 31 | ### Changed 32 | 33 | - Added support for PHP 8.3, ([#90]), by [@OrestisZag] 34 | 35 | ## [`2.1.0`][2.1.0] 36 | 37 | For a full diff see [`2.0.1...2.1.0`][2.0.1...2.1.0]. 38 | 39 | ### Changed 40 | 41 | - Dropped support for PHP 5.4 ([#57]), by [@localheinz] 42 | - Dropped support for PHP 5.5 ([#58]), by [@localheinz] 43 | - Dropped support for PHP 5.6 ([#59]), by [@localheinz] 44 | - Dropped support for PHP 7.0 ([#60]), by [@localheinz] 45 | - Dropped support for PHP 7.1 ([#61]), by [@localheinz] 46 | - Dropped support for PHP 7.2 ([#62]), by [@localheinz] 47 | - Dropped support for PHP 7.3 ([#63]), by [@localheinz] 48 | - Dropped support for PHP 7.4 ([#64]), by [@localheinz] 49 | 50 | ## [`2.0.1`][2.0.1] 51 | 52 | For a full diff see [`2.0.0...2.0.1`][2.0.0...2.0.1]. 53 | 54 | ### Fixed 55 | 56 | - Fixed reference from `Vendor\Symfony::HTTP_UPGRADE_REQUIRED` to undefined constant `RFC\RFC2817::UPDATE_REQUIRED` ([#56]), by [@jtheuerkauf] 57 | 58 | ## [`2.0.0`][2.0.0] 59 | 60 | For a full diff see [`v1.1.2...2.0.0`][v1.1.2...2.0.0]. 61 | 62 | ### Added 63 | 64 | - Added `CHANGELOG.md` ([#25]), by [@localheinz] 65 | 66 | ### Fixed 67 | 68 | - Updated links to RFCs ([#24]), by [@localheinz] 69 | 70 | ### Removed 71 | 72 | - Removed deprecated constants `Teapot\StatusCode\RFC\RFC7231::NON_AUTHORATIVE_INFORMATION` and `Teapot\StatusCode\RFC\RFC2616::NON_AUTHORATIVE_INFORMATION` ([#26]), by [@localheinz] 73 | 74 | ## [`v1.1.2`][v1.1.2] 75 | 76 | For a full diff see [`v1.1.1...v1.1.2`][v1.1.1...v1.1.2]. 77 | 78 | ## [`v1.1.1`][v1.1.1] 79 | 80 | For a full diff see [`v1.1.0...v1.1.1`][v1.1.0...v1.1.1]. 81 | 82 | ## [`v1.1.0`][v1.1.0] 83 | 84 | For a full diff see [`v1.0.2...v1.1.0`][v1.0.2...v1.1.0]. 85 | 86 | ## [`v1.0.2`][v1.0.2] 87 | 88 | For a full diff see [`v1.0.1...v1.0.2`][v1.0.1...v1.0.2]. 89 | 90 | ## [`v1.0.1`][v1.0.1] 91 | 92 | For a full diff see [`v1.0.0...v1.0.1`][v1.0.0...v1.0.1]. 93 | 94 | ## [`v1.0.0`][v1.0.0] 95 | 96 | For a full diff see [`1091250...v1.0.0`][1091250...v1.0.0]. 97 | 98 | [v1.0.0]: https://github.com/teapot-php/status-code/releases/tag/v1.0.- 99 | [v1.0.1]: https://github.com/teapot-php/status-code/releases/tag/v1.0.1 100 | [v1.0.2]: https://github.com/teapot-php/status-code/releases/tag/v1.0.2 101 | [v1.1.0]: https://github.com/teapot-php/status-code/releases/tag/v1.1.0 102 | [v1.1.1]: https://github.com/teapot-php/status-code/releases/tag/v1.1.1 103 | [v1.1.2]: https://github.com/teapot-php/status-code/releases/tag/v1.1.2 104 | [2.0.0]: https://github.com/teapot-php/status-code/releases/tag/2.0.0 105 | [2.0.1]: https://github.com/teapot-php/status-code/releases/tag/2.0.1 106 | [2.1.0]: https://github.com/teapot-php/status-code/releases/tag/2.1.0 107 | [2.2.0]: https://github.com/teapot-php/status-code/releases/tag/2.2.0 108 | [2.3.0]: https://github.com/teapot-php/status-code/releases/tag/2.3.0 109 | [2.4.0]: https://github.com/teapot-php/status-code/releases/tag/2.4.0 110 | 111 | [1091250...v1.0.0]: https://github.com/teapot-php/status-code/compare/1091250...v1.0.0 112 | [v1.0.0...v1.0.1]: https://github.com/teapot-php/status-code/compare/v1.0.0...v1.0.1 113 | [v1.0.1...v1.0.2]: https://github.com/teapot-php/status-code/compare/v1.0.1...v1.0.2 114 | [v1.0.2...v1.1.0]: https://github.com/teapot-php/status-code/compare/v1.0.2...v1.1.0 115 | [v1.1.0...v1.1.1]: https://github.com/teapot-php/status-code/compare/v1.1.0...v1.1.1 116 | [v1.1.1...v1.1.2]: https://github.com/teapot-php/status-code/compare/v1.1.1...v1.1.2 117 | [v1.1.2...2.0.0]: https://github.com/teapot-php/status-code/compare/v1.1.2...2.0.0 118 | [2.0.0...2.0.1]: https://github.com/teapot-php/status-code/compare/2.0.0...2.0.1 119 | [2.0.1...2.1.0]: https://github.com/teapot-php/status-code/compare/2.0.1...2.1.0 120 | [2.1.0...2.2.0]: https://github.com/teapot-php/status-code/compare/2.1.0...2.2.0 121 | [2.2.0...2.3.0]: https://github.com/teapot-php/status-code/compare/2.3.0...main 122 | [2.3.0...2.4.0]: https://github.com/teapot-php/status-code/compare/2.3.0...2.4.0 123 | [2.4.0...main]: https://github.com/teapot-php/status-code/compare/2.4.0...main 124 | 125 | [#24]: https://github.com/teapot-php/status-code/pull/24 126 | [#25]: https://github.com/teapot-php/status-code/pull/25 127 | [#26]: https://github.com/teapot-php/status-code/pull/26 128 | [#56]: https://github.com/teapot-php/status-code/pull/56 129 | [#57]: https://github.com/teapot-php/status-code/pull/57 130 | [#58]: https://github.com/teapot-php/status-code/pull/58 131 | [#59]: https://github.com/teapot-php/status-code/pull/59 132 | [#60]: https://github.com/teapot-php/status-code/pull/60 133 | [#61]: https://github.com/teapot-php/status-code/pull/61 134 | [#62]: https://github.com/teapot-php/status-code/pull/62 135 | [#63]: https://github.com/teapot-php/status-code/pull/63 136 | [#64]: https://github.com/teapot-php/status-code/pull/64 137 | [#90]: https://github.com/teapot-php/status-code/pull/90 138 | [#114]: https://github.com/teapot-php/status-code/pull/114 139 | 140 | [@holtkamp]: https://github.com/holtkamp 141 | [@jtheuerkauf]: https://github.com/jtheuerkauf 142 | [@localheinz]: https://github.com/localheinz 143 | [@OrestisZag]: https://github.com/OrestisZag 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Teapot: Status Codes 2 | 3 | [![Integrate](https://github.com/teapot-php/status-code/actions/workflows/integrate.yaml/badge.svg)](https://github.com/teapot-php/status-code/actions/workflows/integrate.yaml) 4 | [![latest_stable_version_img]][latest_stable_version] 5 | [![latest_unstable_version_img]][latest_unstable_version] 6 | [![license_img]][license] 7 | [![twitter_img]][twitter] 8 | 9 | Part of the teapot library. This is a port of all of the status codes, so the exceptions etc don't get included in this one. 10 | 11 | [latest_stable_version_img]: https://img.shields.io/packagist/v/teapot/status-code.svg "Latest Stable Version" 12 | [latest_stable_version]: https://packagist.org/packages/teapot/status-code "Latest Stable Version" 13 | 14 | [latest_unstable_version_img]: https://img.shields.io/packagist/vpre/teapot/status-code.svg "Latest Unstable Version" 15 | [latest_unstable_version]: https://packagist.org/packages/teapot/status-code "Latest Unstable Version" 16 | 17 | [license_img]: https://img.shields.io/packagist/l/teapot/status-code.svg "License" 18 | [license]: https://packagist.org/packages/teapot/status-code 19 | 20 | [twitter_img]: https://img.shields.io/badge/twitter-%40shrikeh-blue.svg "@shrikeh on Twitter" 21 | [twitter]: https://twitter.com/shrikeh 22 | 23 | ## Changelog 24 | 25 | Please have a look at [`CHANGELOG.md`](CHANGELOG.md). 26 | 27 | ## Contributing 28 | 29 | Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md). 30 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "teapot/status-code", 3 | "description": "PHP HTTP Response Status code library", 4 | "license": "MIT", 5 | "type": "library", 6 | "keywords": [ 7 | "http" 8 | ], 9 | "authors": [ 10 | { 11 | "name": "Barney Hanlon", 12 | "email": "barney@shrikeh.net" 13 | }, 14 | { 15 | "name": "Andreas Möller", 16 | "email": "am@localheinz.com" 17 | } 18 | ], 19 | "homepage": "https://github.com/teapot-php/status-code", 20 | "require": { 21 | "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0" 22 | }, 23 | "require-dev": { 24 | "ergebnis/composer-normalize": "^2.47.0", 25 | "ergebnis/php-cs-fixer-config": "^6.46.0", 26 | "phpstan/phpstan": "^2.1.12", 27 | "phpstan/phpstan-deprecation-rules": "^2.0.1", 28 | "phpstan/phpstan-strict-rules": "^2.0.4" 29 | }, 30 | "autoload": { 31 | "psr-4": { 32 | "Teapot\\StatusCode\\": "src" 33 | } 34 | }, 35 | "archive": { 36 | "exclude": [ 37 | "/*, !/src" 38 | ] 39 | }, 40 | "config": { 41 | "allow-plugins": { 42 | "ergebnis/composer-normalize": true 43 | }, 44 | "platform": { 45 | "php": "7.4.33" 46 | }, 47 | "sort-packages": true 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/All.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode; 26 | 27 | use Teapot\StatusCode\RFC\PEP; 28 | use Teapot\StatusCode\RFC\RFC2295 as ContentNegotiation; 29 | use Teapot\StatusCode\RFC\RFC2326 as Rtsp; 30 | use Teapot\StatusCode\RFC\RFC3229 as HttpDeltas; 31 | 32 | /** 33 | * Interface representing extended HTTP status codes for Web servers. These 34 | * codes are represented as an interface so that developers may implement it and 35 | * then use parent::[CODE] to gain a code, or to extend the codes using 36 | * static::[CODE] and override their default description. 37 | * 38 | * This allows for codes to be repurposed in a natural way where the core, 39 | * traditional use would not be meaningful. 40 | * 41 | * @category StatusCode 42 | * 43 | * @package Teapot\StatusCode 44 | * 45 | * @author Barney Hanlon 46 | * @copyright 2013-2016 B Hanlon. All rights reserved. 47 | * @license MIT http://opensource.org/licenses/MIT 48 | * 49 | * @see https://github.com/teapot-php/status-code 50 | */ 51 | interface All extends 52 | ContentNegotiation, 53 | Http, 54 | HttpDeltas, 55 | PEP, 56 | Rtsp, 57 | Vendor, 58 | WebDAV 59 | { 60 | } 61 | -------------------------------------------------------------------------------- /src/Http.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | * @see http://lists.w3.org/Archives/Public/public-web-perf/2013Apr/att-0007/WebRequestStatusCodes4.html 24 | */ 25 | 26 | namespace Teapot\StatusCode; 27 | 28 | use Teapot\StatusCode\RFC\RFC7168 as HTCPCPTea; 29 | use Teapot\StatusCode\RFC\RFC7231 as SemanticsAndContent; 30 | use Teapot\StatusCode\RFC\RFC7232 as ConditionalRequests; 31 | use Teapot\StatusCode\RFC\RFC7233 as RangeRequests; 32 | use Teapot\StatusCode\RFC\RFC7234 as Caching; 33 | use Teapot\StatusCode\RFC\RFC7235 as Authentication; 34 | use Teapot\StatusCode\RFC\RFC7538 as PermanentRedirect; 35 | use Teapot\StatusCode\RFC\RFC7540 as HTTP2; 36 | use Teapot\StatusCode\RFC\RFC7725 as LegalObstacles; 37 | 38 | /** 39 | * Interface representing standard and extended HTTP status codes. These codes 40 | * are represented as an interface so that developers may implement it and then 41 | * use parent::[CODE] to gain a code, or to extend the codes using 42 | * static::[CODE] and override their default description. 43 | * 44 | * This allows for codes to be repurposed in a natural way where the core, 45 | * traditional use would not be meaningful. 46 | * 47 | * @category StatusCode 48 | * 49 | * @package Teapot\StatusCode 50 | * 51 | * @author Barney Hanlon 52 | * @copyright 2013-2016 B Hanlon. All rights reserved. 53 | * @license MIT http://opensource.org/licenses/MIT 54 | * 55 | * @see https://github.com/teapot-php/status-code 56 | * @see http://lists.w3.org/Archives/Public/public-web-perf/2013Apr/att-0007/WebRequestStatusCodes4.html 57 | */ 58 | interface Http extends 59 | Authentication, 60 | Caching, 61 | ConditionalRequests, 62 | HTCPCPTea, 63 | HTTP2, 64 | LegalObstacles, 65 | PermanentRedirect, 66 | RangeRequests, 67 | SemanticsAndContent 68 | { 69 | } 70 | -------------------------------------------------------------------------------- /src/RFC/PEP.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2013-2016 B Hanlon. All rights reserved. 21 | * @license MIT http://opensource.org/licenses/MIT 22 | * 23 | * @see https://github.com/teapot-php/status-code 24 | */ 25 | 26 | namespace Teapot\StatusCode\RFC; 27 | 28 | use Teapot\StatusCode\RFC\Status\Expired as ExpiredStatus; 29 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 30 | 31 | /** 32 | * Interface representing extended HTTP status codes for PEP 33 | * (Protocol Extension Protocol: http://www.w3.org/TR/WD-http-pep). These codes 34 | * are represented as an interface so that developers may implement it and then 35 | * use parent::[CODE] to gain a code, or to extend the codes using 36 | * static::[CODE] and override their default description. 37 | * 38 | * This allows for codes to be repurposed in a natural way where the core, 39 | * traditional use would not be meaningful. 40 | * 41 | * @category StatusCode 42 | * 43 | * @package Teapot\StatusCode\RFC 44 | * 45 | * @author Barney Hanlon 46 | * @copyright 2013-2016 B Hanlon. All rights reserved. 47 | * @license MIT http://opensource.org/licenses/MIT 48 | * 49 | * @see https://github.com/teapot-php/status-code 50 | */ 51 | interface PEP extends ExpiredStatus, IETFStream 52 | { 53 | /** 54 | * The policy for accessing the resource has not been met in the request. 55 | * The response MUST include a PEP-Info or a C-PEP-Info header field 56 | * specifying the extensions required by the publishing party for accessing 57 | * the resource. The server MAY use the for attribute bag to indicate 58 | * whether the policy applies to other resources. 59 | * 60 | * The client MAY repeat the request using the appropriate extensions). If 61 | * the initial request already included the extensions requested in the 420 62 | * response, then the response indicates that access has been refused for 63 | * those extension declarations. 64 | * If the 420 response contains the same set of extension policies as the 65 | * prior response, then the client MAY present any entity included in the 66 | * response to the user, since that entity may include relevant diagnostic 67 | * information. 68 | * Implementers may note the similarity to the way authentication 69 | * challenges are issued with the 401 (Unauthorized) status-code. 70 | * 71 | * @see https://www.w3.org/TR/WD-http-pep-971121.html#_Toc404743960 72 | * @deprecated 73 | * @var int 74 | */ 75 | public const POLICY_NOT_FULFILLED = 420; 76 | 77 | /** 78 | * The mappings indicated by one or more map attribute bags in the request 79 | * were not unique and mapped the same header field more than once. 80 | * The client MAY repeat the request using a new set of mappings if it 81 | * believes that it can find a unique set of header fields for which the 82 | * transaction will succeed. 83 | * 84 | * @see https://www.w3.org/TR/WD-http-pep-971121.html#_Toc404743961 85 | * @deprecated 86 | * @var int 87 | */ 88 | public const BAD_MAPPING = 421; 89 | } 90 | -------------------------------------------------------------------------------- /src/RFC/RFC2295.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\Experimental as ExperimentalStatus; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC2295. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC2295 extends ExperimentalStatus, IETFStream 50 | { 51 | /** 52 | * Transparent content negotiation for the request results in a circular 53 | * reference. 54 | * 55 | * @see https://datatracker.ietf.org/doc/html/rfc2295#section-8.1 56 | * 57 | * @var int 58 | */ 59 | public const VARIANT_ALSO_NEGOTIATES = 506; 60 | } 61 | -------------------------------------------------------------------------------- /src/RFC/RFC2324.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\Informational as InformationalStatus; 28 | use Teapot\StatusCode\RFC\Stream\Legacy as LegacyStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC2324. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * @deprecated 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC2324 extends InformationalStatus, LegacyStream 50 | { 51 | /** 52 | * The HTCPCP server is a teapot; the resulting entity may be short and 53 | * stout. Demonstrations of this behaviour exist. 54 | * 55 | * @see https://datatracker.ietf.org/doc/html/rfc2324#section-2.3.2 56 | * 57 | * @var int 58 | */ 59 | public const I_AM_A_TEAPOT = 418; 60 | } 61 | -------------------------------------------------------------------------------- /src/RFC/RFC2326.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright 2013-2016 B Hanlon. All rights reserved. 21 | * @license MIT http://opensource.org/licenses/MIT 22 | * 23 | * @see https://github.com/teapot-php/status-code 24 | */ 25 | 26 | namespace Teapot\StatusCode\RFC; 27 | 28 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 29 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 30 | 31 | /** 32 | * Interface representing extended HTTP status codes for RTSP 33 | * (Real Time Streaming Protocol), as listed in RFC2326. These codes are 34 | * represented as an interface so that developers may implement it and then use 35 | * parent::[CODE] to gain a code, or to extend the codes using static::[CODE] 36 | * and override their default description. 37 | * 38 | * This allows for codes to be repurposed in a natural way where the core, 39 | * traditional use would not be meaningful. 40 | * 41 | * @category StatusCode 42 | * 43 | * @package Teapot\StatusCode\RFC 44 | * 45 | * @author Barney Hanlon 46 | * @copyright 2013-2016 B Hanlon. All rights reserved. 47 | * @license MIT http://opensource.org/licenses/MIT 48 | * 49 | * @see https://github.com/teapot-php/status-code 50 | */ 51 | interface RFC2326 extends IETFStream, ProposedStandard 52 | { 53 | /** 54 | * The recipient of the request does not support one or more parameters 55 | * contained in the request. 56 | * 57 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.2 58 | * 59 | * @var int 60 | */ 61 | public const PARAMETER_NOT_UNDERSTOOD = 451; 62 | 63 | /** 64 | * The conference indicated by a Conference header field is unknown to the 65 | * media server. 66 | * 67 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.3 68 | * 69 | * @var int 70 | */ 71 | public const CONFERENCE_NOT_FOUND = 452; 72 | 73 | /** 74 | * The request was refused because there was insufficient bandwidth. 75 | * This may, for example, be the result of a resource reservation failure. 76 | * 77 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.4 78 | * 79 | * @var int 80 | */ 81 | public const NOT_ENOUGH_BANDWIDTH = 453; 82 | 83 | /** 84 | * The RTSP session identifier in the Session header is missing, invalid, 85 | * or has timed out. 86 | * 87 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.5 88 | * 89 | * @var int 90 | */ 91 | public const SESSION_NOT_FOUND = 454; 92 | 93 | /** 94 | * The client or server cannot process this request in its current state. 95 | * The response SHOULD contain an Allow header to make error recovery 96 | * easier. 97 | * 98 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.6 99 | * 100 | * @var int 101 | */ 102 | public const METHOD_NOT_VALID_IN_THIS_STATE = 455; 103 | 104 | /** 105 | * The server could not act on a required request header. For example, if 106 | * PLAY contains the Range header field but the stream does not allow 107 | * seeking. 108 | * 109 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.7 110 | * 111 | * @var int 112 | */ 113 | public const HEADER_FIELD_NOT_VALID_FOR_RESOURCE = 456; 114 | 115 | /** 116 | * The Range value given is out of bounds, e.g., beyond the end of the 117 | * presentation. 118 | * 119 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.8 120 | * 121 | * @var int 122 | */ 123 | public const INVALID_RANGE = 457; 124 | 125 | /** 126 | * The parameter to be set by SET_PARAMETER can be read but not modified. 127 | * 128 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.9 129 | * 130 | * @var int 131 | */ 132 | public const PARAMETER_IS_READ_ONLY = 458; 133 | 134 | /** 135 | * The requested method may not be applied on the URL in question since it 136 | * is an aggregate (presentation) URL. The method may be applied on a 137 | * stream URL. 138 | * 139 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.10 140 | * 141 | * @var int 142 | */ 143 | public const AGGREGATE_OPERATION_NOT_ALLOWED = 459; 144 | 145 | /** 146 | * The requested method may not be applied on the URL in question since it 147 | * is not an aggregate (presentation) URL. The method may be applied on the 148 | * presentation URL. 149 | * 150 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.11 151 | * 152 | * @var int 153 | */ 154 | public const ONLY_AGGREGATE_OPERATION_ALLOWED = 460; 155 | 156 | /** 157 | * The Transport field did not contain a supported transport 158 | * specification. 159 | * 160 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.12 161 | * 162 | * @var int 163 | */ 164 | public const UNSUPPORTED_TRANSPORT = 461; 165 | 166 | /** 167 | * The data transmission channel could not be established because the 168 | * client address could not be reached. This error will most likely 169 | * be the result of a client attempt to place an invalid Destination 170 | * parameter in the Transport field. 171 | * 172 | * @see https://datatracker.ietf.org/doc/html/rfc2326#section-11.3.13 173 | * 174 | * @var int 175 | */ 176 | public const DESTINATION_UNREACHABLE = 462; 177 | } 178 | -------------------------------------------------------------------------------- /src/RFC/RFC2518.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC2518. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC2518 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * This code indicates that the server has received and is processing the 53 | * request, but no response is available yet. 54 | * 55 | * @see https://datatracker.ietf.org/doc/html/rfc2518#section-10.1 56 | * 57 | * @var int 58 | */ 59 | public const PROCESSING = 102; 60 | } 61 | -------------------------------------------------------------------------------- /src/RFC/RFC2616.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\DraftStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC2616. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * @deprecated 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC2616 extends DraftStandard, IETFStream 50 | { 51 | /** 52 | * This means that the server has received the request headers, and that 53 | * the client should proceed to send the request body (in the case of a 54 | * request for which a body needs to be sent; for example, a POST request). 55 | * If the request body is large, sending it to a server when a request has 56 | * already been rejected based upon inappropriate headers is inefficient. 57 | * To have a server check if the request could be accepted based on the 58 | * request's headers alone, a client must send Expect: 100-continue as a 59 | * header in its initial request[2] and check if a 100 Continue status code 60 | * is received in response before continuing (or receive 61 | * 417 Expectation Failed and not continue). 62 | * 63 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.1.1 64 | * 65 | * @var int 66 | */ 67 | public const CONTINUING = 100; 68 | 69 | /** 70 | * This means the requester has asked the server to switch protocols and 71 | * the server is acknowledging that it will do so. 72 | * 73 | * As a WebDAV request may contain many sub-requests involving file 74 | * operations, it may take a long time to complete the request. This code 75 | * indicates that the server has received and is processing the request, but 76 | * no response is available yet.[3] This prevents the client from timing out 77 | * and assuming the request was lost. 78 | * 79 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.1.2 80 | * 81 | * @var int 82 | */ 83 | public const SWITCHING_PROTOCOLS = 101; 84 | 85 | /** 86 | * The request has succeeded. The information returned with the response is 87 | * dependent on the method used in therequest, for example: 88 | * GET an entity corresponding to the requested resource is sent in the 89 | * response; 90 | * HEAD the entity-header fields corresponding to the requested resource 91 | * are sent in the response without any message-body; 92 | * POST an entity describing or containing the result of the action; 93 | * TRACE an entity containing the request message as received by the end 94 | * server. 95 | * 96 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.1 97 | * 98 | * @var int 99 | */ 100 | public const OK = 200; 101 | 102 | /** 103 | * The request has been fulfilled and resulted in a new resource being 104 | * created. The newly created resource can be referenced by the URI(s) 105 | * returned in the entity of the response, with the most specific URI for 106 | * the resource given by a Location header field. 107 | * The response SHOULD include an entity containing a list of resource 108 | * characteristics and location(s) from which the user or user agent can 109 | * choose the one most appropriate. The entity format is specified by the 110 | * media type given in the Content-Type header field. The origin server 111 | * MUST create the resource before returning the 201 status code. If the 112 | * action cannot be carried out immediately, the server SHOULD respond with 113 | * 202 (Accepted) response instead. 114 | * 115 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.2 116 | * 117 | * @var int 118 | */ 119 | public const CREATED = 201; 120 | 121 | /** 122 | * The request has been accepted for processing, but the processing has not 123 | * been completed. The request might or might not eventually be acted upon, 124 | * as it might be disallowed when processing actually takes place. There 125 | * is no facility for re-sending a status code from an asynchronous 126 | * operation such as this. 127 | * 128 | * The 202 response is intentionally non-committal. Its purpose is to allow 129 | * a server to accept a request for some other process (perhaps a 130 | * batch-oriented process that is only run once per day) without requiring 131 | * that the user agent's connection to the server persist until the 132 | * process is completed. The entity returned with this response SHOULD 133 | * include an indication of the request's current status and either a 134 | * pointer to a status monitor or some estimate of when the user can expect 135 | * the request to be fulfilled. 136 | * 137 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.3 138 | * 139 | * @var int 140 | */ 141 | public const ACCEPTED = 202; 142 | 143 | /** 144 | * The returned metainformation in the entity-header is not the definitive 145 | * set as available from the origin server, but is gathered from a local or 146 | * a third-party copy. The set presented MAY be a subset or superset of the 147 | * original version. For example, including local annotation information 148 | * about the resource might result in a superset of the metainformation 149 | * known by the origin server. Use of this response code is not required 150 | * and is only appropriate when the response would otherwise be 200 (OK). 151 | * 152 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.4 153 | * 154 | * @var int 155 | */ 156 | public const NON_AUTHORITATIVE_INFORMATION = 203; 157 | 158 | /** 159 | * The server has fulfilled the request but does not need to return an 160 | * entity-body, and might want to return updated metainformation. The 161 | * response MAY include new or updated metainformation in the form of 162 | * entity-headers, which if present SHOULD be associated with the requested 163 | * variant. 164 | * If the client is a user agent, it SHOULD NOT change its document view 165 | * from that which caused the request to be sent. This response is 166 | * primarily intended to allow input for actions to take place without 167 | * causing a change to the user agent's active document view, although any 168 | * new or updated metainformation SHOULD be applied to the document 169 | * currently in the user agent's active view. 170 | * 171 | * The 204 response MUST NOT include a message-body, and thus is always 172 | * terminated by the first empty line after the header fields. 173 | * 174 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.5 175 | * 176 | * @var int 177 | */ 178 | public const NO_CONTENT = 204; 179 | 180 | /** 181 | * The server has fulfilled the request and the user agent SHOULD reset 182 | * the document view which caused the request to be sent. This response is 183 | * primarily intended to allow input for actions to take place via user 184 | * input, followed by a clearing of the form in which the input is given 185 | * so that the user can easily initiate another input action. The response 186 | * MUST NOT include an entity. 187 | * 188 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.6 189 | * 190 | * @var int 191 | */ 192 | public const RESET_CONTENT = 205; 193 | 194 | /** 195 | * The server has fulfilled the partial GET request for the resource. The 196 | * request MUST have included a Range header field indicating the desired 197 | * range, and MAY have included an If-Range header field (section 14.27) to 198 | * make the request conditional. 199 | * The response MUST include the following header fields:. 200 | * 201 | * - Either a Content-Range header field (section 14.16) indicating 202 | * the range included with this response, or a multipart/byteranges 203 | * Content-Type including Content-Range fields for each part. If a 204 | * Content-Length header field is present in the response, its 205 | * value MUST match the actual number of OCTETs transmitted in the 206 | * message-body. 207 | * - Date 208 | * - ETag and/or Content-Location, if the header would have been sent in a 209 | * 200 response to the same request 210 | * - Expires, Cache-Control, and/or Vary, if the field-value might differ 211 | * from that sent in any previous response for the same variant 212 | * 213 | * If the 206 response is the result of an If-Range request that used a 214 | * strong cache validator (see section 13.3.3), the response SHOULD NOT 215 | * include other entity-headers. If the response is the result of an 216 | * If-Range request that used a weak validator, the response MUST NOT 217 | * include other entity-headers; this prevents inconsistencies between 218 | * cached entity-bodies and updated headers. Otherwise, the response MUST 219 | * include all of the entity-headers that would have been returned with a 220 | * 200 (OK) response to the same request. 221 | * A cache MUST NOT combine a 206 response with other previously cached 222 | * content if the ETag or Last-Modified headers do not match exactly, see 223 | * 13.5.4. 224 | * 225 | * A cache that does not support the Range and Content-Range headers 226 | * MUST NOT cache 206 (Partial) responses. 227 | * 228 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.7 229 | * 230 | * @var int 231 | */ 232 | public const PARTIAL_CONTENT = 206; 233 | 234 | /** 235 | * The requested resource corresponds to any one of a set of 236 | * representations, each with its own specific location, and agent-driven 237 | * negotiation information is being provided so that the user (or user 238 | * agent) can select a preferred representation and redirect its request 239 | * to that location. 240 | * Unless it was a HEAD request, the response SHOULD include an entity 241 | * containing a list of resource characteristics and location(s) from 242 | * which the user or user agent can choose the one most appropriate. The 243 | * entity format is specified by the media type given in the Content-Type 244 | * header field. Depending upon the format and the capabilities of the 245 | * user agent, selection of the most appropriate choice MAY be performed 246 | * automatically. However, this specification does not define any standard 247 | * for such automatic selection. If the server has a preferred choice of 248 | * representation, it SHOULD include the specific URI for that 249 | * representation in the Location field; user agents MAY use the Location 250 | * field value for automatic redirection. This response is cacheable 251 | * unless indicated otherwise. 252 | * 253 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.1 254 | * 255 | * @var int 256 | */ 257 | public const MULTIPLE_CHOICES = 300; 258 | 259 | /** 260 | * The requested resource has been assigned a new permanent URI and any 261 | * future references to this resource SHOULD use one of the returned URIs. 262 | * Clients with link editing capabilities ought to automatically re-link 263 | * references to the Request-URI to one or more of the new references 264 | * returned by the server, where possible. 265 | * This response is cacheable unless indicated otherwise. 266 | * The new permanent URI SHOULD be given by the Location field in the 267 | * response. Unless the request method was HEAD, the entity of the 268 | * response SHOULD contain a short hypertext note with a hyperlink to the 269 | * new URI(s). 270 | * If the 301 status code is received in response to a request other than 271 | * GET or HEAD, the user agent MUST NOT automatically redirect the request 272 | * unless it can be confirmed by the user, since this might change the 273 | * conditions under which the request was issued. 274 | * 275 | * Note: When automatically redirecting a POST request after 276 | * receiving a 301 status code, some existing HTTP/1.0 user agents 277 | * will erroneously change it into a GET request. 278 | * 279 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.2 280 | * 281 | * @var int 282 | */ 283 | public const MOVED_PERMANENTLY = 301; 284 | 285 | /** 286 | * The requested resource resides temporarily under a different URI. Since 287 | * the redirection might be altered on occasion, the client SHOULD 288 | * continue to use the Request-URI for future requests. This response is 289 | * only cacheable if indicated by a Cache-Control or Expires header field. 290 | * The temporary URI SHOULD be given by the Location field in the 291 | * response. Unless the request method was HEAD, the entity of the 292 | * response SHOULD contain a short hypertext note with a hyperlink to the 293 | * new URI(s). 294 | * If the 302 status code is received in response to a request other than 295 | * GET or HEAD, the user agent MUST NOT automatically redirect the request 296 | * unless it can be confirmed by the user, since this might change the 297 | * conditions under which the request was issued. 298 | * 299 | * Note: RFC 1945 and RFC 2068 specify that the client is not allowed 300 | * to change the method on the redirected request. However, most 301 | * existing user agent implementations treat 302 as if it were a 303 302 | * response, performing a GET on the Location field-value regardless 303 | * of the original request method. The status codes 303 and 307 have 304 | * been added for servers that wish to make unambiguously clear which 305 | * kind of reaction is expected of the client. 306 | * 307 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.3 308 | * 309 | * @var int 310 | */ 311 | public const FOUND = 302; 312 | 313 | /** 314 | * The response to the request can be found under a different URI and 315 | * SHOULD be retrieved using a GET method on that resource. This method 316 | * exists primarily to allow the output of a POST-activated script to 317 | * redirect the user agent to a selected resource. The new URI is not a 318 | * substitute reference for the originally requested resource. The 303 319 | * response MUST NOT be cached, but the response to the second 320 | * (redirected) request might be cacheable. 321 | * The different URI SHOULD be given by the Location field in the 322 | * response. Unless the request method was HEAD, the entity of the 323 | * response SHOULD contain a short hypertext note with a hyperlink to the 324 | * new URI(s). 325 | * Note: Many pre-HTTP/1.1 user agents do not understand the 303 326 | * status. When interoperability with such clients is a concern, the 327 | * 302 status code may be used instead, since most user agents react 328 | * to a 302 response as described here for 303. 329 | * 330 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.4 331 | * 332 | * @var int 333 | */ 334 | public const SEE_OTHER = 303; 335 | 336 | /** 337 | * If the client has performed a conditional GET request and access is 338 | * allowed, but the document has not been modified, the server SHOULD 339 | * respond with this status code. The 304 response MUST NOT contain a 340 | * message-body, and thus is always terminated by the first empty line 341 | * after the header fields. 342 | * The response MUST include the following header fields: 343 | * - Date, unless its omission is required by section 14.18.1 344 | * If a clockless origin server obeys these rules, and proxies and clients 345 | * add their own Date to any response received without one (as already 346 | * specified by [RFC 2068], section 14.19), caches will operate correctly. 347 | * - ETag and/or Content-Location, if the header would have been sent 348 | * in a 200 response to the same request 349 | * - Expires, Cache-Control, and/or Vary, if the field-value might 350 | * differ from that sent in any previous response for the same 351 | * variant. 352 | * 353 | * If the conditional GET used a strong cache validator 354 | * (see section 13.3.3), the response SHOULD NOT include other 355 | * entity-headers. Otherwise (i.e., the conditional GET used a weak 356 | * validator), the response MUST NOT include other entity-headers; this 357 | * prevents inconsistencies between cached entity-bodies and updated 358 | * headers. 359 | * If a 304 response indicates an entity not currently cached, then the 360 | * cache MUST disregard the response and repeat the request without the 361 | * conditional. 362 | * If a cache uses a received 304 response to update a cache entry, the 363 | * cache MUST update the entry to reflect any new field values given in the 364 | * response. 365 | * 366 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.5 367 | * 368 | * @var int 369 | */ 370 | public const NOT_MODIFIED = 304; 371 | 372 | /** 373 | * The requested resource MUST be accessed through the proxy given by the 374 | * Location field. The Location field gives the URI of the proxy. The 375 | * recipient is expected to repeat this single request via the proxy. 376 | * 305 responses MUST only be generated by origin servers. 377 | * Note: RFC 2068 was not clear that 305 was intended to redirect a 378 | * single request, and to be generated by origin servers only. 379 | * Not observing these limitations has significant security 380 | * consequences. 381 | * 382 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.6 383 | * 384 | * @var int 385 | */ 386 | public const USE_PROXY = 305; 387 | 388 | /** 389 | * The requested resource resides temporarily under a different URI. Since 390 | * the redirection MAY be altered on occasion, the client SHOULD continue 391 | * to use the Request-URI for future requests. This response is only 392 | * cacheable if indicated by a Cache-Control or Expires header field. 393 | * The temporary URI SHOULD be given by the Location field in the 394 | * response. Unless the request method was HEAD, the entity of the 395 | * response SHOULD contain a short hypertext note with a hyperlink to the 396 | * new URI(s) , since many pre-HTTP/1.1 user agents do not understand the 397 | * 307 status. Therefore, the note SHOULD contain the information 398 | * necessary for a user to repeat the original request on the new URI. 399 | * If the 307 status code is received in response to a request other than 400 | * GET or HEAD, the user agent MUST NOT automatically redirect the 401 | * request unless it can be confirmed by the user, since this might change 402 | * the conditions under which the request was issued. 403 | * 404 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.7 405 | * 406 | * @var int 407 | */ 408 | public const TEMPORARY_REDIRECT = 307; 409 | 410 | /** 411 | * The request could not be understood by the server due to malformed 412 | * syntax. The client SHOULD NOT repeat the request without modifications. 413 | * 414 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.1 415 | * 416 | * @var int 417 | */ 418 | public const BAD_REQUEST = 400; 419 | 420 | /** 421 | * The request requires user authentication. The response MUST include a 422 | * WWW-Authenticate header field (section 14.47) containing a challenge 423 | * applicable to the requested resource. The client MAY repeat the request 424 | * with a suitable Authorization header field (section 14.8). If the 425 | * request already included Authorization credentials, then the 401 426 | * response indicates that authorization has been refused for those 427 | * credentials. If the 401 response contains the same challenge as the 428 | * prior response, and the user agent has already attempted authentication 429 | * at least once, then the user SHOULD be presented the entity that was 430 | * given in the response, since that entity might include relevant 431 | * diagnostic information. HTTP access authentication is explained in 432 | * "HTTP Authentication: Basic and Digest Access Authentication" [43]. 433 | * 434 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.2 435 | * 436 | * @var int 437 | */ 438 | public const UNAUTHORIZED = 401; 439 | 440 | /** 441 | * This code is reserved for future use. 442 | * 443 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.3 444 | * 445 | * @var int 446 | */ 447 | public const PAYMENT_REQUIRED = 402; 448 | 449 | /** 450 | * The server understood the request, but is refusing to fulfill it. 451 | * Authorization will not help and the request SHOULD NOT be repeated. If 452 | * the request method was not HEAD and the server wishes to make public 453 | * why the request has not been fulfilled, it SHOULD describe the reason 454 | * for the refusal in the entity. If the server does not wish to make this 455 | * information available to the client, the status code 404 (Not Found) 456 | * can be used instead. 457 | * 458 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.4 459 | * 460 | * @var int 461 | */ 462 | public const FORBIDDEN = 403; 463 | 464 | /** 465 | * The server has not found anything matching the Request-URI. No 466 | * indication is given of whether the condition is temporary or permanent. 467 | * The 410 (Gone) status code SHOULD be used if the server knows, through 468 | * some internally configurable mechanism, that an old resource is 469 | * permanently unavailable and has no forwarding address. 470 | * This status code is commonly used when the server does not wish to 471 | * reveal exactly why the request has been refused, or when no other 472 | * response is applicable. 473 | * 474 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.5 475 | * 476 | * @var int 477 | */ 478 | public const NOT_FOUND = 404; 479 | 480 | /** 481 | * The method specified in the Request-Line is not allowed for the resource 482 | * identified by the Request-URI. The response MUST include an Allow header 483 | * containing a list of valid methods for the requested resource. 484 | * 485 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.6 486 | * 487 | * @var int 488 | */ 489 | public const METHOD_NOT_ALLOWED = 405; 490 | 491 | /** 492 | * The resource identified by the request is only capable of generating 493 | * response entities which have content characteristics not acceptable 494 | * according to the accept headers sent in the request. 495 | * 496 | * Unless it was a HEAD request, the response SHOULD include an entity 497 | * containing a list of available entity characteristics and location(s) 498 | * from which the user or user agent can choose the one most appropriate. 499 | * The entity format is specified by the media type given in the 500 | * Content-Type header field. Depending upon the format and the 501 | * capabilities of the user agent, selection of the most appropriate 502 | * choice MAY be performed automatically. However, this specification does 503 | * not define any standard for such automatic selection. 504 | * Note: HTTP/1.1 servers are allowed to return responses which are 505 | * not acceptable according to the accept headers sent in the request. 506 | * In some cases, this may even be preferable to sending a 406 507 | * response. User agents are encouraged to inspect the headers of an 508 | * incoming response to determine if it is acceptable. 509 | * 510 | * If the response could be unacceptable, a user agent SHOULD temporarily 511 | * stop receipt of more data and query the user for a decision on further 512 | * actions. 513 | * 514 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.7 515 | * 516 | * @var int 517 | */ 518 | public const NOT_ACCEPTABLE = 406; 519 | 520 | /** 521 | * This code is similar to 401 (Unauthorized), but indicates that the 522 | * client must first authenticate itself with the proxy. The proxy MUST 523 | * return a Proxy-Authenticate header field (section 14.33) containing a 524 | * challenge applicable to the proxy for the requested resource. The 525 | * client MAY repeat the request with a suitable Proxy-Authorization 526 | * header field (section 14.34). HTTP access authentication is explained 527 | * in "HTTP Authentication: Basic and Digest Access Authentication" [43]. 528 | * 529 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.8 530 | * 531 | * @var int 532 | */ 533 | public const PROXY_AUTHENTICATION_REQUIRED = 407; 534 | 535 | /** 536 | * The client did not produce a request within the time that the server 537 | * was prepared to wait. The client MAY repeat the request without 538 | * modifications at any later time. 539 | * 540 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.9 541 | * 542 | * @var int 543 | */ 544 | public const REQUEST_TIMEOUT = 408; 545 | 546 | /** 547 | * The request could not be completed due to a conflict with the current 548 | * state of the resource. This code is only allowed in situations where it 549 | * is expected that the user might be able to resolve the conflict and 550 | * resubmit the request. The response body SHOULD include enough 551 | * information for the user to recognize the source of the conflict. 552 | * Ideally, the response entity would include enough information for the 553 | * user or user agent to fix the problem; however, that might not be 554 | * possible and is not required. 555 | * Conflicts are most likely to occur in response to a PUT request. For 556 | * example, if versioning were being used and the entity being PUT 557 | * included changes to a resource which conflict with those made by an 558 | * earlier (third-party) request, the server might use the 409 response to 559 | * indicate that it can't complete the request. 560 | * In this case, the response entity would likely contain a list of the 561 | * differences between the two versions in a format defined by the 562 | * response Content-Type. 563 | * 564 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.10 565 | * 566 | * @var int 567 | */ 568 | public const CONFLICT = 409; 569 | 570 | /** 571 | * The requested resource is no longer available at the server and no 572 | * forwarding address is known. This condition is expected to be 573 | * considered permanent. Clients with link editing capabilities SHOULD 574 | * delete references to the Request-URI after user approval. If the server 575 | * does not know, or has no facility to determine, whether or not the 576 | * condition is permanent, the status code 404 (Not Found) SHOULD be used 577 | * instead. This response is cacheable unless indicated otherwise. 578 | * 579 | * The 410 response is primarily intended to assist the task of web 580 | * maintenance by notifying the recipient that the resource is 581 | * intentionally unavailable and that the server owners desire that 582 | * remote links to that resource be removed. Such an event is common for 583 | * limited-time, promotional services and for resources belonging to 584 | * individuals no longer working at the server's site. It is not necessary 585 | * to mark all permanently unavailable resources as "gone" or to keep the 586 | * mark for any length of time -- that is left to the discretion of the 587 | * server owner. 588 | * 589 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.11 590 | * 591 | * @var int 592 | */ 593 | public const GONE = 410; 594 | 595 | /** 596 | * The server refuses to accept the request without a defined 597 | * Content-Length. The client MAY repeat the request if it adds a valid 598 | * Content-Length header field containing the length of the message-body 599 | * in the request message. 600 | * 601 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.12 602 | * 603 | * @var int 604 | */ 605 | public const LENGTH_REQUIRED = 411; 606 | 607 | /** 608 | * The precondition given in one or more of the request-header fields 609 | * evaluated to false when it was tested on the server. This response code 610 | * allows the client to place preconditions on the current resource 611 | * metainformation (header field data) and thus prevent the requested 612 | * method from being applied to a resource other than the one intended. 613 | * 614 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.13 615 | * 616 | * @var int 617 | */ 618 | public const PRECONDITION_FAILED = 412; 619 | 620 | /** 621 | * The server is refusing to process a request because the request entity 622 | * is larger than the server is willing or able to process. The server MAY 623 | * close the connection to prevent the client from continuing the request. 624 | * If the condition is temporary, the server SHOULD include a Retry- After 625 | * header field to indicate that it is temporary and after what time the 626 | * client MAY try again. 627 | * 628 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.14 629 | * 630 | * @var int 631 | */ 632 | public const REQUEST_ENTITY_TOO_LARGE = 413; 633 | 634 | /** 635 | * The server is refusing to service the request because the Request-URI 636 | * is longer than the server is willing to interpret. This rare condition 637 | * is only likely to occur when a client has improperly converted a POST 638 | * request to a GET request with long query information, when the client 639 | * has descended into a URI "black hole" of redirection (e.g., a 640 | * redirected URI prefix that points to a suffix of itself), or when the 641 | * server is under attack by a client attempting to exploit security holes 642 | * present in some servers using fixed-length buffers for reading or 643 | * manipulating the Request-URI. 644 | * 645 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.15 646 | * 647 | * @var int 648 | */ 649 | public const REQUEST_URI_TOO_LONG = 414; 650 | 651 | /** 652 | * The server is refusing to service the request because the entity of the 653 | * request is in a format not supported by the requested resource for the 654 | * requested method. 655 | * 656 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.16 657 | * 658 | * @var int 659 | */ 660 | public const UNSUPPORTED_MEDIA_TYPE = 415; 661 | 662 | /** 663 | * A server SHOULD return a response with this status code if a request 664 | * included a Range request-header field (section 14.35), and none of the 665 | * range-specifier values in this field overlap the current extent of the 666 | * selected resource, and the request did not include an If-Range 667 | * request-header field. (For byte-ranges, this means that the 668 | * first-byte-pos of all of the byte-range-spec values were greater than 669 | * the current length of the selected resource.) 670 | * When this status code is returned for a byte-range request, the 671 | * response SHOULD include a Content-Range entity-header field specifying 672 | * the current length of the selected resource (see section 14.16). This 673 | * response MUST NOT use the multipart/byteranges content-type. 674 | * 675 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.17 676 | * 677 | * @var int 678 | */ 679 | public const REQUESTED_RANGE_NOT_SATISFIABLE = 416; 680 | 681 | /** 682 | * The expectation given in an Expect request-header field (see section 683 | * 14.20) could not be met by this server, or, if the server is a proxy, 684 | * the server has unambiguous evidence that the request could not be met 685 | * by the next-hop server. 686 | * 687 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.4.18 688 | * 689 | * @var int 690 | */ 691 | public const EXPECTATION_FAILED = 417; 692 | 693 | /** 694 | * The server encountered an unexpected condition which prevented it from 695 | * fulfilling the request. 696 | * 697 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.5.1 698 | * 699 | * @var int 700 | */ 701 | public const INTERNAL_SERVER_ERROR = 500; 702 | 703 | /** 704 | * The server does not support the functionality required to fulfill the 705 | * request. This is the appropriate response when the server does not 706 | * recognize the request method and is not capable of supporting it for 707 | * any resource. 708 | * 709 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.5.2 710 | * 711 | * @var int 712 | */ 713 | public const NOT_IMPLEMENTED = 501; 714 | 715 | /** 716 | * The server, while acting as a gateway or proxy, received an invalid 717 | * response from the upstream server it accessed in attempting to fulfill 718 | * the request. 719 | * 720 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.5.3 721 | * 722 | * @var int 723 | */ 724 | public const BAD_GATEWAY = 502; 725 | 726 | /** 727 | * The server is currently unable to handle the request due to a temporary 728 | * overloading or maintenance of the server. The implication is that this 729 | * is a temporary condition which will be alleviated after some delay. If 730 | * known, the length of the delay MAY be indicated in a Retry-After header. 731 | * If no Retry-After is given, the client SHOULD handle the response as it 732 | * would for a 500 response. 733 | * Note: The existence of the 503 status code does not imply that a 734 | * server must use it when becoming overloaded. Some servers may wish to 735 | * simply refuse the connection. 736 | * 737 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.5.4 738 | * 739 | * @var int 740 | */ 741 | public const SERVICE_UNAVAILABLE = 503; 742 | 743 | /** 744 | * The server, while acting as a gateway or proxy, did not receive a 745 | * timely response from the upstream server specified by the URI (e.g. 746 | * HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to 747 | * access in attempting to complete the request. 748 | * Note: Note to implementors: some deployed proxies are known to 749 | * return 400 or 500 when DNS lookups time out. 750 | * 751 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.5.5 752 | * 753 | * @var int 754 | */ 755 | public const GATEWAY_TIMEOUT = 504; 756 | 757 | /** 758 | * The server does not support, or refuses to support, the HTTP protocol 759 | * version that was used in the request message. The server is indicating 760 | * that it is unable or unwilling to complete the request using the same 761 | * major version as the client, as described in section 3.1, other than 762 | * with this error message. 763 | * The response SHOULD contain an entity describing why that version is 764 | * not supported and what other protocols are supported by that server. 765 | * 766 | * @see https://datatracker.ietf.org/doc/html/rfc2616#section-10.5.6 767 | * 768 | * @var int 769 | */ 770 | public const HTTP_VERSION_NOT_SUPPORTED = 505; 771 | } 772 | -------------------------------------------------------------------------------- /src/RFC/RFC2774.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\Experimental as ExperimentalStatus; 28 | use Teapot\StatusCode\RFC\Stream\Legacy as LegacyStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC2774. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC2774 extends ExperimentalStatus, LegacyStream 50 | { 51 | /** 52 | * The policy for accessing the resource has not been met in the 53 | * request. The server should send back all the information necessary 54 | * for the client to issue an extended request. It is outside the scope 55 | * of this specification to specify how the extensions inform the client. 56 | * 57 | * If the 510 response contains information about extensions that were 58 | * not present in the initial request then the client MAY repeat the 59 | * request if it has reason to believe it can fulfill the extension 60 | * policy by modifying the request according to the information provided 61 | * in the 510 response. Otherwise the client MAY present any entity 62 | * included in the 510 response to the user, since that entity may 63 | * include relevant diagnostic information. 64 | * 65 | * @see https://datatracker.ietf.org/doc/html/rfc2774#section-7 66 | * 67 | * @var int 68 | */ 69 | public const NOT_EXTENDED = 510; 70 | } 71 | -------------------------------------------------------------------------------- /src/RFC/RFC2817.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC2817. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC2817 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The Upgrade response header field advertises possible protocol upgrades 53 | * a server MAY accept. In conjunction with the "426 Upgrade Required" 54 | * status code, a server can advertise the exact protocol upgrades that a 55 | * client MUST accept to complete the request. The server MAY include an 56 | * Upgrade header in any response other than 101 or 426 to indicate a 57 | * willingness to switch to any (combination) of the protocols listed. 58 | * 59 | * @see https://datatracker.ietf.org/doc/html/rfc2817#section-4.2 60 | * 61 | * @var int 62 | */ 63 | public const UPGRADE_REQUIRED = 426; 64 | } 65 | -------------------------------------------------------------------------------- /src/RFC/RFC3229.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\Legacy as LegacyStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC3229. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC3229 extends LegacyStream, ProposedStandard 50 | { 51 | /** 52 | * The server has fulfilled a GET request for the resource, and the 53 | * response is a representation of the result of one or more 54 | * instance-manipulations applied to the current instance. The actual 55 | * current instance might not be available except by combining this response 56 | * with other previous or future responses, as appropriate for the 57 | * specific instance-manipulation(s). If so, the headers of the 58 | * resulting instance are the result of combining the headers from the 59 | * status-226 response and the other instances, following the rules in 60 | * section 13.5.3 of the HTTP/1.1 specification [10]. 61 | * 62 | * The request MUST have included an A-IM header field listing at least 63 | * one instance-manipulation. The response MUST include an Etag header 64 | * field giving the entity tag of the current instance. A response received 65 | * with a status code of 226 MAY be stored by a cache and used in reply to 66 | * a subsequent request, subject to the HTTP expiration mechanism and any 67 | * Cache-Control headers, and to the requirements in section 10.6. 68 | * 69 | * A response received with a status code of 226 MAY be used by a cache, 70 | * in conjunction with a cache entry for the base instance, to create a 71 | * cache entry for the current instance. 72 | * 73 | * @see https://datatracker.ietf.org/doc/html/rfc3229#section-10.4.1 74 | * 75 | * @var int 76 | */ 77 | public const IM_USED = 226; 78 | } 79 | -------------------------------------------------------------------------------- /src/RFC/RFC3648.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC3648. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC3648 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * Unordered Collection (Internet draft). 53 | * 54 | * The 425 (Unordered Collection) status code indicates that the client 55 | * attempted to set the position of an internal collection member in an 56 | * unordered collection or in a collection with a server-maintained 57 | * ordering. 58 | * Defined in drafts of "WebDAV Advanced Collections Protocol", but not 59 | * present in "Web Distributed Authoring and Versioning (WebDAV) Ordered 60 | * Collections Protocol". 61 | * 62 | * @see https://datatracker.ietf.org/doc/html/draft-ietf-webdav-collection-protocol-04#section-425 63 | * 64 | * @var int 65 | */ 66 | public const UNORDERED_COLLECTION = 425; 67 | } 68 | -------------------------------------------------------------------------------- /src/RFC/RFC4918.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC4918. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC4918 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The message body that follows is an XML message and can contain a 53 | * number of separate response codes, depending on how many sub-requests 54 | * were made. 55 | * 56 | * Multiple resources were to be affected by the COPY, but errors on some of 57 | * them prevented the operation from taking place. Specific error messages, 58 | * together with the most appropriate of the source and destination URLs, 59 | * appear in the body of the multi-status response. For example, if a 60 | * destination resource was locked and could not be overwritten, then the 61 | * destination resource URL appears with the 423 (Locked) status. 62 | * 63 | * @see https://datatracker.ietf.org/doc/html/rfc4918/#section-11.1 64 | * 65 | * @var int 66 | */ 67 | public const MULTI_STATUS = 207; 68 | 69 | /** 70 | * The 422 (Unprocessable Entity) status code means the server understands 71 | * the content type of the request entity (hence a 72 | * 415[Unsupported Media Type] status code is inappropriate), and the 73 | * syntax of the request entity is correct (thus a 400 (Bad Request) 74 | * status code is inappropriate) but was unable to process the contained 75 | * instructions. For example, this error condition may occur if an XML 76 | * request body contains well-formed (i.e., syntactically correct), but 77 | * semantically erroneous, XML instructions. 78 | * 79 | * @see https://datatracker.ietf.org/doc/html/rfc4918/#section-11.2 80 | * 81 | * @var int 82 | */ 83 | public const UNPROCESSABLE_ENTITY = 422; 84 | 85 | /** 86 | * The 423 (Locked) status code means the source or destination resource 87 | * of a method is locked. This response SHOULD contain an appropriate 88 | * precondition or post-condition code, such as 'lock-token-submitted' or 89 | * 'no-conflicting-lock'. 90 | * 91 | * @see https://datatracker.ietf.org/doc/html/rfc4918/#section-11.3 92 | * 93 | * @var int 94 | */ 95 | public const ENTITY_LOCKED = 423; 96 | 97 | /** 98 | * Indicates the method was not executed on a particular resource within 99 | * its scope because some part of the method's execution failed causing the 100 | * entire method to be aborted. 101 | * 102 | * @see https://datatracker.ietf.org/doc/html/rfc4918/#section-11.4 103 | * 104 | * @var int 105 | */ 106 | public const METHOD_FAILURE = 424; 107 | 108 | /** 109 | * The 424 (Failed Dependency) status code means that the method could not 110 | * be performed on the resource because the requested action 111 | * depended on another action and that action failed. For example, if a 112 | * command in a PROPPATCH method fails then, at minimum, the rest 113 | * of the commands will also fail with 424 (Failed Dependency). 114 | * 115 | * @see https://datatracker.ietf.org/doc/html/rfc4918/#section-11.4 116 | * 117 | * @var int 118 | */ 119 | public const FAILED_DEPENDENCY = 424; 120 | 121 | /** 122 | * The server is unable to store the representation needed to complete the 123 | * request. 124 | * 125 | * @see https://datatracker.ietf.org/doc/html/rfc4918/#section-11.5 126 | * 127 | * @var int 128 | */ 129 | public const INSUFFICIENT_STORAGE = 507; 130 | } 131 | -------------------------------------------------------------------------------- /src/RFC/RFC5842.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\Experimental as ExperimentalStatus; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC5842. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC5842 extends ExperimentalStatus, IETFStream 50 | { 51 | /** 52 | * The members of a DAV binding have already been enumerated in a previous 53 | * reply to this request, and are not being included again. 54 | * 55 | * The 208 (Already Reported) status code can be used inside a DAV: propstat 56 | * response element to avoid enumerating the internal members of multiple 57 | * bindings to the same collection repeatedly. For each binding to a 58 | * collection inside the request's scope, only one will be reported with 59 | * a 200 status, while subsequent DAV:response elements for all other 60 | * bindings will use the 208 status, and no DAV:response elements for 61 | * their descendants are included. 62 | * 63 | * @see https://datatracker.ietf.org/doc/html/rfc5842#section-7.1 64 | * 65 | * @var int 66 | */ 67 | public const ALREADY_REPORTED = 208; 68 | 69 | /** 70 | * The 508 (Loop Detected) status code indicates that the server detected 71 | * an infinite loop while processing a request with "Depth: infinity". 72 | * (sent in lieu of 208). 73 | * 74 | * @see https://datatracker.ietf.org/doc/html/rfc5842#section-7.2 75 | * 76 | * @var int 77 | */ 78 | public const LOOP_DETECTED = 508; 79 | } 80 | -------------------------------------------------------------------------------- /src/RFC/RFC6585.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC6585. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC6585 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The origin server requires the request to be conditional. Its typical 53 | * use is to avoid the "lost update" problem, where a client GETs a 54 | * resource's state, modifies it, and PUTs it back to the server, when 55 | * meanwhile a third party has modified the state on the server, leading to 56 | * a conflict. By requiring requests to be conditional, the server can 57 | * assure that clients are working with the correct copies. 58 | * 59 | * Responses using this status code SHOULD explain how to resubmit the 60 | * request successfully. 61 | * 62 | * Responses with the 428 status code MUST NOT be stored by a cache. 63 | * 64 | * @see https://datatracker.ietf.org/doc/html/rfc6585#section-3 65 | * 66 | * @var int 67 | */ 68 | public const PRECONDITION_REQUIRED = 428; 69 | 70 | /** 71 | * The 429 status code indicates that the user has sent too many requests 72 | * in a given amount of time ("rate limiting"). 73 | * 74 | * The response representations SHOULD include details explaining the 75 | * condition, and MAY include a Retry-After header indicating how long 76 | * to wait before making a new request. 77 | * 78 | * For example: 79 | * 80 | * HTTP/1.1 429 Too Many Requests 81 | * Content-Type: text/html 82 | * Retry-After: 3600 83 | * 84 | * 85 | * Too Many Requests 86 | * 87 | * 88 | *

Too Many Requests

89 | *

I only allow 50 requests per hour to this Web site per 90 | * logged in user. Try again soon.

91 | * 92 | * 93 | * 94 | * Note that this specification does not define how the origin server 95 | * identifies the user, nor how it counts requests. For example, an 96 | * origin server that is limiting request rates can do so based upon 97 | * counts of requests on a per-resource basis, across the entire server, 98 | * or even among a set of servers. Likewise, it might identify the user 99 | * by its authentication credentials, or a stateful cookie. 100 | * 101 | * Responses with the 429 status code MUST NOT be stored by a cache. 102 | * 103 | * @see https://datatracker.ietf.org/doc/html/rfc6585#section-4 104 | * 105 | * @var int 106 | */ 107 | public const TOO_MANY_REQUESTS = 429; 108 | 109 | /** 110 | * The 431 status code indicates that the server is unwilling to process 111 | * the request because its header fields are too large. The request MAY 112 | * be resubmitted after reducing the size of the request header fields. 113 | * 114 | * It can be used both when the set of request header fields in total is 115 | * too large, and when a single header field is at fault. In the latter 116 | * case, the response representation SHOULD specify which header field 117 | * was too large. 118 | * 119 | * @see https://datatracker.ietf.org/doc/html/rfc6585#section-5 120 | * 121 | * @var int 122 | */ 123 | public const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; 124 | 125 | /** 126 | * The 511 status code is designed to mitigate problems caused by 127 | * "captive portals" to software (especially non-browser agents) that is 128 | * expecting a response from the server that a request was made to, not 129 | * the intervening network infrastructure. It is not intended to 130 | * encourage deployment of captive portals -- only to limit the damage 131 | * caused by them. 132 | * 133 | * A network operator wishing to require some authentication, acceptance 134 | * of terms, or other user interaction before granting access usually 135 | * does so by identifying clients who have not done so ("unknown 136 | * clients") using their Media Access Control (MAC) addresses. 137 | * 138 | * Unknown clients then have all traffic blocked, except for that on TCP 139 | * port 80, which is sent to an HTTP server (the "login server") 140 | * dedicated to "logging in" unknown clients, and of course traffic to 141 | * the login server itself. 142 | * 143 | * @see https://datatracker.ietf.org/doc/html/rfc6585#section-6 144 | * 145 | * @var int 146 | */ 147 | public const NETWORK_AUTHENTICATION_REQUIRED = 511; 148 | } 149 | -------------------------------------------------------------------------------- /src/RFC/RFC7168.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\Informational as InformationalStatus; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7168. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7168 extends IETFStream, InformationalStatus 50 | { 51 | /** 52 | * A BREW request to the "/" URI, as defined in Section 2.1.1, will 53 | * return an Alternates header indicating the URIs of the available 54 | * varieties of tea to brew. It is RECOMMENDED that this response be 55 | * served with a status code of 300, to indicate that brewing has not 56 | * commenced and further options must be chosen by the client. 57 | * 58 | * @see https://datatracker.ietf.org/doc/html/rfc7168#section-2.3.1 59 | * @var int 60 | */ 61 | public const MULTIPLE_OPTIONS = 300; 62 | 63 | /** 64 | * Services that implement the Accept-Additions header field MAY return 65 | * a 403 status code for a BREW request of a given variety of tea, if 66 | * the service deems the combination of additions requested to be 67 | * contrary to the sensibilities of a consensus of drinkers regarding 68 | * the variety in question. 69 | * 70 | * A method of garnering and collating consensus indicators of the most 71 | * viable combinations of additions for each variety to be served is 72 | * outside the scope of this document. 73 | * 74 | * @see https://datatracker.ietf.org/doc/html/rfc7168#section-2.3.2 75 | * @var int 76 | */ 77 | public const BREW_FORBIDDEN = 403; 78 | 79 | /** 80 | * TEA-capable pots that are not provisioned to brew coffee may return 81 | * either a status code of 503, indicating temporary unavailability of 82 | * coffee, or a code of 418 as defined in the base HTCPCP specification 83 | * to denote a more permanent indication that the pot is a teapot. 84 | * 85 | * @see https://datatracker.ietf.org/doc/html/rfc7168#section-2.3.3 86 | * @var int 87 | */ 88 | public const IM_A_TEAPOT = 418; 89 | } 90 | -------------------------------------------------------------------------------- /src/RFC/RFC7231.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7231. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7231 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The 100 (Continue) status code indicates that the initial part of a request 53 | * has been received and has not yet been rejected by the server. The server 54 | * intends to send a final response after the request has been fully received 55 | * and acted upon. 56 | * 57 | * When the request contains an Expect header field that includes a 58 | * 100-continue expectation, the 100 response indicates that the server wishes 59 | * to receive the request payload body, as described in Section 5.1.1. The 60 | * client ought to continue sending the request and discard the 100 response. 61 | * 62 | * If the request did not contain an Expect header field containing the 63 | * 100-continue expectation, the client can simply discard this interim 64 | * response. 65 | * 66 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.2.1 67 | * 68 | * @var int 69 | */ 70 | public const CONTINUING = 100; 71 | 72 | /** 73 | * As 'continue' is a reserved word in PHP, we append an underscore, so 74 | * developers can decide whether to use CONTINUING or CONTINUE_ as their 75 | * preferred choice of constant. 76 | * 77 | * @see RFC7231:CONTINUING 78 | * @var int 79 | */ 80 | public const CONTINUE_ = self::CONTINUING; 81 | 82 | /** 83 | * The 101 (Switching Protocols) status code indicates that the server 84 | * understands and is willing to comply with the client's request, via the 85 | * Upgrade header field (Section 6.7 of [RFC7230]), for a change in the 86 | * application protocol being used on this connection. The server must 87 | * generate an Upgrade header field in the response that indicates which 88 | * protocol(s) will be switched to immediately after the empty line that 89 | * terminates the 101 response.¶ 90 | * 91 | * It is assumed that the server will only agree to switch protocols when it 92 | * is advantageous to do so. For example, switching to a newer version of HTTP 93 | * might be advantageous over older versions, and switching to a real-time, 94 | * synchronous protocol might be advantageous when delivering resources that 95 | * use such features. 96 | * 97 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.2.2 98 | * 99 | * @var int 100 | */ 101 | public const SWITCHING_PROTOCOLS = 101; 102 | 103 | /** 104 | * The 200 (OK) status code indicates that the request has succeeded. The 105 | * payload sent in a 200 response depends on the request method. For the 106 | * methods defined by this specification, the intended meaning of the 107 | * payload can be summarized as: ¶ 108 | * - GET 109 | * a representation of the target resource; 110 | * - HEAD 111 | * the same representation as GET, but without the representation data; 112 | * - POST 113 | * a representation of the status of, or results obtained from, the 114 | * action; 115 | * - PUT, DELETE 116 | * a representation of the status of the action; 117 | * - OPTIONS 118 | * a representation of the communications options; 119 | * - TRACE 120 | * a representation of the request message as received by the end server. 121 | * 122 | * Aside from responses to CONNECT, a 200 response always has a payload, 123 | * though an origin server may generate a payload body of zero length. If no 124 | * payload is desired, an origin server ought to send 204 (No Content) 125 | * instead. For CONNECT, no payload is allowed because the successful result 126 | * is a tunnel, which begins immediately after the 200 response header 127 | * section. 128 | * 129 | * A 200 response is cacheable by default; i.e., unless otherwise indicated 130 | * by the method definition or explicit cache controls (see Section 4.2.2 of 131 | * {@link https://datatracker.ietf.org/doc/html/rfc7234#section-4.2.2 RFC7234}). 132 | * 133 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.1 134 | * 135 | * @var int 136 | */ 137 | public const OK = 200; 138 | 139 | /** 140 | * The 201 (Created) status code indicates that the request has been 141 | * fulfilled and has resulted in one or more new resources being created. 142 | * The primary resource created by the request is identified by either a 143 | * Location header field in the response or, if no Location field is 144 | * received, by the effective request URI.¶ 145 | * 146 | * The 201 response payload typically describes and links to the resource(s) 147 | * created. See Section 7.2 for a discussion of the meaning and purpose of 148 | * validator header fields, such as ETag and Last-Modified, in a 201 149 | * response. 150 | * 151 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.2 152 | * 153 | * @var int 154 | */ 155 | public const CREATED = 201; 156 | 157 | /** 158 | * The 202 (Accepted) status code indicates that the request has been 159 | * accepted for processing, but the processing has not been completed. The 160 | * request might or might not eventually be acted upon, as it might be 161 | * disallowed when processing actually takes place. There is no facility in 162 | * HTTP for re-sending a status code from an asynchronous operation. 163 | * 164 | * The 202 response is intentionally noncommittal. Its purpose is to allow a 165 | * server to accept a request for some other process (perhaps a 166 | * batch-oriented process that is only run once per day) without requiring 167 | * that the user agent's connection to the server persist until the process 168 | * is completed. The representation sent with this response ought to 169 | * describe the request's current status and point to (or embed) a status 170 | * monitor that can provide the user with an estimate of when the request 171 | * will be fulfilled. 172 | * 173 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.3 174 | * 175 | * @var int 176 | */ 177 | public const ACCEPTED = 202; 178 | 179 | /** 180 | * The 203 (Non-Authoritative Information) status code indicates that the 181 | * request was successful but the enclosed payload has been modified from 182 | * that of the origin server's 200 (OK) response by a transforming proxy 183 | * (Section 5.7.2 of [RFC7230]). This status code allows the proxy to notify 184 | * recipients when a transformation has been applied, since that knowledge 185 | * might impact later decisions regarding the content. For example, future 186 | * cache validation requests for the content might only be applicable along 187 | * the same request path (through the same proxies). 188 | * 189 | * The 203 response is similar to the Warning code of 214 Transformation 190 | * Applied (Section 5.5 of [RFC7234]), which has the advantage of being 191 | * applicable to responses with any status code. 192 | * 193 | * A 203 response is cacheable by default; i.e., unless otherwise indicated 194 | * by the method definition or explicit cache controls (see Section 4.2.2 of 195 | * [RFC7234]). 196 | * 197 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.4 198 | * 199 | * @var int 200 | */ 201 | public const NON_AUTHORITATIVE_INFORMATION = 203; 202 | 203 | /** 204 | * The 204 (No Content) status code indicates that the server has 205 | * successfully fulfilled the request and that there is no additional 206 | * content to send in the response payload body. Metadata in the response 207 | * header fields refer to the target resource and its selected 208 | * representation after the requested action was applied.¶ 209 | * 210 | * For example, if a 204 status code is received in response to a PUT 211 | * request and the response contains an ETag header field, then the PUT was 212 | * successful and the ETag field-value contains the entity-tag for the new 213 | * representation of that target resource. 214 | * 215 | * The 204 response allows a server to indicate that the action has been 216 | * successfully applied to the target resource, while implying that the user 217 | * agent does not need to traverse away from its current "document view" 218 | * (if any). The server assumes that the user agent will provide some 219 | * indication of the success to its user, in accord with its own interface, 220 | * and apply any new or updated metadata in the response to its active 221 | * representation. 222 | * 223 | * For example, a 204 status code is commonly used with document editing 224 | * interfaces corresponding to a "save" action, such that the document being 225 | * saved remains available to the user for editing. It is also frequently 226 | * used with interfaces that expect automated data transfers to be 227 | * prevalent, such as within distributed version control systems. 228 | * 229 | * A 204 response is terminated by the first empty line after the header 230 | * fields because it cannot contain a message body. 231 | * 232 | * A 204 response is cacheable by default; i.e., unless otherwise indicated 233 | * by the method definition or explicit cache controls (see Section 4.2.2 of 234 | * [RFC7234]). 235 | * 236 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.5 237 | * 238 | * @var int 239 | */ 240 | public const NO_CONTENT = 204; 241 | 242 | /** 243 | * The 205 (Reset Content) status code indicates that the server has 244 | * fulfilled the request and desires that the user agent reset the "document 245 | * view", which caused the request to be sent, to its original state as 246 | * received from the origin server. 247 | * 248 | * This response is intended to support a common data entry use case where 249 | * the user receives content that supports data entry (a form, notepad, 250 | * canvas, etc.), enters or manipulates data in that space, causes the 251 | * entered data to be submitted in a request, and then the data entry 252 | * mechanism is reset for the next entry so that the user can easily 253 | * initiate another input action. 254 | * 255 | * Since the 205 status code implies that no additional content will be 256 | * provided, a server must not generate a payload in a 205 response. In 257 | * other words, a server must do one of the following for a 205 response: 258 | * a) indicate a zero-length body for the response by including a 259 | * Content-Length header field with a value of 0; 260 | * b) indicate a zero-length payload for the response by including a 261 | * Transfer-Encoding header field with a value of chunked and a message body 262 | * consisting of a single chunk of zero-length; or, 263 | * c) close the connection immediately after sending the blank line 264 | * terminating the header section. 265 | * 266 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.6 267 | * 268 | * @var int 269 | */ 270 | public const RESET_CONTENT = 205; 271 | 272 | /** 273 | * The 300 (Multiple Choices) status code indicates that the target resource 274 | * has more than one representation, each with its own more specific 275 | * identifier, and information about the alternatives is being provided so 276 | * that the user (or user agent) can select a preferred representation by 277 | * redirecting its request to one or more of those identifiers. In other 278 | * words, the server desires that the user agent engage in reactive 279 | * negotiation to select the most appropriate representation(s) for its 280 | * needs (Section 3.4). 281 | * 282 | * If the server has a preferred choice, the server should generate a 283 | * Location header field containing a preferred choice's URI reference. The 284 | * user agent may use the Location field value for automatic redirection. 285 | * 286 | * For request methods other than HEAD, the server should generate a payload 287 | * in the 300 response containing a list of representation metadata and URI 288 | * reference(s) from which the user or user agent can choose the one most 289 | * preferred. The user agent may make a selection from that list 290 | * automatically if it understands the provided media type. A specific 291 | * format for automatic selection is not defined by this specification 292 | * because HTTP tries to remain orthogonal to the definition of its 293 | * payloads. In practice, the representation is provided in some easily 294 | * parsed format believed to be acceptable to the user agent, as determined 295 | * by shared design or content negotiation, or in some commonly accepted 296 | * hypertext format. 297 | * 298 | * A 300 response is cacheable by default; i.e., unless otherwise indicated 299 | * by the method definition or explicit cache controls (see Section 4.2.2 of 300 | * [RFC7234]). 301 | * 302 | * Note: The original proposal for the 300 status code defined the URI 303 | * header field as providing a list of alternative representations, such 304 | * that it would be usable for 200, 300, and 406 responses and be 305 | * transferred in responses to the HEAD method. However, lack of deployment 306 | * and disagreement over syntax led to both URI and Alternates (a subsequent 307 | * proposal) being dropped from this specification. It is possible to 308 | * communicate the list using a set of Link header fields [RFC5988], each 309 | * with a relationship of "alternate", though deployment is a 310 | * chicken-and-egg problem. 311 | * 312 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.1 313 | * 314 | * @var int 315 | */ 316 | public const MULTIPLE_CHOICES = 300; 317 | 318 | /** 319 | * The 301 (Moved Permanently) status code indicates that the target 320 | * resource has been assigned a new permanent URI and any future references 321 | * to this resource ought to use one of the enclosed URIs. Clients with 322 | * link-editing capabilities ought to automatically re-link references to 323 | * the effective request URI to one or more of the new references sent by 324 | * the server, where possible. 325 | * 326 | * The server should generate a Location header field in the response 327 | * containing a preferred URI reference for the new permanent URI. The user 328 | * agent may use the Location field value for automatic redirection. The 329 | * server's response payload usually contains a short hypertext note with a 330 | * hyperlink to the new URI(s). 331 | * 332 | * Note: For historical reasons, a user agent may change the request method 333 | * from POST to GET for the subsequent request. If this behavior is 334 | * undesired, the 307 (Temporary Redirect) status code can be used instead. 335 | * 336 | * A 301 response is cacheable by default; i.e., unless otherwise indicated 337 | * by the method definition or explicit cache controls (see Section 4.2.2 of 338 | * [RFC7234]). 339 | * 340 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.2 341 | * 342 | * @var int 343 | */ 344 | public const MOVED_PERMANENTLY = 301; 345 | 346 | /** 347 | * The 302 (Found) status code indicates that the target resource resides 348 | * temporarily under a different URI. Since the redirection might be altered 349 | * on occasion, the client ought to continue to use the effective request 350 | * URI for future requests. 351 | * 352 | * The server should generate a Location header field in the response 353 | * containing a URI reference for the different URI. The user agent may use 354 | * the Location field value for automatic redirection. The server's response 355 | * payload usually contains a short hypertext note with a hyperlink to the 356 | * different URI(s). 357 | * 358 | * Note: For historical reasons, a user agent may change the request method 359 | * from POST to GET for the subsequent request. If this behavior is 360 | * undesired, the 307 (Temporary Redirect) status code can be used instead. 361 | * 362 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3 363 | * 364 | * @var int 365 | */ 366 | public const FOUND = 302; 367 | 368 | /** 369 | * The 303 (See Other) status code indicates that the server is redirecting 370 | * the user agent to a different resource, as indicated by a URI in the 371 | * Location header field, which is intended to provide an indirect response 372 | * to the original request. A user agent can perform a retrieval request 373 | * targeting that URI (a GET or HEAD request if using HTTP), which might 374 | * also be redirected, and present the eventual result as an answer to the 375 | * original request. Note that the new URI in the Location header field is 376 | * not considered equivalent to the effective request URI. 377 | * 378 | * This status code is applicable to any HTTP method. It is primarily used 379 | * to allow the output of a POST action to redirect the user agent to a 380 | * selected resource, since doing so provides the information corresponding 381 | * to the POST response in a form that can be separately identified, 382 | * bookmarked, and cached, independent of the original request. 383 | * 384 | * A 303 response to a GET request indicates that the origin server does not 385 | * have a representation of the target resource that can be transferred by 386 | * the server over HTTP. However, the Location field value refers to a 387 | * resource that is descriptive of the target resource, such that making a 388 | * retrieval request on that other resource might result in a representation 389 | * that is useful to recipients without implying that it represents the 390 | * original target resource. Note that answers to the questions of what can 391 | * be represented, what representations are adequate, and what might be a 392 | * useful description are outside the scope of HTTP. 393 | * 394 | * Except for responses to a HEAD request, the representation of a 303 395 | * response ought to contain a short hypertext note with a hyperlink to the 396 | * same URI reference provided in the Location header field. 397 | * 398 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.4 399 | * 400 | * @var int 401 | */ 402 | public const SEE_OTHER = 303; 403 | 404 | /** 405 | * The 305 (Use Proxy) status code was defined in a previous version of this 406 | * specification and is now deprecated 407 | * 408 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.5 409 | * 410 | * @var int 411 | * @deprecated 412 | */ 413 | public const USE_PROXY = 305; 414 | 415 | /** 416 | * The 306 (Unused) status code was defined in a previous version of this 417 | * specification, is no longer used, and the code is reserved. 418 | * 419 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.6 420 | * 421 | * @var int 422 | * @deprecated 423 | */ 424 | public const UNUSED = 306; 425 | 426 | /** 427 | * The 307 (Temporary Redirect) status code indicates that the target 428 | * resource resides temporarily under a different URI and the user agent 429 | * must not change the request method if it performs an automatic 430 | * redirection to that URI. Since the redirection can change over time, the 431 | * client ought to continue using the original effective request URI for 432 | * future requests. 433 | * 434 | * The server should generate a Location header field in the response 435 | * containing a URI reference for the different URI. The user agent may use 436 | * the Location field value for automatic redirection. The server's response 437 | * payload usually contains a short hypertext note with a hyperlink to the 438 | * different URI(s). 439 | * 440 | * Note: This status code is similar to 302 (Found), except that it does not 441 | * allow changing the request method from POST to GET. This specification 442 | * defines no equivalent counterpart for 301 (Moved Permanently) ([RFC7238], 443 | * however, defines the status code 308 (Permanent Redirect) for this 444 | * purpose). 445 | * 446 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.7 447 | * 448 | * @var int 449 | */ 450 | public const TEMPORARY_REDIRECT = 307; 451 | 452 | /** 453 | * The 400 (Bad Request) status code indicates that the server cannot or 454 | * will not process the request due to something that is perceived to be a 455 | * client error (e.g., malformed request syntax, invalid request message 456 | * framing, or deceptive request routing). 457 | * 458 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1 459 | * 460 | * @var int 461 | */ 462 | public const BAD_REQUEST = 400; 463 | 464 | /** 465 | * The 402 (Payment Required) status code is reserved for future use. 466 | * 467 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.2 468 | * 469 | * @var int 470 | */ 471 | public const PAYMENT_REQUIRED = 402; 472 | 473 | /** 474 | * The 403 (Forbidden) status code indicates that the server understood the 475 | * request but refuses to authorize it. A server that wishes to make public 476 | * why the request has been forbidden can describe that reason in the 477 | * response payload (if any). 478 | * 479 | * If authentication credentials were provided in the request, the server 480 | * considers them insufficient to grant access. The client should not 481 | * automatically repeat the request with the same credentials. The client 482 | * may repeat the request with new or different credentials. However, a 483 | * request might be forbidden for reasons unrelated to the credentials.¶ 484 | * 485 | * An origin server that wishes to "hide" the current existence of a 486 | * forbidden target resource may instead respond with a status code of 404 487 | * (Not Found). 488 | * 489 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.3 490 | * 491 | * @var int 492 | */ 493 | public const FORBIDDEN = 403; 494 | 495 | /** 496 | * The 404 (Not Found) status code indicates that the origin server did not 497 | * find a current representation for the target resource or is not willing 498 | * to disclose that one exists. A 404 status code does not indicate whether 499 | * this lack of representation is temporary or permanent; the 410 (Gone) 500 | * status code is preferred over 404 if the origin server knows, presumably 501 | * through some configurable means, that the condition is likely to be 502 | * permanent. 503 | * 504 | * A 404 response is cacheable by default; i.e., unless otherwise indicated 505 | * by the method definition or explicit cache controls (see Section 4.2.2 of 506 | * [RFC7234]). 507 | * 508 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4 509 | * 510 | * @var int 511 | */ 512 | public const NOT_FOUND = 404; 513 | 514 | /** 515 | * The 405 (Method Not Allowed) status code indicates that the method 516 | * received in the request-line is known by the origin server but not 517 | * supported by the target resource. The origin server must generate an 518 | * Allow header field in a 405 response containing a list of the target 519 | * resource's currently supported methods. 520 | * 521 | * A 405 response is cacheable by default; i.e., unless otherwise indicated 522 | * by the method definition or explicit cache controls (see Section 4.2.2 of 523 | * [RFC7234]). 524 | * 525 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.5 526 | * 527 | * @var int 528 | */ 529 | public const METHOD_NOT_ALLOWED = 405; 530 | 531 | /** 532 | * The 406 (Not Acceptable) status code indicates that the target resource 533 | * does not have a current representation that would be acceptable to the 534 | * user agent, according to the proactive negotiation header fields 535 | * received in the request (Section 5.3), and the server is unwilling to 536 | * supply a default representation.¶ 537 | * 538 | * The server should generate a payload containing a list of available 539 | * representation characteristics and corresponding resource identifiers 540 | * from which the user or user agent can choose the one most appropriate. A 541 | * user agent may automatically select the most appropriate choice from 542 | * that list. However, this specification does not define any standard for 543 | * such automatic selection, as described in Section 6.4.1. 544 | * 545 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.6 546 | * 547 | * @var int 548 | */ 549 | public const NOT_ACCEPTABLE = 406; 550 | 551 | /** 552 | * The 408 (Request Timeout) status code indicates that the server did not 553 | * receive a complete request message within the time that it was prepared 554 | * to wait. A server should send the "close" connection option (Section 555 | * 6.1 of [RFC7230]) in the response, since 408 implies that the server 556 | * has decided to close the connection rather than continue waiting. If 557 | * the client has an outstanding request in transit, the client may repeat 558 | * that request on a new connection. 559 | * 560 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.7 561 | * 562 | * @var int 563 | */ 564 | public const REQUEST_TIMEOUT = 408; 565 | 566 | /** 567 | * The 409 (Conflict) status code indicates that the request could not be 568 | * completed due to a conflict with the current state of the target 569 | * resource. This code is used in situations where the user might be able to 570 | * resolve the conflict and resubmit the request. The server should generate 571 | * a payload that includes enough information for a user to recognize the 572 | * source of the conflict.¶ 573 | * 574 | * Conflicts are most likely to occur in response to a PUT request. For 575 | * example, if versioning were being used and the representation being PUT 576 | * included changes to a resource that conflict with those made by an 577 | * earlier (third-party) request, the origin server might use a 409 response 578 | * to indicate that it can't complete the request. In this case, the 579 | * response representation would likely contain information useful for 580 | * merging the differences based on the revision history. 581 | * 582 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.8 583 | * 584 | * @var int 585 | */ 586 | public const CONFLICT = 409; 587 | 588 | /** 589 | * The 410 (Gone) status code indicates that access to the target resource 590 | * is no longer available at the origin server and that this condition is 591 | * likely to be permanent. If the origin server does not know, or has no 592 | * facility to determine, whether or not the condition is permanent, the 593 | * status code 404 (Not Found) ought to be used instead. 594 | * 595 | * The 410 response is primarily intended to assist the task of web 596 | * maintenance by notifying the recipient that the resource is intentionally 597 | * unavailable and that the server owners desire that remote links to that 598 | * resource be removed. Such an event is common for limited-time, 599 | * promotional services and for resources belonging to individuals no longer 600 | * associated with the origin server's site. It is not necessary to mark all 601 | * permanently unavailable resources as "gone" or to keep the mark for any 602 | * length of time — that is left to the discretion of the server owner. 603 | * 604 | * A 410 response is cacheable by default; i.e., unless otherwise indicated 605 | * by the method definition or explicit cache controls (see Section 4.2.2 of 606 | * [RFC7234]). 607 | * 608 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.9 609 | * 610 | * @var int 611 | */ 612 | public const GONE = 410; 613 | 614 | /** 615 | * The 411 (Length Required) status code indicates that the server refuses 616 | * to accept the request without a defined Content-Length (Section 3.3.2 of 617 | * [RFC7230]). The client may repeat the request if it adds a valid 618 | * Content-Length header field containing the length of the message body in 619 | * the request message. 620 | * 621 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.10 622 | * 623 | * @var int 624 | */ 625 | public const LENGTH_REQUIRED = 411; 626 | 627 | /** 628 | * The 413 (Payload Too Large) status code indicates that the server is 629 | * refusing to process a request because the request payload is larger than 630 | * the server is willing or able to process. The server may close the 631 | * connection to prevent the client from continuing the request.¶ 632 | * 633 | * If the condition is temporary, the server should generate a Retry-After 634 | * header field to indicate that it is temporary and after what time the 635 | * client may try again. 636 | * 637 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.11 638 | * 639 | * @var int 640 | */ 641 | public const PAYLOAD_TOO_LARGE = 413; 642 | 643 | /** 644 | * The 414 (URI Too Long) status code indicates that the server is 645 | * refusing to service the request because the request-target (Section 5.3 646 | * of [RFC7230]) is longer than the server is willing to interpret. This 647 | * rare condition is only likely to occur when a client has improperly 648 | * converted a POST request to a GET request with long query information, 649 | * when the client has descended into a "black hole" of redirection (e.g., 650 | * a redirected URI prefix that points to a suffix of itself) or when the 651 | * server is under attack by a client attempting to exploit potential 652 | * security holes.¶ 653 | * 654 | * A 414 response is cacheable by default; i.e., unless otherwise indicated 655 | * by the method definition or explicit cache controls (see Section 4.2.2 656 | * of [RFC7234]). 657 | * 658 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.12 659 | * 660 | * @var int 661 | */ 662 | public const URI_TOO_LONG = 414; 663 | 664 | /** 665 | * The 415 (Unsupported Media Type) status code indicates that the origin 666 | * server is refusing to service the request because the payload is in a 667 | * format not supported by this method on the target resource. The format 668 | * problem might be due to the request's indicated Content-Type or 669 | * Content-Encoding, or as a result of inspecting the data directly. 670 | * 671 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.13 672 | * 673 | * @var int 674 | */ 675 | public const UNSUPPORTED_MEDIA_TYPE = 415; 676 | 677 | /** 678 | * The 417 (Expectation Failed) status code indicates that the expectation 679 | * given in the request's Expect header field (Section 5.1.1) could not be 680 | * met by at least one of the inbound servers. 681 | * 682 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.14 683 | * 684 | * @var int 685 | */ 686 | public const EXPECTATION_FAILED = 417; 687 | 688 | /** 689 | * The 426 (Upgrade Required) status code indicates that the server refuses 690 | * to perform the request using the current protocol but might be willing to 691 | * do so after the client upgrades to a different protocol. The server must 692 | * send an Upgrade header field in a 426 response to indicate the required 693 | * protocol(s) (Section 6.7 of [RFC7230]).¶ 694 | * 695 | * Example: 696 | * 697 | * HTTP/1.1 426 Upgrade Required 698 | * Upgrade: HTTP/3.0 699 | * Connection: Upgrade 700 | * Content-Length: 53 701 | * Content-Type: text/plain 702 | * 703 | * This service requires use of the HTTP/3.0 protocol. 704 | * 705 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.15 706 | * 707 | * @var int 708 | */ 709 | public const UPGRADE_REQUIRED = 426; 710 | 711 | /** 712 | * The 500 (Internal Server Error) status code indicates that the server 713 | * encountered an unexpected condition that prevented it from fulfilling the 714 | * request. 715 | * 716 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.1 717 | * 718 | * @var int 719 | */ 720 | public const INTERNAL_SERVER_ERROR = 500; 721 | 722 | /** 723 | * The 501 (Not Implemented) status code indicates that the server does not 724 | * support the functionality required to fulfill the request. This is the 725 | * appropriate response when the server does not recognize the request 726 | * method and is not capable of supporting it for any resource. 727 | * 728 | * A 501 response is cacheable by default; i.e., unless otherwise indicated 729 | * by the method definition or explicit cache controls (see Section 4.2.2 of 730 | * [RFC7234]). 731 | * 732 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.2 733 | * 734 | * @var int 735 | */ 736 | public const NOT_IMPLEMENTED = 501; 737 | 738 | /** 739 | * The 502 (Bad Gateway) status code indicates that the server, while acting 740 | * as a gateway or proxy, received an invalid response from an inbound 741 | * server it accessed while attempting to fulfill the request. 742 | * 743 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.3 744 | * 745 | * @var int 746 | */ 747 | public const BAD_GATEWAY = 502; 748 | 749 | /** 750 | * The 503 (Service Unavailable) status code indicates that the server is 751 | * currently unable to handle the request due to a temporary overload or 752 | * scheduled maintenance, which will likely be alleviated after some delay. 753 | * The server may send a Retry-After header field (Section 7.1.3) to suggest 754 | * an appropriate amount of time for the client to wait before retrying the 755 | * request.¶ 756 | * 757 | * Note: The existence of the 503 status code does not imply that a server 758 | * has to use it when becoming overloaded. Some servers might simply refuse 759 | * the connection. 760 | * 761 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.4 762 | * 763 | * @var int 764 | */ 765 | public const SERVICE_UNAVAILABLE = 503; 766 | 767 | /** 768 | * The 504 (Gateway Timeout) status code indicates that the server, while 769 | * acting as a gateway or proxy, did not receive a timely response from an 770 | * upstream server it needed to access in order to complete the request. 771 | * 772 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.5 773 | * 774 | * @var int 775 | */ 776 | public const GATEWAY_TIMEOUT = 504; 777 | 778 | /** 779 | * The 505 (HTTP Version Not Supported) status code indicates that the 780 | * server does not support, or refuses to support, the major version of HTTP 781 | * that was used in the request message. The server is indicating that it is 782 | * unable or unwilling to complete the request using the same major version 783 | * as the client, as described in Section 2.6 of [RFC7230], other than with 784 | * this error message. The server should generate a representation for the 785 | * 505 response that describes why that version is not supported and what 786 | * other protocols are supported by that server. 787 | * 788 | * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.6 789 | * 790 | * @var int 791 | */ 792 | public const HTTP_VERSION_NOT_SUPPORTED = 505; 793 | } 794 | -------------------------------------------------------------------------------- /src/RFC/RFC7232.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7232. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7232 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The 304 (Not Modified) status code indicates that a conditional GET or 53 | * HEAD request has been received and would have resulted in a 200 (OK) 54 | * response if it were not for the fact that the condition evaluated to 55 | * false. In other words, there is no need for the server to transfer a 56 | * representation of the target resource because the request indicates that 57 | * the client, which made the request conditional, already has a valid 58 | * representation; the server is therefore redirecting the client to make 59 | * use of that stored representation as if it were the payload of a 200 (OK) 60 | * response. 61 | * 62 | * The server generating a 304 response must generate any of the following 63 | * header fields that would have been sent in a 200 (OK) response to the 64 | * same request: Cache-Control, Content-Location, Date, ETag, Expires, and 65 | * Vary. 66 | * 67 | * Since the goal of a 304 response is to minimize information transfer when 68 | * the recipient already has one or more cached representations, a sender 69 | * should not generate representation metadata other than the above listed 70 | * fields unless said metadata exists for the purpose of guiding cache 71 | * updates (e.g., Last-Modified might be useful if the response does not 72 | * have an ETag field). 73 | * 74 | * Requirements on a cache that receives a 304 response are defined in 75 | * Section 4.3.4 of [RFC7234]. If the conditional request originated with an 76 | * outbound client, such as a user agent with its own cache sending a 77 | * conditional GET to a shared proxy, then the proxy should forward the 304 78 | * response to that client. 79 | * 80 | * A 304 response cannot contain a message-body; it is always terminated by 81 | * the first empty line after the header fields. 82 | * 83 | * @see https://datatracker.ietf.org/doc/html/rfc7232#section-4.1 84 | * 85 | * @var int 86 | */ 87 | public const NOT_MODIFIED = 304; 88 | 89 | /** 90 | * The 412 (Precondition Failed) status code indicates that one or more 91 | * conditions given in the request header fields evaluated to false when 92 | * tested on the server. This response code allows the client to place 93 | * preconditions on the current resource state (its current representations 94 | * and metadata) and, thus, prevent the request method from being applied if 95 | * the target resource is in an unexpected state. 96 | * 97 | * @see https://datatracker.ietf.org/doc/html/rfc7232#section-4.2 98 | * 99 | * @var int 100 | */ 101 | public const PRECONDITION_FAILED = 412; 102 | } 103 | -------------------------------------------------------------------------------- /src/RFC/RFC7233.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7233. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7233 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The 206 (Partial Content) status code indicates that the server is 53 | * successfully fulfilling a range request for the target resource by 54 | * transferring one or more parts of the selected representation that 55 | * correspond to the satisfiable ranges found in the request's Range header 56 | * field (Section 3.1). 57 | * 58 | * If a single part is being transferred, the server generating the 206 59 | * response must generate a Content-Range header field, describing what 60 | * range of the selected representation is enclosed, and a payload 61 | * consisting of the range. For example: 62 | * 63 | * HTTP/1.1 206 Partial Content 64 | * Date: Wed, 15 Nov 1995 06:25:24 GMT 65 | * Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT 66 | * Content-Range: bytes 21010-47021/47022 67 | * Content-Length: 26012 68 | * Content-Type: image/gif 69 | * 70 | * ... 26012 bytes of partial image data ... 71 | * If multiple parts are being transferred, the server generating the 206 72 | * response must generate a "multipart/byteranges" payload, as defined in 73 | * Appendix A, and a Content-Type header field containing the 74 | * multipart/byteranges media type and its required boundary parameter. To 75 | * avoid confusion with single-part responses, a server must not generate a 76 | * Content-Range header field in the HTTP header section of a multiple part 77 | * response (this field will be sent in each part instead). 78 | * Within the header area of each body part in the multipart payload, the 79 | * server must generate a Content-Range header field corresponding to the 80 | * range being enclosed in that body part. If the selected representation 81 | * would have had a Content-Type header field in a 200 (OK) response, the 82 | * server should generate that same Content-Type field in the header area of 83 | * each body part. For example: 84 | * 85 | * HTTP/1.1 206 Partial Content 86 | * Date: Wed, 15 Nov 1995 06:25:24 GMT 87 | * Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT 88 | * Content-Length: 1741 89 | * Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES 90 | * 91 | * --THIS_STRING_SEPARATES 92 | * Content-Type: application/pdf 93 | * Content-Range: bytes 500-999/8000 94 | * 95 | * ...the first range... 96 | * --THIS_STRING_SEPARATES 97 | * Content-Type: application/pdf 98 | * Content-Range: bytes 7000-7999/8000 99 | * 100 | * ...the second range 101 | * --THIS_STRING_SEPARATES-- 102 | * When multiple ranges are requested, a server may coalesce any of the 103 | * ranges that overlap, or that are separated by a gap that is smaller than 104 | * the overhead of sending multiple parts, regardless of the order in which 105 | * the corresponding byte-range-spec appeared in the received Range header 106 | * field. Since the typical overhead between parts of a multipart/byteranges 107 | * payload is around 80 bytes, depending on the selected representation's 108 | * media type and the chosen boundary parameter length, it can be less 109 | * efficient to transfer many small disjoint parts than it is to transfer 110 | * the entire selected representation.¶ 111 | * 112 | * A server must not generate a multipart response to a request for a single 113 | * range, since a client that does not request multiple parts might not 114 | * support multipart responses. However, a server may generate a 115 | * multipart/byteranges payload with only a single body part if multiple 116 | * ranges were requested and only one range was found to be satisfiable or 117 | * only one range remained after coalescing. A client that cannot process a 118 | * multipart/byteranges response must not generate a request that asks for 119 | * multiple ranges. 120 | * 121 | * When a multipart response payload is generated, the server should send 122 | * the parts in the same order that the corresponding byte-range-spec 123 | * appeared in the received Range header field, excluding those ranges that 124 | * were deemed unsatisfiable or that were coalesced into other ranges. A 125 | * client that receives a multipart response must inspect the Content-Range 126 | * header field present in each body part in order to determine which range 127 | * is contained in that body part; a client cannot rely on receiving the 128 | * same ranges that it requested, nor the same order that it requested. 129 | * 130 | * When a 206 response is generated, the server must generate the following 131 | * header fields, in addition to those required above, if the field would 132 | * have been sent in a 200 (OK) response to the same request: Date, 133 | * Cache-Control, ETag, Expires, Content-Location, and Vary. 134 | * 135 | * If a 206 is generated in response to a request with an If-Range header 136 | * field, the sender should not generate other representation header fields 137 | * beyond those required above, because the client is understood to already 138 | * have a prior response containing those header fields. Otherwise, the 139 | * sender must generate all of the representation header fields that would 140 | * have been sent in a 200 (OK) response to the same request. 141 | * 142 | * A 206 response is cacheable by default; i.e., unless otherwise indicated 143 | * by explicit cache controls (see Section 4.2.2 of [RFC7234]). 144 | * 145 | * @see https://datatracker.ietf.org/doc/html/rfc7233#section-4.1 146 | * 147 | * @var int 148 | */ 149 | public const PARTIAL_CONTENT = 206; 150 | 151 | /** 152 | * The 416 (Range Not Satisfiable) status code indicates that none of the 153 | * ranges in the request's Range header field (Section 3.1) overlap the 154 | * current extent of the selected resource or that the set of ranges 155 | * requested has been rejected due to invalid ranges or an excessive request 156 | * of small or overlapping ranges. 157 | * 158 | * For byte ranges, failing to overlap the current extent means that the 159 | * first-byte-pos of all of the byte-range-spec values were greater than the 160 | * current length of the selected representation. When this status code is 161 | * generated in response to a byte-range request, the sender should generate 162 | * a Content-Range header field specifying the current length of the selected 163 | * representation (Section 4.2). 164 | * 165 | * Note: Because servers are free to ignore Range, many implementations will 166 | * simply respond with the entire selected representation in a 200 (OK) 167 | * response. That is partly because most clients are prepared to receive a 168 | * 200 (OK) to complete the task (albeit less efficiently) and partly because 169 | * clients might not stop making an invalid partial request until they have 170 | * received a complete representation. Thus, clients cannot depend on 171 | * receiving a 416 (Range Not Satisfiable) response even when it is most 172 | * appropriate. 173 | * 174 | * @see https://datatracker.ietf.org/doc/html/rfc7233#section-4.4 175 | * 176 | * @var int 177 | */ 178 | public const RANGE_NOT_SATISFIABLE = 416; 179 | } 180 | -------------------------------------------------------------------------------- /src/RFC/RFC7234.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7234. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7234 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * A cache SHOULD generate this whenever the sent response is stale. 53 | * 54 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.1 55 | * @var int 56 | */ 57 | public const RESPONSE_IS_STALE = 110; 58 | 59 | /** 60 | * A cache SHOULD generate this when sending a stale response because an 61 | * attempt to validate the response failed, due to an inability to reach 62 | * the server. 63 | * 64 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.2 65 | * @var int 66 | */ 67 | public const REVALIDATION_FAILED = 111; 68 | 69 | /** 70 | * A cache SHOULD generate this if it is intentionally disconnected from 71 | * the rest of the network for a period of time. 72 | * 73 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.3 74 | * @var int 75 | */ 76 | public const DISCONNECTED_OPERATION = 112; 77 | 78 | /** 79 | * A cache SHOULD generate this if it heuristically chose a freshness 80 | * lifetime greater than 24 hours and the response's age is greater than 81 | * 24 hours. 82 | * 83 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.4 84 | * @var int 85 | */ 86 | public const HEURISTIC_EXPIRATION = 113; 87 | 88 | /** 89 | * The warning text can include arbitrary information to be presented to 90 | * a human user or logged. A system receiving this warning MUST NOT 91 | * take any automated action, besides presenting the warning to the 92 | * user. 93 | * 94 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.5 95 | * @var int 96 | */ 97 | public const MISCELLANEOUS_WARNING = 199; 98 | 99 | /** 100 | * This Warning code MUST be added by a proxy if it applies any 101 | * transformation to the representation, such as changing the 102 | * content-coding, media-type, or modifying the representation data, 103 | * unless this Warning code already appears in the response. 104 | * 105 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.6 106 | * @var int 107 | */ 108 | public const TRANSFORMATION_APPLIED = 214; 109 | 110 | /** 111 | * The warning text can include arbitrary information to be presented to 112 | * a human user or logged. A system receiving this warning MUST NOT 113 | * take any automated action. 114 | * 115 | * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.5.7 116 | * @var int 117 | */ 118 | public const MISCELLANEOUS_PERSISTENT_WARNING = 299; 119 | } 120 | -------------------------------------------------------------------------------- /src/RFC/RFC7235.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7235. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7235 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The 401 (Unauthorized) status code indicates that the request has not 53 | * been applied because it lacks valid authentication credentials for the 54 | * target resource. The server generating a 401 response must send a 55 | * WWW-Authenticate header field (Section 4.1) containing at least one 56 | * challenge applicable to the target resource. 57 | * 58 | * If the request included authentication credentials, then the 401 response 59 | * indicates that authorization has been refused for those credentials. The 60 | * user agent may repeat the request with a new or replaced Authorization 61 | * header field (Section 4.2). If the 401 response contains the same 62 | * challenge as the prior response, and the user agent has already attempted 63 | * authentication at least once, then the user agent should present the 64 | * enclosed representation to the user, since it usually contains relevant 65 | * diagnostic information. 66 | * 67 | * @see https://datatracker.ietf.org/doc/html/rfc7235#section-3.1 68 | * 69 | * @var int 70 | */ 71 | public const UNAUTHORIZED = 401; 72 | 73 | /** 74 | * The 407 (Proxy Authentication Required) status code is similar to 401 75 | * (Unauthorized), but it indicates that the client needs to authenticate 76 | * itself in order to use a proxy. The proxy must send a Proxy-Authenticate 77 | * header field (Section 4.3) containing a challenge applicable to that 78 | * proxy for the target resource. The client may repeat the request with a 79 | * new or replaced Proxy-Authorization header field (Section 4.4). 80 | * 81 | * @see https://datatracker.ietf.org/doc/html/rfc7235#section-3.2 82 | * 83 | * @var int 84 | */ 85 | public const PROXY_AUTHENTICATION_REQUIRED = 407; 86 | } 87 | -------------------------------------------------------------------------------- /src/RFC/RFC7538.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for RFC7538. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * @category StatusCode 40 | * 41 | * @package Teapot\StatusCode\RFC 42 | * 43 | * @author Barney Hanlon 44 | * @copyright 2013-2016 B Hanlon. All rights reserved. 45 | * @license MIT http://opensource.org/licenses/MIT 46 | * 47 | * @see https://github.com/teapot-php/status-code 48 | */ 49 | interface RFC7538 extends IETFStream, ProposedStandard 50 | { 51 | /** 52 | * The 308 (Permanent Redirect) status code indicates that the target 53 | * resource has been assigned a new permanent URI and any future references 54 | * to this resource ought to use one of the enclosed URIs. Clients with link 55 | * editing capabilities ought to automatically re-link references to the 56 | * effective request URI (Section 5.5 of [RFC7230]) to one or more of the 57 | * new references sent by the server, where possible. 58 | * 59 | * The server should generate a Location header field ([RFC7231], Section 60 | * 7.1.2) in the response containing a preferred URI reference for the new 61 | * permanent URI. The user agent may use the Location field value for 62 | * automatic redirection. The server's response payload usually contains a 63 | * short hypertext note with a hyperlink to the new URI(s). 64 | * 65 | * A 308 response is cacheable by default; i.e., unless otherwise indicated 66 | * by the method definition or explicit cache controls (see [RFC7234], 67 | * Section 4.2.2). 68 | * 69 | * Note: This status code is similar to 301 (Moved Permanently) ([RFC7231], 70 | * Section 6.4.2), except that it does not allow changing the request method 71 | * from POST to GET. 72 | * 73 | * @see https://datatracker.ietf.org/doc/html/rfc7538#section-3 74 | * 75 | * @var int 76 | */ 77 | public const PERMANENT_REDIRECT = 308; 78 | } 79 | -------------------------------------------------------------------------------- /src/RFC/RFC7540.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\RFC; 26 | 27 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 28 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 29 | 30 | /** 31 | * Interface representing extended HTTP status codes for HTTP2. These codes 32 | * are represented as an interface so that developers may implement it and then 33 | * use parent::[CODE] to gain a code, or to extend the codes using 34 | * static::[CODE] and override their default description. 35 | * 36 | * This allows for codes to be repurposed in a natural way where the core, 37 | * traditional use would not be meaningful. 38 | * 39 | * PHP version 5.3 40 | * 41 | * @category StatusCode 42 | * 43 | * @package Teapot\StatusCode\RFC 44 | * 45 | * @author Barney Hanlon 46 | * @copyright 2013-2016 B Hanlon. All rights reserved. 47 | * @license MIT http://opensource.org/licenses/MIT 48 | * 49 | * @see https://github.com/teapot-php/status-code 50 | */ 51 | interface RFC7540 extends IETFStream, ProposedStandard 52 | { 53 | /** 54 | * The 421 (Misdirected Request) status code indicates that the request was 55 | * directed at a server that is not able to produce a response. This can be 56 | * sent by a server that is not configured to produce responses for the 57 | * combination of scheme and authority that are included in the request URI. 58 | * 59 | * Clients receiving a 421 (Misdirected Request) response from a server MAY 60 | * retry the request — whether the request method is idempotent or not — 61 | * over a different connection. This is possible if a connection is reused 62 | * (Section 9.1.1) or if an alternative service is selected [ALT-SVC]. 63 | * 64 | * This status code MUST NOT be generated by proxies. 65 | * 66 | * A 421 response is cacheable by default, i.e., unless otherwise indicated 67 | * by the method definition or explicit cache controls (see Section 4.2.2 of 68 | * [RFC7234]). 69 | * 70 | * @see https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2 71 | * 72 | * @var int 73 | */ 74 | public const MISDIRECTED_REQUEST = 421; 75 | } 76 | -------------------------------------------------------------------------------- /src/RFC/RFC7725.php: -------------------------------------------------------------------------------- 1 | 19 | * @author Navarr Barnier 20 | * @copyright 2013-2016 B Hanlon. All rights reserved. 21 | * @license MIT http://opensource.org/licenses/MIT 22 | * 23 | * @see https://github.com/teapot-php/status-code 24 | */ 25 | 26 | namespace Teapot\StatusCode\RFC; 27 | 28 | use Teapot\StatusCode\RFC\Status\ProposedStandard; 29 | use Teapot\StatusCode\RFC\Stream\IETF as IETFStream; 30 | 31 | /** 32 | * Interface representing extended HTTP status codes for RFC7725. These codes 33 | * are represented as an interface so that developers may implement it and then 34 | * use parent::[CODE] to gain a code, or to extend the codes using 35 | * static::[CODE] and override their default description. 36 | * 37 | * This allows for codes to be repurposed in a natural way where the core, 38 | * traditional use would not be meaningful. 39 | * 40 | * @category StatusCode 41 | * 42 | * @package Teapot\StatusCode\RFC 43 | * 44 | * @author Barney Hanlon 45 | * @author Navarr Barnier 46 | * @copyright 2013-2016 B Hanlon. All rights reserved. 47 | * @license MIT http://opensource.org/licenses/MIT 48 | * 49 | * @see https://github.com/teapot-php/status-code 50 | */ 51 | interface RFC7725 extends IETFStream, ProposedStandard 52 | { 53 | /** 54 | * This status code indicates that the server is subject to legal 55 | * restrictions which prevent it servicing the request. 56 | * 57 | * Since such restrictions typically apply to all operators in a legal 58 | * jurisdiction, the server in question may or may not be an origin 59 | * server. The restrictions typically most directly affect the 60 | * operations of ISPs and search engines. 61 | * 62 | * Responses using this status code SHOULD include an explanation, in 63 | * the response body, of the details of the legal restriction; which 64 | * legal authority is imposing it, and what class of resources it 65 | * applies to. 66 | * 67 | * @see https://datatracker.ietf.org/doc/html/rfc7725#section-3 68 | * 69 | * @var int 70 | */ 71 | public const UNAVAILABLE_FOR_LEGAL_REASONS = 451; 72 | } 73 | -------------------------------------------------------------------------------- /src/RFC/Status/DraftStandard.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Status; 20 | 21 | /** 22 | * Interface representing the RFC status of a given RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Status 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface DraftStandard 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Status/Experimental.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Status; 20 | 21 | /** 22 | * Interface representing the RFC status of a given RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Status 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface Experimental 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Status/Expired.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Status; 20 | 21 | /** 22 | * Interface representing the RFC status of a given RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Status 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface Expired 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Status/Informational.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Status; 20 | 21 | /** 22 | * Interface representing the RFC status of a given RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Status 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface Informational 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Status/ProposedStandard.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Status; 20 | 21 | /** 22 | * Interface representing the RFC status of a given RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Status 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface ProposedStandard 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Stream/IETF.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Stream; 20 | 21 | /** 22 | * Interface representing the stream responsible for the RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Stream 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface IETF 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Stream/Independent.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Stream; 20 | 21 | /** 22 | * Interface representing the stream responsible for the RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Stream 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface Independent 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/RFC/Stream/Legacy.php: -------------------------------------------------------------------------------- 1 | 13 | * @copyright 2013-2016 B Hanlon. All rights reserved. 14 | * @license MIT http://opensource.org/licenses/MIT 15 | * 16 | * @see https://github.com/teapot-php/status-code 17 | */ 18 | 19 | namespace Teapot\StatusCode\RFC\Stream; 20 | 21 | /** 22 | * Interface representing the stream responsible for the RFC. 23 | * 24 | * PHP version 5.3 25 | * 26 | * @category StatusCode 27 | * 28 | * @package Teapot\StatusCode\RFC\Stream 29 | * 30 | * @author Barney Hanlon 31 | * @copyright 2013-2016 B Hanlon. All rights reserved. 32 | * @license MIT http://opensource.org/licenses/MIT 33 | * 34 | * @see https://github.com/teapot-php/status-code 35 | */ 36 | interface Legacy 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /src/Vendor.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode; 26 | 27 | use Teapot\StatusCode\Vendor\Apache; 28 | use Teapot\StatusCode\Vendor\CloudFlare; 29 | use Teapot\StatusCode\Vendor\Microsoft; 30 | use Teapot\StatusCode\Vendor\Nginx; 31 | use Teapot\StatusCode\Vendor\Twitter; 32 | 33 | /** 34 | * Interface representing vendor-specific HTTP status codes. These codes are 35 | * represented as an interface so that developers may implement it and then 36 | * use parent::[CODE] to gain a code, or to extend the codes using 37 | * static::[CODE] and override their default description. 38 | * 39 | * This allows for codes to be repurposed in a natural way where the core, 40 | * traditional use would not be meaningful. 41 | * 42 | * PHP version 5.3 43 | * 44 | * @category StatusCode 45 | * 46 | * @package Teapot\StatusCode 47 | * 48 | * @author Barney Hanlon 49 | * @copyright 2013-2016 B Hanlon. All rights reserved. 50 | * @license MIT http://opensource.org/licenses/MIT 51 | * 52 | * @see https://github.com/teapot-php/status-code 53 | */ 54 | interface Vendor extends Apache, CloudFlare, Microsoft, Nginx, Twitter 55 | { 56 | } 57 | -------------------------------------------------------------------------------- /src/Vendor/Apache.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\Vendor; 26 | 27 | /** 28 | * Interface representing extended HTTP status codes for Apache. These codes are 29 | * represented as an interface so that developers may implement it and then use 30 | * parent::[CODE] to gain a code, or to extend the codes using static::[CODE] 31 | * and override their default description. 32 | * 33 | * This allows for codes to be repurposed in a natural way where the core, 34 | * traditional use would not be meaningful. 35 | * 36 | * @category StatusCode 37 | * 38 | * @package Teapot\StatusCode\Vendor 39 | * 40 | * @author Barney Hanlon 41 | * @copyright 2013-2016 B Hanlon. All rights reserved. 42 | * @license MIT http://opensource.org/licenses/MIT 43 | * 44 | * @see https://github.com/teapot-php/status-code 45 | */ 46 | interface Apache 47 | { 48 | /** 49 | * This status code, while used by many servers, is not specified in any 50 | * RFCs. 51 | * Apache-specific. 52 | * 53 | * @var int 54 | */ 55 | public const BANDWIDTH_LIMIT_EXCEEDED = 509; 56 | } 57 | -------------------------------------------------------------------------------- /src/Vendor/CloudFlare.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\Vendor; 26 | 27 | /** 28 | * Interface representing extended HTTP status codes for Cloudflare. These codes 29 | * are represented as an interface so that developers may implement it and then 30 | * use parent::[CODE] to gain a code, or to extend the codes using 31 | * static::[CODE] and override their default description. 32 | * 33 | * This allows for codes to be repurposed in a natural way where the core, 34 | * traditional use would not be meaningful. 35 | * 36 | * @category StatusCode 37 | * 38 | * @package Teapot\StatusCode\Vendor 39 | * 40 | * @author Barney Hanlon 41 | * @copyright 2013-2016 B Hanlon. All rights reserved. 42 | * @license MIT http://opensource.org/licenses/MIT 43 | * 44 | * @see https://github.com/teapot-php/status-code 45 | */ 46 | interface CloudFlare 47 | { 48 | /** 49 | * This status code is not specified in any RFCs, but is used by 50 | * Cloudflare's reverse proxies to signal an "unknown connection issue 51 | * between CloudFlare and the origin web server" to a client in front of 52 | * the proxy. 53 | * 54 | * One potential cause could be that your web server is sending a response 55 | * header that exceeds CloudFlare's maximum response header size. This could 56 | * be the case if you're sending an abnormally high number of cookies for 57 | * example. 58 | * 59 | * @see https://support.cloudflare.com/hc/en-us/articles/115003011431-Error-520#520error 60 | * 61 | * @var int 62 | */ 63 | public const ORIGIN_ERROR = 520; 64 | 65 | /** 66 | * An Error 521 means that the origin web server refused the connection from 67 | * CloudFlare. 68 | * 69 | * There are two main reasons why this would occur. In both cases, work with 70 | * your hosting provider to help resolve the issue. 71 | * 72 | * 1) The origin web server is not turned on 73 | * 2) Something on the web server or hosting provider's network is blocking 74 | * CloudFlare's requests. Since CloudFlare acts as a reverse proxy, all 75 | * connections to your server come from a CloudFlare IP. Since the same 76 | * amount of traffic now comes from a smaller number of IPs, server-side 77 | * security solutions can mistake the increase in connections from this 78 | * smaller set of IPs as an attack, when they are legitimate. 79 | * 80 | * @see https://support.cloudflare.com/hc/en-us/articles/115003011431-Error-520#521error 81 | * 82 | * @var int 83 | */ 84 | public const ORIGIN_DECLINED_REQUEST = 521; 85 | 86 | /** 87 | * An Error 522 means that the connection started on the origin web server, 88 | * but that the request was not completed. The most common reason why this 89 | * would occur is that either a program, cron job or resource is taking up 90 | * more resources than it should causing the server not to be able to 91 | * respond to all requests properly. The origin web server is not 92 | * functioning consistently for each request. Contact your hosting provider 93 | * to identify and resolve the issue. 94 | * 95 | * The difference between a 522 and 524 error is that with a 522 error, the 96 | * connection times out before the request is completed. This means that 97 | * the server is overloaded. 98 | * 99 | * With a 524 error, the connection is made but then the request times out. 100 | * The likely cause is that a background task is timing out. The most common 101 | * cause would be the database or a slow application. 102 | * 103 | * @see https://support.cloudflare.com/hc/en-us/articles/115003011431-Error-520#522error 104 | * 105 | * @var int 106 | */ 107 | public const CONNECTION_TIMED_OUT = 522; 108 | 109 | /** 110 | * This status code is not specified in any RFCs, but is used by 111 | * Cloudflare's reverse proxies to signal a resource that has been blocked 112 | * by the administrator of the website or proxy itself. 113 | * 114 | * The most common cause is that the DNS setting has changed. Sometimes, 115 | * hosting providers update the origin IP information for their customers. 116 | * If this is the case, you need to make sure the new origin IP address for 117 | * your A record is reflected in your CloudFlare DNS Settings page. 118 | * 119 | * As soon as you make the change in your CloudFlare DNS Settings page, wait 120 | * up to 5 minutes for it to take effect. 121 | * 122 | * @see https://support.cloudflare.com/hc/en-us/articles/115003011431-Error-520#523error 123 | * 124 | * @var int 125 | */ 126 | public const PROXY_DECLINED_REQUEST = 523; 127 | 128 | /** 129 | * This status code is not specified in any RFCs, but is used by 130 | * Cloudflare's reverse proxies to signal a network read timeout behind the 131 | * proxy to a client in front of the proxy. 132 | * 133 | * An Error 524 means that the connection to the origin web server was made, 134 | * but the origin web server timed out before responding to the request. The 135 | * likely cause is either an overloaded background task, database or 136 | * application (i.e. such as Wordpress), over stressing the resources on 137 | * your machine. The database is often the cause. 138 | * 139 | * The difference between a 522 and 524 error is that with a 522 error, the 140 | * connection times out before the request is completed. This means that the 141 | * server is overloaded. With a 524 error, the connection is made but then 142 | * the request times out. 143 | * 144 | * @see https://support.cloudflare.com/hc/en-us/articles/115003011431-Error-520#524error 145 | * 146 | * @var int 147 | */ 148 | public const TIMEOUT_OCCURRED = 524; 149 | } 150 | -------------------------------------------------------------------------------- /src/Vendor/Microsoft.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\Vendor; 26 | 27 | /** 28 | * Interface representing extended HTTP status codes for Microsoft. These codes 29 | * are represented as an interface so that developers may implement it and then 30 | * use parent::[CODE] to gain a code, or to extend the codes using 31 | * static::[CODE] and override their default description. 32 | * 33 | * This allows for codes to be repurposed in a natural way where the core, 34 | * traditional use would not be meaningful. 35 | * 36 | * @category StatusCode 37 | * 38 | * @package Teapot\StatusCode\Vendor 39 | * 40 | * @author Barney Hanlon 41 | * @copyright 2013-2016 B Hanlon. All rights reserved. 42 | * @license MIT http://opensource.org/licenses/MIT 43 | * 44 | * @see https://github.com/teapot-php/status-code 45 | */ 46 | interface Microsoft 47 | { 48 | /** 49 | * A Microsoft extension. Indicates that your session has expired. 50 | * 51 | * @var int 52 | */ 53 | public const LOGIN_TIMEOUT = 440; 54 | 55 | /** 56 | * A Microsoft extension. The request should be retried after performing 57 | * the appropriate action. The new extension status code is defined as 58 | * follows (using the Augmented Backus-Naur Form (ABNF) syntax, as specified 59 | * in RFC2616 section 2.1). 60 | * 61 | * Often search-engines or custom applications will ignore required 62 | * parameters. Where no default action is appropriate, the Aviongoo website 63 | * sends a "HTTP/1.1 449 Retry with valid parameters: param1, param2, . . ." 64 | * response. The applications may choose to learn, or not. 65 | * 66 | * @see https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wdv/83ecf19f-e0f8-4706-aae5-ba618f52f100 67 | * 68 | * @var int 69 | */ 70 | public const RETRY_WITH = 449; 71 | 72 | /** 73 | * A Microsoft extension. This error is given when Windows Parental Controls 74 | * are turned on and are blocking access to the given webpage. 75 | * 76 | * @var int 77 | */ 78 | public const BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = 450; 79 | 80 | /** 81 | * Used in Exchange ActiveSync if there either is a more efficient server 82 | * to use or the server can't access the users' mailbox. 83 | * 84 | * The client is supposed to re-run the HTTP Autodiscovery protocol to find 85 | * a better suited server. 86 | * 87 | * @var int 88 | */ 89 | public const REDIRECT = 451; 90 | } 91 | -------------------------------------------------------------------------------- /src/Vendor/Nginx.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\Vendor; 26 | 27 | /** 28 | * Interface representing extended HTTP status codes for Nginx. These codes are 29 | * represented as an interface so that developers may implement it and then use 30 | * parent::[CODE] to gain a code, or to extend the codes using static::[CODE] 31 | * and override their default description. 32 | * 33 | * This allows for codes to be repurposed in a natural way where the core, 34 | * traditional use would not be meaningful. 35 | * 36 | * @category StatusCode 37 | * 38 | * @package Teapot\StatusCode\Vendor 39 | * 40 | * @author Barney Hanlon 41 | * @copyright 2013-2016 B Hanlon. All rights reserved. 42 | * @license MIT http://opensource.org/licenses/MIT 43 | * 44 | * @see https://github.com/teapot-php/status-code 45 | */ 46 | interface Nginx 47 | { 48 | /** 49 | * Used in Nginx logs to indicate that the server has returned no 50 | * information to the client and closed the connection (useful as 51 | * a deterrent for malware). 52 | * 53 | * @var int 54 | */ 55 | public const NO_RESPONSE = 444; 56 | 57 | /** 58 | * Nginx internal code similar to 431 but it was introduced earlier. 59 | * 60 | * @var int 61 | */ 62 | public const REQUEST_HEADER_TOO_LARGE = 494; 63 | 64 | /** 65 | * Nginx internal code used when SSL client certificate error occurred to 66 | * distinguish it from 4XX in a log and an error page redirection. 67 | * 68 | * @var int 69 | */ 70 | public const CERT_ERROR = 495; 71 | 72 | /** 73 | * Nginx internal code used when client didn't provide certificate to 74 | * distinguish it from 4XX in a log and an error page redirection. 75 | * 76 | * @var int 77 | */ 78 | public const NO_CERT = 496; 79 | 80 | /** 81 | * Nginx internal code used for the plain HTTP requests that are sent to 82 | * HTTPS port to distinguish it from 4XX in a log and an error page 83 | * redirection. 84 | * 85 | * @var int 86 | */ 87 | public const HTTP_TO_HTTPS = 497; 88 | 89 | /** 90 | * Used in Nginx logs to indicate when the connection has been closed by 91 | * client while the server is still processing its request, making server 92 | * unable to send a status code back. 93 | * 94 | * @var int 95 | */ 96 | public const CLIENT_CLOSED_REQUEST = 499; 97 | } 98 | -------------------------------------------------------------------------------- /src/Vendor/RFC7238.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\Vendor; 26 | 27 | use Teapot\StatusCode\RFC\RFC2295; 28 | use Teapot\StatusCode\RFC\RFC2324; 29 | use Teapot\StatusCode\RFC\RFC2518; 30 | use Teapot\StatusCode\RFC\RFC2774; 31 | use Teapot\StatusCode\RFC\RFC2817; 32 | use Teapot\StatusCode\RFC\RFC3229; 33 | use Teapot\StatusCode\RFC\RFC3648; 34 | use Teapot\StatusCode\RFC\RFC4918; 35 | use Teapot\StatusCode\RFC\RFC5842; 36 | use Teapot\StatusCode\RFC\RFC6585; 37 | use Teapot\StatusCode\RFC\RFC7231; 38 | use Teapot\StatusCode\RFC\RFC7232; 39 | use Teapot\StatusCode\RFC\RFC7233; 40 | use Teapot\StatusCode\RFC\RFC7235; 41 | use Teapot\StatusCode\RFC\RFC7538; 42 | use Teapot\StatusCode\RFC\RFC7540; 43 | use Teapot\StatusCode\RFC\RFC7725; 44 | 45 | /** 46 | * Interface representing extended HTTP status codes used by the Symfony 47 | * framework. These codes are represented as an interface so that developers 48 | * may implement it and then use parent::[CODE] to gain a code, or to extend 49 | * the codes using static::[CODE] and override their default description. 50 | * 51 | * This allows for codes to be repurposed in a natural way where the core, 52 | * traditional use would not be meaningful. 53 | * 54 | * @category StatusCode 55 | * 56 | * @package Teapot\StatusCode\Vendor 57 | * 58 | * @author Barney Hanlon 59 | * @copyright 2013-2016 B Hanlon. All rights reserved. 60 | * @license MIT http://opensource.org/licenses/MIT 61 | * 62 | * @see https://github.com/teapot-php/status-code 63 | */ 64 | interface Symfony 65 | { 66 | public const HTTP_CONTINUE = RFC7231::CONTINUING; 67 | public const HTTP_SWITCHING_PROTOCOLS = RFC7231::SWITCHING_PROTOCOLS; 68 | public const HTTP_PROCESSING = RFC2518::PROCESSING; 69 | public const HTTP_OK = RFC7231::OK; 70 | public const HTTP_CREATED = RFC7231::CREATED; 71 | public const HTTP_ACCEPTED = RFC7231::ACCEPTED; 72 | public const HTTP_NON_AUTHORITATIVE_INFORMATION = RFC7231::NON_AUTHORITATIVE_INFORMATION; 73 | public const HTTP_NO_CONTENT = RFC7231::NO_CONTENT; 74 | public const HTTP_RESET_CONTENT = RFC7231::RESET_CONTENT; 75 | public const HTTP_PARTIAL_CONTENT = RFC7233::PARTIAL_CONTENT; 76 | public const HTTP_MULTI_STATUS = RFC4918::MULTI_STATUS; 77 | public const HTTP_ALREADY_REPORTED = RFC5842::ALREADY_REPORTED; 78 | public const HTTP_IM_USED = RFC3229::IM_USED; 79 | public const HTTP_MULTIPLE_CHOICES = RFC7231::MULTIPLE_CHOICES; 80 | public const HTTP_MOVED_PERMANENTLY = RFC7231::MOVED_PERMANENTLY; 81 | public const HTTP_FOUND = RFC7231::FOUND; 82 | public const HTTP_SEE_OTHER = RFC7231::SEE_OTHER; 83 | public const HTTP_NOT_MODIFIED = RFC7232::NOT_MODIFIED; 84 | public const HTTP_USE_PROXY = RFC7231::USE_PROXY; 85 | public const HTTP_RESERVED = RFC7231::UNUSED; 86 | public const HTTP_TEMPORARY_REDIRECT = RFC7231::TEMPORARY_REDIRECT; 87 | public const HTTP_PERMANENTLY_REDIRECT = RFC7538::PERMANENT_REDIRECT; 88 | public const HTTP_BAD_REQUEST = RFC7231::BAD_REQUEST; 89 | public const HTTP_UNAUTHORIZED = RFC7235::UNAUTHORIZED; 90 | public const HTTP_PAYMENT_REQUIRED = RFC7231::PAYMENT_REQUIRED; 91 | public const HTTP_FORBIDDEN = RFC7231::FORBIDDEN; 92 | public const HTTP_NOT_FOUND = RFC7231::NOT_FOUND; 93 | public const HTTP_METHOD_NOT_ALLOWED = RFC7231::METHOD_NOT_ALLOWED; 94 | public const HTTP_NOT_ACCEPTABLE = RFC7231::NOT_ACCEPTABLE; 95 | public const HTTP_PROXY_AUTHENTICATION_REQUIRED = RFC7235::PROXY_AUTHENTICATION_REQUIRED; 96 | public const HTTP_REQUEST_TIMEOUT = RFC7231::REQUEST_TIMEOUT; 97 | public const HTTP_CONFLICT = RFC7231::CONFLICT; 98 | public const HTTP_GONE = RFC7231::GONE; 99 | public const HTTP_LENGTH_REQUIRED = RFC7231::LENGTH_REQUIRED; 100 | public const HTTP_PRECONDITION_FAILED = RFC7232::PRECONDITION_FAILED; 101 | public const HTTP_REQUEST_ENTITY_TOO_LARGE = RFC7231::PAYLOAD_TOO_LARGE; 102 | public const HTTP_REQUEST_URI_TOO_LONG = RFC7231::URI_TOO_LONG; 103 | public const HTTP_UNSUPPORTED_MEDIA_TYPE = RFC7231::UNSUPPORTED_MEDIA_TYPE; 104 | public const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = RFC7233::RANGE_NOT_SATISFIABLE; 105 | public const HTTP_EXPECTATION_FAILED = RFC7231::EXPECTATION_FAILED; 106 | public const HTTP_I_AM_A_TEAPOT = RFC2324::I_AM_A_TEAPOT; 107 | public const HTTP_MISDIRECTED_REQUEST = RFC7540::MISDIRECTED_REQUEST; 108 | public const HTTP_UNPROCESSABLE_ENTITY = RFC4918::UNPROCESSABLE_ENTITY; 109 | public const HTTP_LOCKED = RFC4918::ENTITY_LOCKED; 110 | public const HTTP_FAILED_DEPENDENCY = RFC4918::FAILED_DEPENDENCY; 111 | public const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = RFC3648::UNORDERED_COLLECTION; 112 | public const HTTP_UPGRADE_REQUIRED = RFC2817::UPGRADE_REQUIRED; 113 | public const HTTP_PRECONDITION_REQUIRED = RFC6585::PRECONDITION_REQUIRED; 114 | public const HTTP_TOO_MANY_REQUESTS = RFC6585::TOO_MANY_REQUESTS; 115 | public const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = RFC6585::REQUEST_HEADER_FIELDS_TOO_LARGE; 116 | public const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = RFC7725::UNAVAILABLE_FOR_LEGAL_REASONS; 117 | public const HTTP_INTERNAL_SERVER_ERROR = RFC7231::INTERNAL_SERVER_ERROR; 118 | public const HTTP_NOT_IMPLEMENTED = RFC7231::NOT_IMPLEMENTED; 119 | public const HTTP_BAD_GATEWAY = RFC7231::BAD_GATEWAY; 120 | public const HTTP_SERVICE_UNAVAILABLE = RFC7231::SERVICE_UNAVAILABLE; 121 | public const HTTP_GATEWAY_TIMEOUT = RFC7231::GATEWAY_TIMEOUT; 122 | public const HTTP_VERSION_NOT_SUPPORTED = RFC7231::HTTP_VERSION_NOT_SUPPORTED; 123 | public const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = RFC2295::VARIANT_ALSO_NEGOTIATES; 124 | public const HTTP_INSUFFICIENT_STORAGE = RFC4918::INSUFFICIENT_STORAGE; 125 | public const HTTP_LOOP_DETECTED = RFC5842::LOOP_DETECTED; 126 | public const HTTP_NOT_EXTENDED = RFC2774::NOT_EXTENDED; 127 | public const HTTP_NETWORK_AUTHENTICATION_REQUIRED = RFC6585::NETWORK_AUTHENTICATION_REQUIRED; 128 | } 129 | -------------------------------------------------------------------------------- /src/Vendor/Twitter.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode\Vendor; 26 | 27 | /** 28 | * Interface representing extended HTTP status codes for vendor-specific codes. 29 | * These codes are represented as an interface so that developers may implement 30 | * it and then use parent::[CODE] to gain a code, or to extend the codes using 31 | * static::[CODE] and override their default description. 32 | * 33 | * This allows for codes to be repurposed in a natural way where the core, 34 | * traditional use would not be meaningful. 35 | * 36 | * @category StatusCode 37 | * 38 | * @package Teapot\StatusCode\Vendor 39 | * 40 | * @author Barney Hanlon 41 | * @copyright 2013-2016 B Hanlon. All rights reserved. 42 | * @license MIT http://opensource.org/licenses/MIT 43 | * 44 | * @see https://github.com/teapot-php/status-code 45 | */ 46 | interface Twitter 47 | { 48 | /** 49 | * Returned by the version 1 Search and Trends APIs when you are being rate 50 | * limited. 51 | * 52 | * @see https://dev.twitter.com/docs/rate-limiting/1 53 | * 54 | * @var int 55 | */ 56 | public const ENHANCE_YOUR_CALM = 420; 57 | } 58 | -------------------------------------------------------------------------------- /src/WebDAV.php: -------------------------------------------------------------------------------- 1 | 19 | * @copyright 2013-2016 B Hanlon. All rights reserved. 20 | * @license MIT http://opensource.org/licenses/MIT 21 | * 22 | * @see https://github.com/teapot-php/status-code 23 | */ 24 | 25 | namespace Teapot\StatusCode; 26 | 27 | use Teapot\StatusCode\RFC\RFC2518; 28 | use Teapot\StatusCode\RFC\RFC3648; 29 | use Teapot\StatusCode\RFC\RFC4918; 30 | use Teapot\StatusCode\RFC\RFC5842; 31 | 32 | /** 33 | * Interface representing extended HTTP status codes for WebDAV. These codes are 34 | * represented as an interface so that developers may implement it and then use 35 | * parent::[CODE] to gain a code, or to extend the codes using static::[CODE] 36 | * and override their default description. 37 | * 38 | * This allows for codes to be repurposed in a natural way where the core, 39 | * traditional use would not be meaningful. 40 | * 41 | * @category StatusCode 42 | * 43 | * @package Teapot\StatusCode 44 | * 45 | * @author Barney Hanlon 46 | * @copyright 2013-2016 B Hanlon. All rights reserved. 47 | * @license MIT http://opensource.org/licenses/MIT 48 | * 49 | * @see https://github.com/teapot-php/status-code 50 | */ 51 | interface WebDAV extends RFC2518, RFC3648, RFC4918, RFC5842 52 | { 53 | } 54 | --------------------------------------------------------------------------------