1 | <?php |
||
23 | final class RequestService implements RequestServiceInterface |
||
24 | { |
||
25 | const RETURN_KEY = 'data'; |
||
26 | /** @var SettingsInterface */ |
||
27 | private $settings; |
||
28 | /** @var Client */ |
||
29 | private $httpClient; |
||
30 | |||
31 | /** |
||
32 | * RequestService constructor. |
||
33 | * |
||
34 | * @param SettingsInterface $settings |
||
35 | * @param Client $client |
||
36 | * @throws InvalidArgumentException |
||
37 | */ |
||
38 | public function __construct(SettingsInterface $settings, Client $client) |
||
44 | |||
45 | /** |
||
46 | * Sends the request to the server |
||
47 | * @param string $reqMethod |
||
48 | * @param string $reqRoute |
||
49 | * @param RequestOptionsInterface $requestOptions |
||
50 | * |
||
51 | * @return array |
||
52 | * @throws ApiException |
||
53 | * @throws EmptyResponseException |
||
54 | */ |
||
55 | public function dispatchRequest($reqMethod, $reqRoute, RequestOptionsInterface $requestOptions) :array |
||
84 | |||
85 | /** |
||
86 | * @param Response $response |
||
87 | * |
||
88 | * @return array |
||
89 | * @throws EmptyResponseException |
||
90 | */ |
||
91 | private function convertResponse(Response $response) :array |
||
111 | |||
112 | /** |
||
113 | * @param array $result |
||
114 | * |
||
115 | * @return array |
||
116 | * @throws EmptyResponseException |
||
117 | */ |
||
118 | private function checkResponseKey(array $result) :array |
||
125 | |||
126 | /** |
||
127 | * @return array |
||
128 | */ |
||
129 | private function getRequestHeaderArray() :array |
||
137 | |||
138 | /** |
||
139 | * @return void |
||
140 | * @throws InvalidArgumentException |
||
141 | */ |
||
142 | private function initHttpClient() :void |
||
150 | } |
||
151 |