| Conditions | 5 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | protected function validateCastValue($val) |
||
| 15 | { |
||
| 16 | if (isset($this->descriptor()->bareNumber) && $this->descriptor()->bareNumber === false) { |
||
| 17 | return mb_ereg_replace('((^\D*)|(\D*$))', '', $val); |
||
| 18 | } elseif (!is_numeric($val)) { |
||
| 19 | throw $this->getValidationException('value must be numeric', $val); |
||
| 20 | } else { |
||
| 21 | $intVal = (int) $val; |
||
| 22 | if ($intVal != (float) $val) { |
||
| 23 | throw $this->getValidationException('value must be an integer', $val); |
||
| 24 | } else { |
||
| 25 | return $intVal; |
||
| 26 | } |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 35 |