Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | public function isValid($input = null) |
||
17 | { |
||
18 | $input = (string) $input; |
||
19 | |||
20 | if (strlen($input) != 9) { |
||
21 | $this->violations[] = 'length'; |
||
22 | |||
23 | return false; |
||
24 | } |
||
25 | |||
26 | if (!preg_match('/\d{4}[\dA-Z][\dA-Z]\d{3}/', $input)) { |
||
27 | $this->violations[] = 'format'; |
||
28 | |||
29 | return false; |
||
30 | } |
||
31 | |||
32 | return true; |
||
33 | } |
||
35 |