Total Complexity | 8 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class HUAlgorithm extends TINAlgorithm |
||
11 | { |
||
12 | const LENGTH = 10; |
||
13 | const PATTERN = "8\\d{9}"; |
||
14 | |||
15 | public function validate(string $tin) |
||
16 | { |
||
17 | if (!$this->isFollowLength($tin)) { |
||
18 | return StatusCode::INVALID_LENGTH; |
||
19 | } |
||
20 | if (!$this->isFollowPattern($tin)) { |
||
21 | return StatusCode::INVALID_PATTERN; |
||
22 | } |
||
23 | if (!$this->isFollowRules($tin)) { |
||
24 | return StatusCode::INVALID_SYNTAX; |
||
25 | } |
||
26 | return StatusCode::VALID; |
||
27 | } |
||
28 | |||
29 | public function isFollowLength(string $tin) |
||
32 | } |
||
33 | |||
34 | public function isFollowPattern(string $tin) |
||
37 | } |
||
38 | |||
39 | public function isFollowRules(string $tin) |
||
49 | } |
||
50 | } |
||
51 |