@@ 691-700 (lines=10) @@ | ||
688 | } |
|
689 | } |
|
690 | ||
691 | public static function endsWith($value, $suffix, $message = '') |
|
692 | { |
|
693 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
694 | static::reportInvalidArgument(sprintf( |
|
695 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
696 | static::valueToString($value), |
|
697 | static::valueToString($suffix) |
|
698 | )); |
|
699 | } |
|
700 | } |
|
701 | ||
702 | public static function regex($value, $pattern, $message = '') |
|
703 | { |
|
@@ 943-952 (lines=10) @@ | ||
940 | } |
|
941 | } |
|
942 | ||
943 | public static function implementsInterface($value, $interface, $message = '') |
|
944 | { |
|
945 | if (!in_array($interface, class_implements($value))) { |
|
946 | static::reportInvalidArgument(sprintf( |
|
947 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
948 | static::valueToString($value), |
|
949 | static::valueToString($interface) |
|
950 | )); |
|
951 | } |
|
952 | } |
|
953 | ||
954 | public static function propertyExists($classOrObject, $property, $message = '') |
|
955 | { |