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