Completed
Push — master ( a004d3...9bce71 )
by Hannes
02:34
created

CoordinationId   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getSerialPreDelimiter() 0 4 1
A getBirthCounty() 0 4 1
1
<?php
2
3
namespace byrokrat\id;
4
5
/**
6
 * Coordination id number
7
 *
8
 * A coordination number is like a personal number except that 60 is added
9
 * to the date of birth.
10
 */
11
class CoordinationId extends PersonalId
12
{
13
    /**
14
     * Coordination id number
15
     *
16
     * {@inheritdoc}
17
     *
18
     * @param string $number
19
     */
20 46
    public function __construct($number)
21
    {
22 46
        list(, $century, $datestr, $delim, $serialPost, $check) = $this->parseNumber(self::PATTERN, $number);
23 28
        $dob = intval($datestr) - 60;
24 28
        parent::__construct($century.$dob.$delim.$serialPost.$check);
25 10
    }
26
27 28
    public function getSerialPreDelimiter()
28
    {
29 28
        return (string) intval(parent::getSerialPreDelimiter()) + 60;
30
    }
31
32 1
    public function getBirthCounty()
33
    {
34 1
        return IdInterface::COUNTY_UNDEFINED;
35
    }
36
}
37