| Conditions | 6 |
| Paths | 2 |
| Total Lines | 62 |
| Code Lines | 42 |
| 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 declare(strict_types=1); |
||
| 61 | $response = Dispatcher::run( |
||
| 62 | [ |
||
| 63 | new Authentication, |
||
| 64 | function ($request, $next) { |
||
| 65 | return new JsonResponse(['foo' => 'bar']); |
||
| 66 | } |
||
| 67 | ], |
||
| 68 | Factory::createServerRequest('GET', '/api/v1/user/index') |
||
| 69 | ->withHeader('Authorization', $auth->getHeader()) |
||
| 70 | ->withHeader('Content-Type', 'application/json') |
||
| 71 | ->withHeader('Accept', 'application/json') |
||
| 72 | ); |
||
| 73 | |||
| 74 | $this->assertSame(401, $response->getStatusCode()); |
||
| 75 | } |
||
| 76 | } |
||
| 77 |