Conditions | 4 |
Paths | 5 |
Total Lines | 27 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
65 | public function hit() |
||
66 | { |
||
67 | if (is_null($this->response) === false) |
||
68 | { |
||
69 | return $this->response; |
||
70 | } |
||
71 | |||
72 | curl_exec($this->resource); |
||
73 | $error = curl_error($this->resource); |
||
74 | $errno = curl_errno($this->resource); |
||
75 | |||
76 | $response = (int)curl_getinfo($this->resource, CURLINFO_HTTP_CODE); |
||
77 | |||
78 | if (is_resource($this->resource)) |
||
79 | { |
||
80 | curl_close($this->resource); |
||
81 | } |
||
82 | |||
83 | if (0 !== $errno) |
||
84 | { |
||
85 | throw new \RuntimeException($error, $errno); |
||
86 | } |
||
87 | |||
88 | $this->response = $response; |
||
89 | |||
90 | return $response; |
||
91 | } |
||
92 | } |
||
93 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.