Total Complexity | 11 |
Total Lines | 98 |
Duplicated Lines | 0 % |
Coverage | 69.23% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class Curl implements HttpRequest |
||
11 | { |
||
12 | /** |
||
13 | * @var null|false|resource |
||
14 | */ |
||
15 | private $handle = null; |
||
16 | |||
17 | /** |
||
18 | * @return $this |
||
19 | */ |
||
20 | 3 | public function init() |
|
21 | { |
||
22 | 3 | if (is_null($this->handle)) { |
|
23 | 3 | $this->handle = curl_init(); |
|
24 | 2 | } |
|
25 | |||
26 | 3 | return $this; |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param $url |
||
31 | * @return Curl |
||
32 | */ |
||
33 | 3 | public function setUrl($url) |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param $name |
||
40 | * @param $value |
||
41 | * @return Curl |
||
42 | */ |
||
43 | 3 | public function setOption($name, $value) |
|
47 | } |
||
48 | |||
49 | |||
50 | /** |
||
51 | * @return false| resource |
||
52 | */ |
||
53 | 3 | public function getHandle() |
|
54 | { |
||
55 | 3 | return $this->handle; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return bool|string |
||
60 | */ |
||
61 | public function execute() |
||
62 | { |
||
63 | return curl_exec($this->handle); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @param $name |
||
68 | * @return mixed |
||
69 | */ |
||
70 | 3 | public function getInfo($name) |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return array|false |
||
77 | */ |
||
78 | public function getAllInfo() |
||
79 | { |
||
80 | return curl_getinfo($this->handle); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return int|mixed |
||
85 | */ |
||
86 | public function getErrorNumber() |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @return mixed|string |
||
93 | */ |
||
94 | public function getErrorMessage() |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @return Curl |
||
101 | */ |
||
102 | 3 | public function close() |
|
108 | } |
||
109 | } |
||
110 |