| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function reguestGet($params) |
||
| 22 | { |
||
| 23 | $headers = [ |
||
| 24 | 'User-Agent' => 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2' |
||
| 25 | ]; |
||
| 26 | |||
| 27 | $this->client = new \GuzzleHttp\Client(); |
||
|
|
|||
| 28 | |||
| 29 | try { |
||
| 30 | $response = $this->client->get($this->getUri(), ['debug' => $this->debug, 'query' => $params, 'headers' => $headers]); |
||
| 31 | } catch (RequestException $e) { |
||
| 32 | echo $e->getMessage(); |
||
| 33 | |||
| 34 | if ($e->hasResponse()) { |
||
| 35 | } |
||
| 36 | die('error'); |
||
| 37 | } |
||
| 38 | return $response->getBody()->getContents(); |
||
| 39 | } |
||
| 40 | |||
| 48 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: