| Total Complexity | 8 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class ApiResponseDataFactory |
||
| 12 | { |
||
| 13 | public function createFromResponse(DataResponse $response): ApiResponseData |
||
| 14 | { |
||
| 15 | if ($response->getStatusCode() !== Status::OK) { |
||
| 16 | return $this |
||
| 17 | ->createErrorResponse() |
||
| 18 | ->setErrorCode($response->getStatusCode()) |
||
| 19 | ->setErrorMessage($this->getErrorMessage($response)); |
||
| 20 | } |
||
| 21 | |||
| 22 | return $this |
||
| 23 | ->createSuccessResponse() |
||
| 24 | ->setData($response->getData()); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function createSuccessResponse(): ApiResponseData |
||
| 28 | { |
||
| 29 | return $this |
||
| 30 | ->createResponse() |
||
| 31 | ->setStatus('success'); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function createErrorResponse(): ApiResponseData |
||
| 39 | } |
||
| 40 | |||
| 41 | public function createResponse(): ApiResponseData |
||
| 42 | { |
||
| 43 | return new ApiResponseData(); |
||
| 44 | } |
||
| 45 | |||
| 46 | private function getErrorMessage(DataResponse $response): string |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
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