| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | public function isValid($value): bool |
||
| 15 | { |
||
| 16 | $this->value = $this->standardValue = $value; |
||
| 17 | |||
| 18 | if (is_string($value)) { |
||
| 19 | if (!preg_match('/^[1-9][0-9]*$|^0$/', $value)) { |
||
| 20 | $this->setError(static::NOT_INTEGER); |
||
| 21 | return false; |
||
| 22 | } |
||
| 23 | |||
| 24 | $this->standardValue = (int) $value; |
||
| 25 | return true; |
||
| 26 | } |
||
| 27 | |||
| 28 | if (is_int($value)) { |
||
| 29 | return true; |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->setError(self::NOT_INTEGER); |
||
| 33 | return false; |
||
| 34 | } |
||
| 36 |