NoClearingCheckDigitValidator::validate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace byrokrat\banking\Validator;
6
7
use byrokrat\banking\AccountNumber;
8
9
/**
10
 * Validate that there is no clearing number check digit
11
 */
12
class NoClearingCheckDigitValidator implements ValidatorInterface
13
{
14 170
    public function validate(AccountNumber $number): ResultInterface
15
    {
16 170
        if ($number->getClearingCheckDigit() != '') {
17 124
            return new Failure("Unexpected clearing number check digit");
18
        }
19
20 168
        return new Success("No clearing check digit");
21
    }
22
}
23