| Total Complexity | 8 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | class UrlValidator |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * Returns true when url does not return error codes or not found. |
||
| 22 | * |
||
| 23 | * @param string $url |
||
| 24 | * @return boolean |
||
| 25 | */ |
||
| 26 | public function validate($url) |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Fetch a url with a HEAD request because we just want to check status code. |
||
| 38 | * |
||
| 39 | * @param string $url |
||
| 40 | * @return array|null |
||
| 41 | */ |
||
| 42 | protected function getHeader($url) |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Parse the headers array and search for the status pattern |
||
| 53 | * |
||
| 54 | * @param array $headers |
||
| 55 | * @return int |
||
| 56 | */ |
||
| 57 | protected function getStatusCode(array $headers) |
||
| 68 |