1 | <?php |
||
15 | final class Guzzle implements AdapterInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var GuzzleClientInterface |
||
19 | */ |
||
20 | private $guzzleClient; |
||
21 | |||
22 | /** |
||
23 | * @var AuthenticationInterface |
||
24 | */ |
||
25 | private $authentication; |
||
26 | |||
27 | /** |
||
28 | * @var MapperInterface |
||
29 | */ |
||
30 | private $endpointMapper; |
||
31 | |||
32 | 22 | public function __construct( |
|
41 | |||
42 | 19 | public function getEndpoint(string $endpoint, QueryInterface $searchQuery): ResponseInterface |
|
43 | { |
||
44 | 19 | return $this->get( |
|
45 | 19 | $this->endpointMapper->map($endpoint), |
|
46 | 19 | ['query' => $searchQuery->get()] |
|
47 | ); |
||
48 | } |
||
49 | |||
50 | 2 | public function getUrl(string $url): ResponseInterface |
|
54 | |||
55 | 17 | public function getJson(ResponseInterface $response): string |
|
59 | |||
60 | 21 | private function get(string $url, ?array $options = []) |
|
73 | } |
||
74 |