1 | <?php |
||
19 | final class HTTPlugConnection extends AbstractConnection |
||
20 | { |
||
21 | /** |
||
22 | * @var HttpClient |
||
23 | */ |
||
24 | private $client; |
||
25 | |||
26 | /** |
||
27 | * @var MessageFactory |
||
28 | */ |
||
29 | private $messageFactory; |
||
30 | |||
31 | /** |
||
32 | * Initialize client. |
||
33 | * |
||
34 | * @param HttpClient $client |
||
35 | * @param MessageFactory $messageFactory |
||
36 | * @param string $apiKey |
||
37 | * @param string $uri |
||
38 | */ |
||
39 | public function __construct(HttpClient $client, MessageFactory $messageFactory, string $apiKey, string $uri = null) |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function call(string $method, array $params = array(), string $requestMethod = 'GET'): array |
||
78 | |||
79 | /** |
||
80 | * @param ResponseInterface $response |
||
81 | * |
||
82 | * @return array |
||
83 | * |
||
84 | * @throws ApiException |
||
85 | * @throws NotFoundException |
||
86 | */ |
||
87 | private function parseResponse(ResponseInterface $response): array |
||
106 | |||
107 | /** |
||
108 | * Builds request parameter. |
||
109 | * |
||
110 | * @param array $parameter |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | private function buildParameter(array $parameter): string |
||
118 | } |
||
119 |