@@ 712-721 (lines=10) @@ | ||
709 | } |
|
710 | } |
|
711 | ||
712 | public static function endsWith($value, $suffix, $message = '') |
|
713 | { |
|
714 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
715 | static::reportInvalidArgument(sprintf( |
|
716 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
717 | static::valueToString($value), |
|
718 | static::valueToString($suffix) |
|
719 | )); |
|
720 | } |
|
721 | } |
|
722 | ||
723 | public static function regex($value, $pattern, $message = '') |
|
724 | { |
|
@@ 954-963 (lines=10) @@ | ||
951 | } |
|
952 | } |
|
953 | ||
954 | public static function implementsInterface($value, $interface, $message = '') |
|
955 | { |
|
956 | if (!in_array($interface, class_implements($value))) { |
|
957 | static::reportInvalidArgument(sprintf( |
|
958 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
959 | static::valueToString($value), |
|
960 | static::valueToString($interface) |
|
961 | )); |
|
962 | } |
|
963 | } |
|
964 | ||
965 | public static function propertyExists($classOrObject, $property, $message = '') |
|
966 | { |