| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | abstract class AbstractApi |
||
| 10 | { |
||
| 11 | protected $client; |
||
| 12 | |||
| 13 | 24 | public function __construct(Client $client) |
|
| 14 | { |
||
| 15 | 24 | $this->client = $client; |
|
| 16 | 24 | } |
|
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $url |
||
| 20 | * @return mixed |
||
| 21 | * @throws ClientException |
||
| 22 | */ |
||
| 23 | 15 | protected function get(string $url) |
|
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param string $url |
||
| 31 | * @param array $data |
||
| 32 | * @return mixed |
||
| 33 | * @throws ClientException |
||
| 34 | */ |
||
| 35 | 6 | protected function post(string $url, array $data = []) |
|
| 36 | { |
||
| 37 | 6 | $guzzleClient = $this->client->getHttpClient(); |
|
| 38 | 6 | return $this->decodeJson($guzzleClient->post($url, ['json' => $data])->getBody()); |
|
| 39 | } |
||
| 40 | |||
| 41 | 21 | protected function decodeJson(string $json) |
|
| 44 | } |
||
| 45 | } |
||
| 46 |