| @@ 656-665 (lines=10) @@ | ||
| 653 | } |
|
| 654 | } |
|
| 655 | ||
| 656 | public static function endsWith($value, $suffix, $message = '') |
|
| 657 | { |
|
| 658 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 659 | static::reportInvalidArgument(sprintf( |
|
| 660 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 661 | static::valueToString($value), |
|
| 662 | static::valueToString($suffix) |
|
| 663 | )); |
|
| 664 | } |
|
| 665 | } |
|
| 666 | ||
| 667 | public static function regex($value, $pattern, $message = '') |
|
| 668 | { |
|
| @@ 888-897 (lines=10) @@ | ||
| 885 | } |
|
| 886 | } |
|
| 887 | ||
| 888 | public static function implementsInterface($value, $interface, $message = '') |
|
| 889 | { |
|
| 890 | if (!in_array($interface, class_implements($value))) { |
|
| 891 | static::reportInvalidArgument(sprintf( |
|
| 892 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 893 | static::valueToString($value), |
|
| 894 | static::valueToString($interface) |
|
| 895 | )); |
|
| 896 | } |
|
| 897 | } |
|
| 898 | ||
| 899 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 900 | { |
|