| Conditions | 7 |
| Paths | 7 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 7.2269 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | public function check($value): bool |
||
| 44 | { |
||
| 45 | if (! is_numeric($value)) { |
||
| 46 | 2 | return false; |
|
| 47 | } |
||
| 48 | |||
| 49 | if (! $this->hasAllowedLength($value)) { |
||
| 50 | 2 | return false; |
|
| 51 | } |
||
| 52 | |||
| 53 | switch (strlen($value)) { |
||
| 54 | case 8: |
||
| 55 | case 13: |
||
| 56 | 2 | return parent::check($value); |
|
| 57 | |||
| 58 | case 14: |
||
| 59 | 2 | return parent::checksumMatches(substr($value, 1)); |
|
| 60 | |||
| 61 | case 12: |
||
| 62 | 2 | return parent::checksumMatches('0' . $value); |
|
| 63 | } |
||
| 64 | |||
| 65 | return false; |
||
| 66 | } |
||
| 68 |