| @@ 729-738 (lines=10) @@ | ||
| 726 | } |
|
| 727 | } |
|
| 728 | ||
| 729 | public static function endsWith($value, $suffix, $message = '') |
|
| 730 | { |
|
| 731 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 732 | static::reportInvalidArgument(sprintf( |
|
| 733 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 734 | static::valueToString($value), |
|
| 735 | static::valueToString($suffix) |
|
| 736 | )); |
|
| 737 | } |
|
| 738 | } |
|
| 739 | ||
| 740 | public static function regex($value, $pattern, $message = '') |
|
| 741 | { |
|
| @@ 971-980 (lines=10) @@ | ||
| 968 | } |
|
| 969 | } |
|
| 970 | ||
| 971 | public static function implementsInterface($value, $interface, $message = '') |
|
| 972 | { |
|
| 973 | if (!in_array($interface, class_implements($value))) { |
|
| 974 | static::reportInvalidArgument(sprintf( |
|
| 975 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 976 | static::valueToString($value), |
|
| 977 | static::valueToString($interface) |
|
| 978 | )); |
|
| 979 | } |
|
| 980 | } |
|
| 981 | ||
| 982 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 983 | { |
|