Completed
Pull Request — master (#18)
by Hannes
06:53
created

NoClearingCheckDigitValidator::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
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 168
    public function validate(AccountNumber $number): ResultInterface
15
    {
16 168
        if ($number->getClearingCheckDigit() != '') {
17 124
            return new Failure("Unexpected clearing number check digit");
18
        }
19
20 166
        return new Success("No clearing check digit");
21
    }
22
}
23