Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
33 | 14 | public function validate($input): bool |
|
34 | { |
||
35 | 14 | if (false !== strpos($input, '--')) { |
|
36 | 2 | return false; |
|
37 | } |
||
38 | |||
39 | 12 | if (!preg_match('/^[0-9a-z\-]+$/', $input)) { |
|
40 | 6 | return false; |
|
41 | } |
||
42 | |||
43 | 6 | if (preg_match('/^-|-$/', $input)) { |
|
44 | 2 | return false; |
|
45 | } |
||
46 | |||
47 | 4 | return true; |
|
48 | } |
||
50 |