Total Complexity | 9 |
Total Lines | 107 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
5 | abstract class State implements StateInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | private $state; |
||
11 | |||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | private $length; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $regex; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $format; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | private $numberOfDigits; |
||
31 | |||
32 | /** |
||
33 | * State constructor. |
||
34 | * |
||
35 | * @param string $state |
||
36 | * @param int $length |
||
37 | * @param int $numberOfDigits |
||
38 | * @param string $regex |
||
39 | * @param string $format |
||
40 | */ |
||
41 | 886 | public function __construct(string $state, int $length, int $numberOfDigits, string $regex, string $format) |
|
42 | { |
||
43 | 886 | $this->state = $state; |
|
44 | 886 | $this->length = $length; |
|
45 | 886 | $this->regex = $regex; |
|
46 | 886 | $this->format = $format; |
|
47 | 886 | $this->numberOfDigits = $numberOfDigits; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | 886 | public function getState() : string |
|
54 | { |
||
55 | 886 | return $this->state; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | 862 | public function getLength() : int |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 78 | public function getRegex() : string |
|
70 | { |
||
71 | 78 | return $this->regex; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | 78 | public function getFormat() : string |
|
78 | { |
||
79 | 78 | return $this->format; |
|
80 | } |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | 886 | public function getNumberOfDigits() : int |
|
86 | { |
||
87 | 886 | return $this->numberOfDigits; |
|
88 | } |
||
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 882 | public function normalizeNumber(string $number) : string |
|
94 | { |
||
95 | 882 | return preg_replace('/\D/', '', $number); |
|
96 | } |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | 874 | public function extractBaseNumber(string $number) : string |
|
104 | } |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | 874 | public function extractCheckerDigit(string $number) : string |
|
112 | } |
||
113 | } |
||
114 |