| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 24 | public function passes($attribute, $value) |
||
| 25 | { |
||
| 26 | // GTIN is between 8 and 14 characters long |
||
| 27 | if (! GtinValidator::length($value)) { |
||
| 28 | $this->message = 'The GTIN must be between 8 and 14 characters long'; |
||
| 29 | |||
| 30 | return false; |
||
| 31 | } |
||
| 32 | |||
| 33 | // GTIN is a number |
||
| 34 | if (! GtinValidator::integer($value)) { |
||
| 35 | $this->message = 'The GTIN must be an integer'; |
||
| 36 | |||
| 37 | return false; |
||
| 38 | } |
||
| 39 | |||
| 40 | if (! GtinValidator::inspect($value)) { |
||
| 41 | $this->message = "The GTIN value {$value} does not pass algorithmic inspection."; |
||
| 42 | |||
| 43 | return false; |
||
| 44 | } |
||
| 45 | |||
| 46 | return true; |
||
| 47 | } |
||
| 59 |