Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | 3 | public function request($url) |
|
27 | { |
||
28 | 3 | $ch = $this->libCurl->init(); |
|
29 | 3 | $this->libCurl->setOpt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
30 | 3 | $this->libCurl->setOpt($ch, CURLOPT_URL, $url); |
|
31 | 3 | $this->libCurl->setOpt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
32 | 3 | $this->libCurl->setOpt($ch, CURLOPT_TIMEOUT, 10); |
|
33 | |||
34 | 3 | $data = $this->libCurl->exec($ch); |
|
35 | |||
36 | 3 | if ($this->libCurl->errno($ch)) { |
|
37 | 1 | throw new \Exception($this->libCurl->error($ch), $this->libCurl->errno($ch)); |
|
38 | } else { |
||
39 | 2 | $this->libCurl->close($ch); |
|
40 | 2 | return $data; |
|
41 | } |
||
42 | } |
||
43 | } |
||
44 |