| @@ 40-42 (lines=3) @@ | ||
| 37 | */ |
|
| 38 | public static function filter($value, $allowNull = false, $minValue = null, $maxValue = null, $castInts = false) |
|
| 39 | { |
|
| 40 | if ($allowNull !== false && $allowNull !== true) { |
|
| 41 | throw new \InvalidArgumentException('"' . var_export($allowNull, true) . '" $allowNull was not a bool'); |
|
| 42 | } |
|
| 43 | ||
| 44 | if ($minValue !== null && !is_float($minValue)) { |
|
| 45 | throw new \InvalidArgumentException('"' . var_export($minValue, true) . '" $minValue was not a float'); |
|
| @@ 52-54 (lines=3) @@ | ||
| 49 | throw new \InvalidArgumentException('"' . var_export($maxValue, true) . '" $maxValue was not a float'); |
|
| 50 | } |
|
| 51 | ||
| 52 | if ($castInts !== false && $castInts !== true) { |
|
| 53 | throw new \InvalidArgumentException('"' . var_export($castInts, true) . '" $castInts was not a bool'); |
|
| 54 | } |
|
| 55 | ||
| 56 | if ($allowNull === true && $value === null) { |
|
| 57 | return null; |
|
| @@ 42-44 (lines=3) @@ | ||
| 39 | */ |
|
| 40 | public static function filter($value, $allowNull = false, $minValue = null, $maxValue = PHP_INT_MAX) |
|
| 41 | { |
|
| 42 | if ($allowNull !== false && $allowNull !== true) { |
|
| 43 | throw new \InvalidArgumentException('"' . var_export($allowNull, true) . '" $allowNull was not a bool'); |
|
| 44 | } |
|
| 45 | ||
| 46 | if ($minValue !== null && !is_int($minValue)) { |
|
| 47 | throw new \InvalidArgumentException('"' . var_export($minValue, true) . '" $minValue was not an int'); |
|