| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public static function facebookRespondedWithAnError(ClientException $exception): self |
||
| 21 | { |
||
| 22 | if ($exception->hasResponse()) { |
||
| 23 | $result = json_decode($exception->getResponse()->getBody(), false); |
||
| 24 | |||
| 25 | return new static("Facebook responded with an error `{$result->error->code} - {$result->error->type} {$result->error->message}`"); |
||
| 26 | } |
||
| 27 | |||
| 28 | return new static('Facebook responded with an error'); |
||
| 29 | } |
||
| 30 | |||
| 55 |