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

NoClearingCheckDigitValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 8 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