| @@ 170-178 (lines=9) @@ | ||
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | public static function integerish($value, $message = '') |
|
| 171 | { |
|
| 172 | if (!is_numeric($value) || $value != (int) $value) { |
|
| 173 | throw new InvalidArgumentException(sprintf( |
|
| 174 | $message ?: 'Expected an integerish value. Got: %s', |
|
| 175 | self::typeToString($value) |
|
| 176 | )); |
|
| 177 | } |
|
| 178 | } |
|
| 179 | ||
| 180 | public static function float($value, $message = '') |
|
| 181 | { |
|
| @@ 258-266 (lines=9) @@ | ||
| 255 | } |
|
| 256 | } |
|
| 257 | ||
| 258 | public static function isArray($value, $message = '') |
|
| 259 | { |
|
| 260 | if (!is_array($value)) { |
|
| 261 | throw new InvalidArgumentException(sprintf( |
|
| 262 | $message ?: 'Expected an array. Got: %s', |
|
| 263 | self::typeToString($value) |
|
| 264 | )); |
|
| 265 | } |
|
| 266 | } |
|
| 267 | ||
| 268 | public static function isTraversable($value, $message = '') |
|
| 269 | { |
|
| @@ 268-276 (lines=9) @@ | ||
| 265 | } |
|
| 266 | } |
|
| 267 | ||
| 268 | public static function isTraversable($value, $message = '') |
|
| 269 | { |
|
| 270 | if (!is_array($value) && !($value instanceof Traversable)) { |
|
| 271 | throw new InvalidArgumentException(sprintf( |
|
| 272 | $message ?: 'Expected a traversable. Got: %s', |
|
| 273 | self::typeToString($value) |
|
| 274 | )); |
|
| 275 | } |
|
| 276 | } |
|
| 277 | ||
| 278 | public static function isInstanceOf($value, $class, $message = '') |
|
| 279 | { |
|