@@ 686-695 (lines=10) @@ | ||
683 | } |
|
684 | } |
|
685 | ||
686 | public static function endsWith($value, $suffix, $message = '') |
|
687 | { |
|
688 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
689 | static::reportInvalidArgument(sprintf( |
|
690 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
691 | static::valueToString($value), |
|
692 | static::valueToString($suffix) |
|
693 | )); |
|
694 | } |
|
695 | } |
|
696 | ||
697 | public static function regex($value, $pattern, $message = '') |
|
698 | { |
|
@@ 928-937 (lines=10) @@ | ||
925 | } |
|
926 | } |
|
927 | ||
928 | public static function implementsInterface($value, $interface, $message = '') |
|
929 | { |
|
930 | if (!in_array($interface, class_implements($value))) { |
|
931 | static::reportInvalidArgument(sprintf( |
|
932 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
933 | static::valueToString($value), |
|
934 | static::valueToString($interface) |
|
935 | )); |
|
936 | } |
|
937 | } |
|
938 | ||
939 | public static function propertyExists($classOrObject, $property, $message = '') |
|
940 | { |