| Total Complexity | 4 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class Numeric implements Type |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * {@inheritdoc} |
||
| 12 | */ |
||
| 13 | 66 | public function castFromLine(Field $field, $value) |
|
| 14 | { |
||
| 15 | 66 | if (! $this->isValidInput($value)) { |
|
| 16 | 2 | throw PediException::invalidInput($field, $value); |
|
| 17 | } |
||
| 18 | |||
| 19 | 64 | return (int) $value; |
|
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | */ |
||
| 25 | 18 | public function castToString(Field $field, $value): string |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritdoc} |
||
| 32 | */ |
||
| 33 | 67 | public function isValidInput($value): bool |
|
| 36 | } |
||
| 37 | } |
||
| 38 |