These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * |
||
4 | */ |
||
5 | |||
6 | namespace Mvc5\Http\Status; |
||
7 | |||
8 | trait ReasonPhrase |
||
9 | { |
||
10 | /** |
||
11 | * @var array |
||
12 | */ |
||
13 | static $statusReasonPhrase = [ |
||
14 | 100 => 'Continue', |
||
15 | 101 => 'Switching Protocols', |
||
16 | 102 => 'Processing', |
||
17 | 200 => 'OK', |
||
18 | 201 => 'Created', |
||
19 | 202 => 'Accepted', |
||
20 | 203 => 'Non-Authoritative Information', |
||
21 | 204 => 'No Content', |
||
22 | 205 => 'Reset Content', |
||
23 | 206 => 'Partial Content', |
||
24 | 207 => 'Multi-Status', |
||
25 | 208 => 'Already Reported', |
||
26 | 226 => 'IM Used', |
||
27 | 300 => 'Multiple Choices', |
||
28 | 301 => 'Moved Permanently', |
||
29 | 302 => 'Found', |
||
30 | 303 => 'See Other', |
||
31 | 304 => 'Not Modified', |
||
32 | 305 => 'Use Proxy', |
||
33 | 307 => 'Temporary Redirect', |
||
34 | 308 => 'Permanent Redirect', |
||
35 | 400 => 'Bad Request', |
||
36 | 401 => 'Unauthorized', |
||
37 | 402 => 'Payment Required', |
||
38 | 403 => 'Forbidden', |
||
39 | 404 => 'Not Found', |
||
40 | 405 => 'Method Not Allowed', |
||
41 | 406 => 'Not Acceptable', |
||
42 | 407 => 'Proxy Authentication Required', |
||
43 | 408 => 'Request Timeout', |
||
44 | 409 => 'Conflict', |
||
45 | 410 => 'Gone', |
||
46 | 411 => 'Length Required', |
||
47 | 412 => 'Precondition Failed', |
||
48 | 413 => 'Payload Too Large', |
||
49 | 414 => 'URI Too Long', |
||
50 | 415 => 'Unsupported Media Type', |
||
51 | 416 => 'Range Not Satisfiable', |
||
52 | 417 => 'Expectation Failed', |
||
53 | 421 => 'Misdirected Request', |
||
54 | 422 => 'Unprocessable Entity', |
||
55 | 423 => 'Locked', |
||
56 | 424 => 'Failed Dependency', |
||
57 | 425 => 'Unassigned', |
||
58 | 426 => 'Upgrade Required', |
||
59 | 427 => 'Unassigned', |
||
60 | 428 => 'Precondition Required', |
||
61 | 429 => 'Too Many Requests', |
||
62 | 430 => 'Unassigned', |
||
63 | 431 => 'Request Header Fields Too Large', |
||
64 | 451 => 'Unavailable For Legal Reasons', |
||
65 | 500 => 'Internal Server Error', |
||
66 | 501 => 'Not Implemented', |
||
67 | 502 => 'Bad Gateway', |
||
68 | 503 => 'Service Unavailable', |
||
69 | 504 => 'Gateway Timeout', |
||
70 | 505 => 'HTTP Version Not Supported', |
||
71 | 506 => 'Variant Also Negotiates', |
||
72 | 507 => 'Insufficient Storage', |
||
73 | 508 => 'Loop Detected', |
||
74 | 509 => 'Unassigned', |
||
75 | 510 => 'Not Extended', |
||
76 | 511 => 'Network Authentication Required' |
||
77 | ]; |
||
78 | |||
79 | /** |
||
80 | * @param $status |
||
81 | * @return string |
||
82 | */ |
||
83 | 4 | protected static function statusReasonPhrase($status) |
|
84 | { |
||
85 | 4 | return static::$statusReasonPhrase[$status]; |
|
0 ignored issues
–
show
|
|||
86 | } |
||
87 | } |
||
88 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: