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