Conditions | 6 |
Paths | 4 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function validate() |
||
16 | { |
||
17 | // The domain name cannot be empty |
||
18 | if (strlen($this->_definition) === 0) |
||
19 | return false; |
||
20 | |||
21 | // None of the parts in the domain name can contain invalid characters |
||
22 | // or begin/end with a dash |
||
23 | foreach (explode('.', $this->_definition) as $part) |
||
24 | { |
||
25 | if (!preg_match('/^[a-zA-Z0-9-\.]+$/', $part) || |
||
26 | substr($part, 0, 1) === '-' || |
||
27 | substr($part, -1) === '-') |
||
28 | { |
||
29 | return false; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return true; |
||
34 | } |
||
35 | |||
42 |