Conditions | 3 |
Paths | 4 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
23 | 10 | public function query(string $query, array $variables = null): Response |
|
24 | { |
||
25 | $options = [ |
||
26 | 'json' => [ |
||
27 | 10 | 'query' => $query, |
|
28 | ], |
||
29 | ]; |
||
30 | 10 | if (!is_null($variables)) { |
|
31 | 2 | $options['json']['variables'] = $variables; |
|
32 | } |
||
33 | |||
34 | try { |
||
35 | 10 | $response = $this->httpClient->request('POST', '', $options); |
|
36 | 4 | } catch (TransferException $e) { |
|
37 | 4 | throw new \RuntimeException('Network Error.' . $e->getMessage(), 0, $e); |
|
38 | } |
||
39 | |||
40 | 6 | return $this->responseBuilder->build($response); |
|
41 | } |
||
42 | } |
||
43 |