Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public function count(ResponseInterface $response): int |
||
33 | { |
||
34 | $content = $response->getBody()->getContents(); |
||
35 | $content = mb_substr($content, 2, mb_strlen($content) - 3); |
||
36 | |||
37 | $json = json_decode($content, true, 512, JSON_THROW_ON_ERROR); |
||
38 | |||
39 | if (!\array_key_exists('count', $json)) { |
||
40 | throw new FetchException('The "count" attributes could not be found', $response->getBody()->getContents()); |
||
41 | } |
||
42 | |||
43 | return (int) $json['count']; |
||
44 | } |
||
45 | } |
||
46 |