@@ 16-25 (lines=10) @@ | ||
13 | */ |
|
14 | protected function validateCastValue($val) |
|
15 | { |
|
16 | if (!is_numeric($val)) { |
|
17 | throw $this->getValidationException('value must be numeric', $val); |
|
18 | } else { |
|
19 | $intVal = (int) $val; |
|
20 | if ($intVal != (float) $val) { |
|
21 | throw $this->getValidationException('value must be an integer', $val); |
|
22 | } else { |
|
23 | return $intVal; |
|
24 | } |
|
25 | } |
|
26 | } |
|
27 | ||
28 | public static function type() |
@@ 38-47 (lines=10) @@ | ||
35 | $val = $newval; |
|
36 | } |
|
37 | } |
|
38 | if (!is_numeric($val)) { |
|
39 | throw $this->getValidationException('value must be numeric', $val); |
|
40 | } else { |
|
41 | $val = (float) $val; |
|
42 | if ($isPercent) { |
|
43 | $val = $val / 100; |
|
44 | } |
|
45 | ||
46 | return $val; |
|
47 | } |
|
48 | } |
|
49 | ||
50 | public static function type() |