Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
29 | 2 | public function query(string $query): string |
|
30 | { |
||
31 | 2 | $this->httpClient = new HttpClient($this->provideUrl($query)); |
|
32 | 2 | $this->httpClient->setHeader('User-Agent', '*'); |
|
33 | 2 | $this->httpClient->setHeader('Accept-Encoding', 'identity'); // Currently there is a bug in HttpClient for passing buf to gzdecode() |
|
34 | 2 | $this->httpClient->request('GET'); |
|
35 | 2 | $response = ""; |
|
36 | |||
37 | 2 | while ($this->httpClient->getPayload()->ready()) { |
|
38 | 2 | $response .= $this->httpClient->getPayload()->read($this->httpClient->getPayload() |
|
39 | 2 | ->count()); |
|
40 | } |
||
41 | |||
42 | 2 | return $response; |
|
43 | } |
||
44 | |||
57 |