@@ 599-610 (lines=12) @@ | ||
596 | )); |
|
597 | } |
|
598 | ||
599 | public static function isAOf($value, $class, $message = '') |
|
600 | { |
|
601 | static::string($class, 'Expected class as a string. Got: %s'); |
|
602 | ||
603 | if (!is_a($value, $class, is_string($value))) { |
|
604 | static::reportInvalidArgument(sprintf( |
|
605 | $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s', |
|
606 | static::typeToString($value), |
|
607 | $class |
|
608 | )); |
|
609 | } |
|
610 | } |
|
611 | ||
612 | public static function notAOf($value, $class, $message = '') |
|
613 | { |
|
@@ 612-623 (lines=12) @@ | ||
609 | } |
|
610 | } |
|
611 | ||
612 | public static function notAOf($value, $class, $message = '') |
|
613 | { |
|
614 | static::string($class, 'Expected class as a string. Got: %s'); |
|
615 | ||
616 | if (is_a($value, $class, is_string($value))) { |
|
617 | static::reportInvalidArgument(sprintf( |
|
618 | $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s', |
|
619 | static::typeToString($value), |
|
620 | $class |
|
621 | )); |
|
622 | } |
|
623 | } |
|
624 | ||
625 | public static function isAOfAny($value, array $classes, $message = '') |
|
626 | { |