@@ 546-557 (lines=12) @@ | ||
543 | )); |
|
544 | } |
|
545 | ||
546 | public static function isAOf($value, $class, $message = '') |
|
547 | { |
|
548 | static::string($class, 'Expected class as a string. Got: %s'); |
|
549 | ||
550 | if (!is_a($value, $class, is_string($value))) { |
|
551 | static::reportInvalidArgument(sprintf( |
|
552 | $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s', |
|
553 | static::typeToString($value), |
|
554 | $class |
|
555 | )); |
|
556 | } |
|
557 | } |
|
558 | ||
559 | public static function notAOf($value, $class, $message = '') |
|
560 | { |
|
@@ 559-570 (lines=12) @@ | ||
556 | } |
|
557 | } |
|
558 | ||
559 | public static function notAOf($value, $class, $message = '') |
|
560 | { |
|
561 | static::string($class, 'Expected class as a string. Got: %s'); |
|
562 | ||
563 | if (is_a($value, $class, is_string($value))) { |
|
564 | static::reportInvalidArgument(sprintf( |
|
565 | $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s', |
|
566 | static::typeToString($value), |
|
567 | $class |
|
568 | )); |
|
569 | } |
|
570 | } |
|
571 | ||
572 | public static function isAOfAny($value, array $classes, $message = '') |
|
573 | { |