GRAlgorithm::validate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace LeKoala\Tin\Algo;
4
5
use LeKoala\Tin\Util\StringUtil;
6
7
/**
8
 * Greece
9
 */
10
class GRAlgorithm extends TINAlgorithm
11
{
12
    const LENGTH = 9;
13
14
    public function validate(string $tin)
15
    {
16
        if (!$this->isFollowLength($tin)) {
17
            return StatusCode::INVALID_LENGTH;
18
        }
19
        return StatusCode::VALID;
20
    }
21
22
    public function isFollowLength(string $tin)
23
    {
24
        return StringUtil::isFollowLength($tin, self::LENGTH);
25
    }
26
}
27