@@ 565-574 (lines=10) @@ | ||
562 | } |
|
563 | } |
|
564 | ||
565 | public static function endsWith($value, $suffix, $message = '') |
|
566 | { |
|
567 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
568 | static::reportInvalidArgument(sprintf( |
|
569 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
570 | static::valueToString($value), |
|
571 | static::valueToString($suffix) |
|
572 | )); |
|
573 | } |
|
574 | } |
|
575 | ||
576 | public static function regex($value, $pattern, $message = '') |
|
577 | { |
|
@@ 785-794 (lines=10) @@ | ||
782 | } |
|
783 | } |
|
784 | ||
785 | public static function implementsInterface($value, $interface, $message = '') |
|
786 | { |
|
787 | if (!in_array($interface, class_implements($value))) { |
|
788 | static::reportInvalidArgument(sprintf( |
|
789 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
790 | static::valueToString($value), |
|
791 | static::valueToString($interface) |
|
792 | )); |
|
793 | } |
|
794 | } |
|
795 | ||
796 | public static function propertyExists($classOrObject, $property, $message = '') |
|
797 | { |