| Total Complexity | 4 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | abstract class Query |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Psr7 compatible client. |
||
| 18 | * |
||
| 19 | * @var \GuzzleHttp\Client |
||
| 20 | */ |
||
| 21 | protected $httpClient; |
||
| 22 | |||
| 23 | public function __construct($httpClient) |
||
| 24 | { |
||
| 25 | $this->httpClient = $httpClient; |
||
| 26 | } |
||
| 27 | |||
| 28 | protected function fetchContentAsArray(string $url): ?array |
||
| 29 | { |
||
| 30 | $res = $this->httpClient->get($url); |
||
| 31 | $content = $res->getBody()->getContents(); |
||
| 32 | |||
| 33 | return JsonHelper::decode($content); |
||
| 34 | } |
||
| 35 | |||
| 36 | protected function throwEmptyContentExceptionIfEmpty($data) |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |