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