| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 38 | public function validate(AccountNumber $number): ResultInterface |
|
| 20 | { |
||
| 21 | 38 | $checkDigit = $number->getClearingCheckDigit(); |
|
| 22 | |||
| 23 | 38 | if ($checkDigit != '') { |
|
| 24 | 36 | $expected = Modulo10::calculateCheckDigit($number->getClearingNumber()); |
|
| 25 | |||
| 26 | 36 | if ($expected != $checkDigit) { |
|
| 27 | 28 | return new Failure("Invalid clearing number check digit $checkDigit, expected $expected"); |
|
| 28 | } |
||
| 29 | |||
| 30 | 11 | return new Success("Valid clearing number check digit $checkDigit"); |
|
| 31 | } |
||
| 32 | |||
| 33 | 32 | return new Success("Skipped validation of clearing number check digit"); |
|
| 34 | } |
||
| 35 | } |
||
| 36 |