| Total Complexity | 8 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class LVAlgorithm extends TINAlgorithm |
||
| 12 | { |
||
| 13 | const LENGTH = 11; |
||
| 14 | |||
| 15 | public function validate(string $tin) |
||
| 16 | { |
||
| 17 | if (!$this->isFollowLength($tin)) { |
||
| 18 | return StatusCode::INVALID_LENGTH; |
||
| 19 | } |
||
| 20 | if (!$this->isValidDate($tin)) { |
||
| 21 | return StatusCode::INVALID_PATTERN; |
||
| 22 | } |
||
| 23 | return StatusCode::VALID; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function isFollowLength(string $tin) |
||
| 27 | { |
||
| 28 | return StringUtil::isFollowLength($tin, self::LENGTH); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $tin |
||
| 33 | * @return boolean |
||
| 34 | */ |
||
| 35 | private function isValidDate(string $tin) |
||
| 51 | } |
||
| 52 | } |
||
| 53 |