Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
24 | public function validate(AccountNumber $number) |
||
25 | { |
||
26 | try { |
||
27 | new PersonalId($number->getSerialNumber() . $number->getCheckDigit()); |
||
28 | } catch (\byrokrat\id\Exception\InvalidCheckDigitException $e) { |
||
29 | throw new InvalidCheckDigitException("Invalid check digit {$number->getCheckDigit()} in $number", 0, $e); |
||
30 | } catch (\byrokrat\id\Exception\RuntimeException $e) { |
||
31 | throw new InvalidAccountNumberException("Account number $number is not a valid personal id number", 0, $e); |
||
32 | } |
||
33 | } |
||
34 | } |
||
35 |