1 | <?php |
||
7 | class SpainBban implements BbanInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $bankCode; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $branchCode; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $checkDigits; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $accountNumber; |
||
28 | |||
29 | /** |
||
30 | * SpainBban constructor. |
||
31 | * |
||
32 | * @param string $bankCode |
||
33 | * @param string $branchCode |
||
34 | * @param string $checkDigits |
||
35 | * @param string $accountNumber |
||
36 | * |
||
37 | * @throws InvalidArgumentException |
||
38 | */ |
||
39 | public function __construct( |
||
61 | |||
62 | /** |
||
63 | * @param string $bban |
||
64 | * |
||
65 | * @throws InvalidArgumentException |
||
66 | * |
||
67 | * @return static |
||
68 | */ |
||
69 | public static function fromString($bban) |
||
82 | |||
83 | /** |
||
84 | * @return string |
||
85 | */ |
||
86 | public function bankCode() |
||
90 | |||
91 | /** |
||
92 | * @return string |
||
93 | */ |
||
94 | public function branchCode() |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function checkDigits() |
||
106 | |||
107 | /** |
||
108 | * @return string |
||
109 | */ |
||
110 | public function accountNumber() |
||
114 | |||
115 | /** |
||
116 | * @return string |
||
117 | */ |
||
118 | public function __toString() |
||
122 | |||
123 | /** |
||
124 | * @param $bankCode |
||
125 | * |
||
126 | * @throws InvalidArgumentException |
||
127 | */ |
||
128 | private static function validateBankCodeFormat($bankCode) |
||
134 | |||
135 | /** |
||
136 | * @param $branchCode |
||
137 | * |
||
138 | * @throws InvalidArgumentException |
||
139 | */ |
||
140 | private static function validateBranchCodeFormat($branchCode) |
||
146 | |||
147 | /** |
||
148 | * @param $checkDigits |
||
149 | * |
||
150 | * @throws InvalidArgumentException |
||
151 | */ |
||
152 | private static function validateCheckDigitsFormat($checkDigits) |
||
158 | |||
159 | /** |
||
160 | * @param $accountNumber |
||
161 | * |
||
162 | * @throws InvalidArgumentException |
||
163 | */ |
||
164 | private static function validateAccountNumberFormat($accountNumber) |
||
170 | |||
171 | /** |
||
172 | * @param $bankCode |
||
173 | * @param $branchCode |
||
174 | * @param $checkDigits |
||
175 | * @param $accountNumber |
||
176 | * |
||
177 | * @throws InvalidArgumentException |
||
178 | */ |
||
179 | private static function validateControlDigit( |
||
204 | } |
||
205 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: