| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 1 | public function exists($url) |
|
| 42 | { |
||
| 43 | 1 | $ch = curl_init(); |
|
| 44 | 1 | curl_setopt($ch, CURLOPT_URL, $url); |
|
| 45 | 1 | curl_setopt($ch, CURLOPT_NOBODY, true); |
|
| 46 | 1 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); |
|
| 47 | 1 | curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); |
|
| 48 | 1 | curl_setopt($ch, CURLOPT_HEADER, false); |
|
| 49 | 1 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); |
|
| 50 | |||
| 51 | 1 | curl_exec($ch); |
|
| 52 | 1 | $info = curl_getinfo($ch); |
|
| 53 | 1 | curl_close($ch); |
|
| 54 | |||
| 55 | 1 | return $info['http_code'] === Response::HTTP_OK; |
|
| 56 | } |
||
| 57 | } |
||
| 58 |