| Conditions | 12 |
| Paths | 12 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 24 |
| CRAP Score | 12 |
| 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 |
||
| 54 | 11 | private function pushResponseToBuffer(string $request): void |
|
| 55 | { |
||
| 56 | 11 | $command = \explode(' ', \strtoupper(\trim($request))); |
|
| 57 | 11 | switch ($command[0]) { |
|
| 58 | 11 | case 'AUTH': |
|
| 59 | 10 | case 'HELO': |
|
| 60 | 9 | case 'EHLO': |
|
| 61 | 8 | case 'MAIL': |
|
| 62 | 7 | case 'RCPT': |
|
| 63 | 6 | case 'RSET': |
|
| 64 | 5 | case 'NOOP': |
|
| 65 | 4 | case '.': |
|
| 66 | 7 | $this->receive = '250 Ok'; |
|
| 67 | 7 | break; |
|
| 68 | 4 | case 'DATA': |
|
| 69 | 1 | $this->receive = '354 End data with <CR><LF>.<CR><LF>'; |
|
| 70 | 1 | break; |
|
| 71 | 3 | case 'QUIT': |
|
| 72 | 1 | $this->receive = '221 Bye'; |
|
| 73 | 1 | break; |
|
| 74 | 2 | case 'VRFY': |
|
| 75 | 1 | $this->receive = '252 null@null'; |
|
| 76 | 1 | break; |
|
| 77 | default: |
||
| 78 | 1 | $this->receive = ''; |
|
| 79 | } |
||
| 80 | 11 | } |
|
| 81 | } |
||
| 82 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.