@@ 606-617 (lines=12) @@ | ||
603 | * |
|
604 | * @throws InvalidArgumentException |
|
605 | */ |
|
606 | public static function isAOf($value, $class, $message = '') |
|
607 | { |
|
608 | static::string($class, 'Expected class as a string. Got: %s'); |
|
609 | ||
610 | if (!\is_a($value, $class, \is_string($value))) { |
|
611 | static::reportInvalidArgument(sprintf( |
|
612 | $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s', |
|
613 | static::typeToString($value), |
|
614 | $class |
|
615 | )); |
|
616 | } |
|
617 | } |
|
618 | ||
619 | /** |
|
620 | * @param object|string $value |
|
@@ 626-637 (lines=12) @@ | ||
623 | * |
|
624 | * @throws InvalidArgumentException |
|
625 | */ |
|
626 | public static function isNotA($value, $class, $message = '') |
|
627 | { |
|
628 | static::string($class, 'Expected class as a string. Got: %s'); |
|
629 | ||
630 | if (\is_a($value, $class, \is_string($value))) { |
|
631 | static::reportInvalidArgument(sprintf( |
|
632 | $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s', |
|
633 | static::typeToString($value), |
|
634 | $class |
|
635 | )); |
|
636 | } |
|
637 | } |
|
638 | ||
639 | /** |
|
640 | * @param object|string $value |