@@ 658-667 (lines=10) @@ | ||
655 | } |
|
656 | } |
|
657 | ||
658 | public static function endsWith($value, $suffix, $message = '') |
|
659 | { |
|
660 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
661 | static::reportInvalidArgument(sprintf( |
|
662 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
663 | static::valueToString($value), |
|
664 | static::valueToString($suffix) |
|
665 | )); |
|
666 | } |
|
667 | } |
|
668 | ||
669 | public static function regex($value, $pattern, $message = '') |
|
670 | { |
|
@@ 900-909 (lines=10) @@ | ||
897 | } |
|
898 | } |
|
899 | ||
900 | public static function implementsInterface($value, $interface, $message = '') |
|
901 | { |
|
902 | if (!in_array($interface, class_implements($value))) { |
|
903 | static::reportInvalidArgument(sprintf( |
|
904 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
905 | static::valueToString($value), |
|
906 | static::valueToString($interface) |
|
907 | )); |
|
908 | } |
|
909 | } |
|
910 | ||
911 | public static function propertyExists($classOrObject, $property, $message = '') |
|
912 | { |