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