| Conditions | 10 |
| Paths | 10 |
| Total Lines | 31 |
| Code Lines | 25 |
| 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 |
||
| 26 | protected function responding(ServerRequest $request, Response $response, $result) : Response |
||
| 27 | { |
||
| 28 | switch (gettype($result)) { |
||
| 29 | case 'array': |
||
| 30 | if (($cc = $this->codec($request)) === 'json') { |
||
| 31 | return $this->ccJson( |
||
| 32 | $response, |
||
| 33 | json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | throw new RespondingCodecException('Unknown responding codec'); |
||
| 37 | case 'string': |
||
| 38 | return $response->withBody(new Body($result)); |
||
| 39 | case 'object': |
||
| 40 | if ($result instanceof Response) { |
||
| 41 | return $result; |
||
| 42 | } elseif ($result instanceof Message) { |
||
| 43 | return $this->ccJson($response, $result->serializeToJsonString()); |
||
| 44 | } elseif ($result instanceof ArrayObject) { |
||
| 45 | return $this->ccJson( |
||
| 46 | $response, |
||
| 47 | json_encode((array)$result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) |
||
| 48 | ); |
||
| 49 | } elseif (method_exists($result, '__toString')) { |
||
| 50 | return $response->withBody(new Body((string)$result)); |
||
| 51 | } |
||
| 52 | throw new RespondingCodecException('Unacceptable object'); |
||
| 53 | case 'NULL': |
||
| 54 | return $response; |
||
| 55 | default: |
||
| 56 | return $response->withBody(new Body((string)$result)); |
||
| 57 | } |
||
| 82 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths