| Total Complexity | 2 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait ClientHandler |
||
| 8 | { |
||
| 9 | public function clientException(ClientException $exception) |
||
| 10 | { |
||
| 11 | $requestHost = $exception->getRequest()->getUri()->getHost(); |
||
| 12 | |||
| 13 | $detail = __('exception::exceptions.client.unavailable'); |
||
| 14 | $code = $this->getCode('client.default'); |
||
| 15 | if ($this->clientExceptionCausers()->isPagarme($requestHost)) { |
||
| 16 | $pagarMeCode = config($this->configFile.'codes.client.pagarme') ?? $code; |
||
| 17 | |||
| 18 | $detail = $detail.' #'.$pagarMeCode; |
||
| 19 | $code = $pagarMeCode; |
||
| 20 | } |
||
| 21 | |||
| 22 | $error = [[ |
||
| 23 | 'status' => 500, |
||
| 24 | 'code' => $code, |
||
| 25 | 'source' => ['pointer' => $exception->getFile().':'.$exception->getLine()], |
||
| 26 | 'title' => 'client_exception', |
||
| 27 | 'detail' => $detail, |
||
| 28 | ]]; |
||
| 29 | |||
| 30 | $this->jsonApiResponse->setStatus(500); |
||
| 31 | $this->jsonApiResponse->setErrors($error); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function clientExceptionCausers() |
||
| 35 | { |
||
| 36 | return new class() { |
||
| 37 | const PAGARME_HOST = 'api.pagar.me'; |
||
| 38 | |||
| 39 | public function isPagarme($host) |
||
| 42 | } |
||
| 43 | }; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
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