Total Complexity | 9 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 87.5% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class Gtin extends Ean |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritDoc} |
||
20 | */ |
||
21 | public function fillParameters(array $params): Rule |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Check if the current value is a valid Global Trade Item Number. |
||
32 | * |
||
33 | * Value must be either GTIN-13 or GTIN-8, which is checked as EAN by parent class. |
||
34 | * Or value must be GTIN-14 or GTIN-12 which will be handled like this: |
||
35 | * |
||
36 | * - GTIN-14 will be checked as EAN-13 after cropping first char |
||
37 | * - GTIN-12 will be checked as EAN-13 after adding leading zero |
||
38 | * |
||
39 | * @credit <a href="https://github.com/Intervention/validation">Intervention/validation - \Intervention\Validation\Rules\Gtin</a> |
||
40 | * |
||
41 | * @param mixed $value |
||
42 | */ |
||
43 | public function check($value): bool |
||
68 |