BankgiroFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
ccs 6
cts 6
cp 1
crap 1
1
<?php
2
3
namespace byrokrat\banking\Formatter;
4
5
use byrokrat\banking\AccountNumber;
6
7
class BankgiroFormatter implements FormatterInterface
8
{
9 2
    public function format(AccountNumber $number): string
10
    {
11 2
        return sprintf(
12 2
            '%s-%s%s',
13 2
            substr($number->getSerialNumber(), 0, -3),
14 2
            substr($number->getSerialNumber(), -3),
15 2
            $number->getCheckDigit()
16
        );
17
    }
18
}
19