| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0932 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 39 | 2 | public static function fromHttpResponse(ResponseInterface $httpResponse): self |
|
| 40 | { |
||
| 41 | 2 | $properties = json_decode( |
|
| 42 | 2 | $httpResponse->getBody()->__toString(), |
|
| 43 | true, |
||
| 44 | JSON_THROW_ON_ERROR |
||
| 45 | ); |
||
| 46 | |||
| 47 | 2 | if (!is_array($properties)) { |
|
| 48 | throw new RuntimeException( |
||
| 49 | sprintf('Unexpected API response. Dump: %s', var_export($httpResponse, true)) |
||
| 50 | ); |
||
| 51 | } |
||
| 52 | |||
| 53 | 2 | return new static($properties); |
|
| 54 | } |
||
| 76 |