ClearingPrependingRewriter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A rewrite() 0 10 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace byrokrat\banking\Rewriter;
6
7
use byrokrat\banking\AccountNumber;
8
use byrokrat\banking\UndefinedAccount;
9
10
/**
11
 * Rewriter that prepends a definied clearing number
12
 */
13
class ClearingPrependingRewriter implements RewriterInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    private $clearing;
19
20 2
    public function __construct(string $clearing)
21
    {
22 2
        $this->clearing = $clearing;
23 2
    }
24
25 59
    public function rewrite(AccountNumber $account): AccountNumber
26
    {
27 59
        return new UndefinedAccount(
28 59
            $account->getRawNumber(),
29 59
            $this->clearing,
30 59
            '',
31 59
            $account->getClearingNumber() . $account->getClearingCheckDigit() . $account->getSerialNumber(),
32 59
            $account->getCheckDigit()
33
        );
34
    }
35
}
36