Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | protected function validValue(string $value): bool |
||
21 | { |
||
22 | $identifier = '(\w|-|{\w+})+'; |
||
23 | $scheme = '^' . $identifier . '://'; |
||
24 | $username = $identifier . '(:' . $identifier . ')?'; |
||
25 | $hostname = $identifier . '(\.' . $identifier . ')*'; |
||
26 | $path = '/(.|{\w+})*'; |
||
27 | $regex = '#' . $scheme . '(' . $username . '@)?' . $hostname . '(' . $path . ')*$#i'; |
||
28 | return preg_match($regex, $value) ? true : false; |
||
29 | } |
||
55 | } |