| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 64 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 |
||
| 71 | public function getText(): string |
||
| 72 | { |
||
| 73 | return match ($this->value) { |
||
| 74 | 100 => 'Continue', |
||
| 75 | 101 => 'Switching Protocols', |
||
| 76 | 102 => 'Processing', |
||
| 77 | 103 => 'Early Hints', |
||
| 78 | 200 => 'OK', |
||
| 79 | 201 => 'Created', |
||
| 80 | 202 => 'Accepted', |
||
| 81 | 203 => 'Non-Authoritative Information', |
||
| 82 | 204 => 'No Content', |
||
| 83 | 205 => 'Reset Content', |
||
| 84 | 206 => 'Partial Content', |
||
| 85 | 207 => 'Multi-Status', |
||
| 86 | 208 => 'Already Reported', |
||
| 87 | 226 => 'IM Used', |
||
| 88 | 300 => 'Multiple Choices', |
||
| 89 | 301 => 'Moved Permanently', |
||
| 90 | 302 => 'Found', |
||
| 91 | 303 => 'See Other', |
||
| 92 | 304 => 'Not Modified', |
||
| 93 | 305 => 'Use Proxy', |
||
| 94 | 306 => 'Reserved', |
||
| 95 | 307 => 'Temporary Redirect', |
||
| 96 | 308 => 'Permanent Redirect', |
||
| 97 | 400 => 'Bad Request', |
||
| 98 | 401 => 'Unauthorized', |
||
| 99 | 402 => 'Payment Required', |
||
| 100 | 403 => 'Forbidden', |
||
| 101 | 404 => 'Not Found', |
||
| 102 | 405 => 'Method Not Allowed', |
||
| 103 | 406 => 'Not Acceptable', |
||
| 104 | 407 => 'Proxy Authentication Required', |
||
| 105 | 408 => 'Request Timeout', |
||
| 106 | 409 => 'Conflict', |
||
| 107 | 410 => 'Gone', |
||
| 108 | 411 => 'Length Required', |
||
| 109 | 412 => 'Precondition Failed', |
||
| 110 | 413 => 'Content Too Large', |
||
| 111 | 414 => 'URI Too Long', |
||
| 112 | 415 => 'Unsupported Media Type', |
||
| 113 | 416 => 'Range Not Satisfiable', |
||
| 114 | 417 => 'Expectation Failed', |
||
| 115 | 418 => 'I\'m a teapot', |
||
| 116 | 421 => 'Misdirected Request', |
||
| 117 | 422 => 'Unprocessable Content', |
||
| 118 | 423 => 'Locked', |
||
| 119 | 424 => 'Failed Dependency', |
||
| 120 | 425 => 'Too Early', |
||
| 121 | 426 => 'Upgrade Required', |
||
| 122 | 428 => 'Precondition Required', |
||
| 123 | 429 => 'Too Many Requests', |
||
| 124 | 431 => 'Request Header Fields Too Large', |
||
| 125 | 451 => 'Unavailable For Legal Reasons', |
||
| 126 | 500 => 'Internal Server Error', |
||
| 127 | 501 => 'Not Implemented', |
||
| 128 | 502 => 'Bad Gateway', |
||
| 129 | 503 => 'Service Unavailable', |
||
| 130 | 504 => 'Gateway Timeout', |
||
| 131 | 505 => 'HTTP Version Not Supported', |
||
| 132 | 506 => 'Variant Also Negotiates', |
||
| 133 | 507 => 'Insufficient Storage', |
||
| 134 | 508 => 'Loop Detected', |
||
| 135 | 510 => 'Not Extended', |
||
| 136 | 511 => 'Network Authentication Required', |
||
| 137 | }; |
||
| 140 |