Conditions | 1 |
Paths | 1 |
Total Lines | 77 |
Code Lines | 75 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
28 | function status_codes() |
||
29 | { |
||
30 | return [ |
||
31 | 100 => 'Continue', |
||
32 | 101 => 'Switching Protocols', |
||
33 | 102 => 'Processing', |
||
34 | 200 => 'OK', |
||
35 | 201 => 'Created', |
||
36 | 202 => 'Accepted', |
||
37 | 203 => 'Non-Authoritative Information', |
||
38 | 204 => 'No Content', |
||
39 | 205 => 'Reset Content', |
||
40 | 206 => 'Partial Content', |
||
41 | 207 => 'Multi-Status', |
||
42 | 208 => 'Already Reported', |
||
43 | 226 => 'IM Used', |
||
44 | 300 => 'Multiple Choices', |
||
45 | 301 => 'Moved Permanently', |
||
46 | 302 => 'Found', |
||
47 | 303 => 'See Other', |
||
48 | 304 => 'Not Modified', |
||
49 | 305 => 'Use Proxy', |
||
50 | 306 => 'Switch Proxy', |
||
51 | 307 => 'Temporary Redirect', |
||
52 | 308 => 'Permanent Redirect', |
||
53 | 400 => 'Bad Request', |
||
54 | 401 => 'Unauthorized', |
||
55 | 402 => 'Payment Required', |
||
56 | 403 => 'Forbidden', |
||
57 | 404 => 'Not Found', |
||
58 | 405 => 'Method Not Allowed', |
||
59 | 406 => 'Not Acceptable', |
||
60 | 407 => 'Proxy Authentication Required', |
||
61 | 408 => 'Request Timeout', |
||
62 | 409 => 'Conflict', |
||
63 | 410 => 'Gone', |
||
64 | 411 => 'Length Required', |
||
65 | 412 => 'Precondition Failed', |
||
66 | 413 => 'Request Entity Too Large', |
||
67 | 414 => 'Request-URI Too Long', |
||
68 | 415 => 'Unsupported Media Type', |
||
69 | 416 => 'Requested Range Not Satisfiable', |
||
70 | 417 => 'Expectation Failed', |
||
71 | 418 => 'I\'m a teapot', |
||
72 | 419 => 'Authentication Timeout', |
||
73 | 420 => 'Enhance Your Calm', |
||
74 | 422 => 'Unprocessable Entity', |
||
75 | 423 => 'Locked', |
||
76 | 424 => 'Failed Dependency', |
||
77 | 425 => 'Unordered Collection', |
||
78 | 426 => 'Upgrade Required', |
||
79 | 428 => 'Precondition Required', |
||
80 | 429 => 'Too Many Requests', |
||
81 | 431 => 'Request Header Fields Too Large', |
||
82 | 444 => 'No Response', |
||
83 | 449 => 'Retry With', |
||
84 | 450 => 'Blocked by Windows Parental Controls', |
||
85 | 451 => 'Unavailable For Legal Reasons', |
||
86 | 494 => 'Request Header Too Large', |
||
87 | 495 => 'Cert Error', |
||
88 | 496 => 'No Cert', |
||
89 | 497 => 'HTTP to HTTPS', |
||
90 | 499 => 'Client Closed Request', |
||
91 | 500 => 'Internal Server Error', |
||
92 | 501 => 'Not Implemented', |
||
93 | 502 => 'Bad Gateway', |
||
94 | 503 => 'Service Unavailable', |
||
95 | 504 => 'Gateway Timeout', |
||
96 | 505 => 'HTTP Version Not Supported', |
||
97 | 506 => 'Variant Also Negotiates', |
||
98 | 507 => 'Insufficient Storage', |
||
99 | 508 => 'Loop Detected', |
||
100 | 509 => 'Bandwidth Limit Exceeded', |
||
101 | 510 => 'Not Extended', |
||
102 | 511 => 'Network Authentication Required', |
||
103 | 598 => 'Network read timeout error', |
||
104 | 599 => 'Network connect timeout error', |
||
105 | ]; |
||
149 |