@@ 419-430 (lines=12) @@ | ||
416 | )); |
|
417 | } |
|
418 | ||
419 | public static function isAOf($value, $class, $message = '') |
|
420 | { |
|
421 | static::string($class, 'Expected class as a string. Got: %s'); |
|
422 | ||
423 | if (!is_a($value, $class, is_string($value))) { |
|
424 | static::reportInvalidArgument(sprintf( |
|
425 | $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s', |
|
426 | static::typeToString($value), |
|
427 | $class |
|
428 | )); |
|
429 | } |
|
430 | } |
|
431 | ||
432 | public static function notAOf($value, $class, $message = '') |
|
433 | { |
|
@@ 432-443 (lines=12) @@ | ||
429 | } |
|
430 | } |
|
431 | ||
432 | public static function notAOf($value, $class, $message = '') |
|
433 | { |
|
434 | static::string($class, 'Expected class as a string. Got: %s'); |
|
435 | ||
436 | if (is_a($value, $class, is_string($value))) { |
|
437 | static::reportInvalidArgument(sprintf( |
|
438 | $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s', |
|
439 | static::typeToString($value), |
|
440 | $class |
|
441 | )); |
|
442 | } |
|
443 | } |
|
444 | ||
445 | public static function isAOfAny($value, array $classes, $message = '') |
|
446 | { |