| Conditions | 4 |
| Paths | 4 |
| Total Lines | 8 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 79 | public function isHostValid() |
||
| 80 | { |
||
| 81 | $host = parse_url($this->url, PHP_URL_HOST); |
||
| 82 | return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check |
||
| 83 | && preg_match("/^.{1,253}$/", $host) //overall length check |
||
| 84 | && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host) //length of each label |
||
| 85 | && !filter_var($host, FILTER_VALIDATE_IP)); //is not an IP address |
||
| 86 | } |
||
| 87 | |||
| 101 |