@@ 703-712 (lines=10) @@ | ||
700 | } |
|
701 | } |
|
702 | ||
703 | public static function endsWith($value, $suffix, $message = '') |
|
704 | { |
|
705 | if ($suffix !== substr($value, -strlen($suffix))) { |
|
706 | static::reportInvalidArgument(sprintf( |
|
707 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
708 | static::valueToString($value), |
|
709 | static::valueToString($suffix) |
|
710 | )); |
|
711 | } |
|
712 | } |
|
713 | ||
714 | public static function regex($value, $pattern, $message = '') |
|
715 | { |
|
@@ 957-966 (lines=10) @@ | ||
954 | } |
|
955 | } |
|
956 | ||
957 | public static function implementsInterface($value, $interface, $message = '') |
|
958 | { |
|
959 | if (!in_array($interface, class_implements($value))) { |
|
960 | static::reportInvalidArgument(sprintf( |
|
961 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
962 | static::valueToString($value), |
|
963 | static::valueToString($interface) |
|
964 | )); |
|
965 | } |
|
966 | } |
|
967 | ||
968 | public static function propertyExists($classOrObject, $property, $message = '') |
|
969 | { |