1 | <?php |
||
50 | 1 | class GuzzleClient implements IClient |
|
51 | { |
||
52 | /** |
||
53 | * Implement nette smart magic |
||
54 | */ |
||
55 | 1 | use Nette\SmartObject; |
|
56 | |||
57 | 1 | use TSendsRequests; |
|
58 | |||
59 | /** |
||
60 | * Additional request headers |
||
61 | * |
||
62 | * @var string[] |
||
63 | */ |
||
64 | private $headers = []; |
||
65 | |||
66 | /** |
||
67 | * @var Client |
||
68 | */ |
||
69 | private $http; |
||
70 | |||
71 | /** |
||
72 | * @param string|NULL $baseUri |
||
73 | * @param Schemas\SchemaProvider $schemaProvider |
||
74 | * @param Client|NULL $client |
||
75 | */ |
||
76 | public function __construct( |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function index(string $endpoint, EncodingParametersInterface $parameters = NULL, array $options = []) : Http\IResponse |
||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function read(string $endpoint, EncodingParametersInterface $parameters = NULL, array $options = []) : Http\IResponse |
||
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | public function create(string $endpoint, $record, EncodingParametersInterface $parameters = NULL, array $options = []) : Http\IResponse |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function update(string $endpoint, $record, array $fields = NULL, EncodingParametersInterface $parameters = NULL, array $options = []) : Http\IResponse |
||
143 | |||
144 | /** |
||
145 | * {@inheritdoc} |
||
146 | */ |
||
147 | public function delete(string $endpoint, array $options = []) : Http\IResponse |
||
155 | |||
156 | /** |
||
157 | * {@inheritdoc} |
||
158 | */ |
||
159 | public function addApiKey(string $key) : void |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | public function addAuthorization(string $token) : void |
||
171 | |||
172 | /** |
||
173 | * {@inheritdoc} |
||
174 | */ |
||
175 | public function removeAuthorization() : void |
||
181 | |||
182 | /** |
||
183 | * {@inheritdoc} |
||
184 | */ |
||
185 | public function addHeader(string $header, string $value) : void |
||
189 | |||
190 | /** |
||
191 | * @param string $endpoint |
||
192 | * @param string $method |
||
193 | * @param array $serializedRecord the encoded record |
||
194 | * @param EncodingParametersInterface|NULL $parameters |
||
195 | * @param array $options |
||
196 | * |
||
197 | * @return Http\IResponse |
||
198 | * |
||
199 | * @throws JsonApiException |
||
200 | * @throws GuzzleHttp\Exception\GuzzleException |
||
201 | * @throws Utils\JsonException |
||
202 | */ |
||
203 | protected function sendRecord(string $endpoint, string $method, array $serializedRecord, EncodingParametersInterface $parameters = NULL, array $options = []) : Http\IResponse |
||
214 | |||
215 | /** |
||
216 | * @param array $new |
||
217 | * @param array $existing |
||
218 | * |
||
219 | * @return array |
||
220 | */ |
||
221 | protected function mergeOptions(array $new, array $existing) : array |
||
225 | |||
226 | /** |
||
227 | * @param string $method |
||
228 | * @param string $uri |
||
229 | * @param array $options |
||
230 | * |
||
231 | * @return Http\IResponse |
||
232 | * |
||
233 | * @throws JsonApiException |
||
234 | * @throws GuzzleHttp\Exception\GuzzleException |
||
235 | * @throws Utils\JsonException |
||
236 | */ |
||
237 | protected function request(string $method, string $uri, array $options = []) : Http\IResponse |
||
250 | |||
251 | /** |
||
252 | * Safely parse an error response. |
||
253 | * |
||
254 | * This method wraps decoding the body content of the provided exception, so that |
||
255 | * another exception is not thrown while trying to parse an existing exception. |
||
256 | * |
||
257 | * @param PsrRequest $request |
||
258 | * @param BadResponseException $ex |
||
259 | * |
||
260 | * @return JsonApiException |
||
261 | */ |
||
262 | private function parseErrorResponse(PsrRequest $request, BadResponseException $ex) : JsonApiException |
||
280 | |||
281 | /** |
||
282 | * @param PsrRequest $request |
||
283 | * @param PsrResponse|NULL $response |
||
284 | * |
||
285 | * @return Objects\IDocument|NULL |
||
286 | * |
||
287 | * @throws Utils\JsonException |
||
288 | */ |
||
289 | private function createDocumentObject(PsrRequest $request, PsrResponse $response = NULL) : ?Objects\IDocument |
||
293 | |||
294 | /** |
||
295 | * @param PsrRequest $request |
||
296 | * @param PsrResponse|NULL $response |
||
297 | * |
||
298 | * @return Objects\IMutableError|NULL |
||
299 | * |
||
300 | * @throws Utils\JsonException |
||
301 | */ |
||
302 | private function createErrorObject(PsrRequest $request, PsrResponse $response = NULL) : ?Objects\IMutableError |
||
306 | |||
307 | /** |
||
308 | * @param string $baseUri |
||
309 | * |
||
310 | * @return Client |
||
311 | */ |
||
312 | private function createClient(string $baseUri) : Client |
||
320 | } |
||
321 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.