@@ -28,4 +28,75 @@ public static function generateCSRFData(Guard $csrf_guard, ServerRequestInterfac
2828 'value ' => $ request ->getAttribute ($ value_key )
2929 ];
3030 }
31+
32+ public static function httpStatuses (): array
33+ {
34+ return [
35+ 100 => 'Continue ' ,
36+ 101 => 'Switching Protocols ' ,
37+ 102 => 'Processing ' ,
38+ 103 => 'Checkpoint ' ,
39+ 200 => 'OK ' ,
40+ 201 => 'Created ' ,
41+ 202 => 'Accepted ' ,
42+ 203 => 'Non-Authoritative Information ' ,
43+ 204 => 'No Content ' ,
44+ 205 => 'Reset Content ' ,
45+ 206 => 'Partial Content ' ,
46+ 207 => 'Multi-Status ' ,
47+ 300 => 'Multiple Choices ' ,
48+ 301 => 'Moved Permanently ' ,
49+ 302 => 'Found ' ,
50+ 303 => 'See Other ' ,
51+ 304 => 'Not Modified ' ,
52+ 305 => 'Use Proxy ' ,
53+ 306 => 'Switch Proxy ' ,
54+ 307 => 'Temporary Redirect ' ,
55+ 400 => 'Bad Request ' ,
56+ 401 => 'Unauthorized ' ,
57+ 402 => 'Payment Required ' ,
58+ 403 => 'Forbidden ' ,
59+ 404 => 'Not Found ' ,
60+ 405 => 'Method Not Allowed ' ,
61+ 406 => 'Not Acceptable ' ,
62+ 407 => 'Proxy Authentication Required ' ,
63+ 408 => 'Request Timeout ' ,
64+ 409 => 'Conflict ' ,
65+ 410 => 'Gone ' ,
66+ 411 => 'Length Required ' ,
67+ 412 => 'Precondition Failed ' ,
68+ 413 => 'Request Entity Too Large ' ,
69+ 414 => 'Request-URI Too Long ' ,
70+ 415 => 'Unsupported Media Type ' ,
71+ 416 => 'Requested Range Not Satisfiable ' ,
72+ 417 => 'Expectation Failed ' ,
73+ 418 => "I'm a teapot " ,
74+ 422 => 'Unprocessable Entity ' ,
75+ 423 => 'Locked ' ,
76+ 424 => 'Failed Dependency ' ,
77+ 425 => 'Unordered Collection ' ,
78+ 426 => 'Upgrade Required ' ,
79+ 449 => 'Retry With ' ,
80+ 450 => 'Blocked by Windows Parental Controls ' ,
81+ 500 => 'Internal Server Error ' ,
82+ 501 => 'Not Implemented ' ,
83+ 502 => 'Bad Gateway ' ,
84+ 503 => 'Service Unavailable ' ,
85+ 504 => 'Gateway Timeout ' ,
86+ 505 => 'HTTP Version Not Supported ' ,
87+ 506 => 'Variant Also Negotiates ' ,
88+ 507 => 'Insufficient Storage ' ,
89+ 509 => 'Bandwidth Limit Exceeded ' ,
90+ 510 => 'Not Extended '
91+ ];
92+ }
93+
94+ /**
95+ * @param int|string $code
96+ * @return string
97+ */
98+ public static function getHttpStatusMessage ($ code ): string
99+ {
100+ return (string ) (self ::httpStatuses ()[$ code ] ?? '' );
101+ }
31102}
0 commit comments