| @@ 624-633 (lines=10) @@ | ||
| 621 | } |
|
| 622 | } |
|
| 623 | ||
| 624 | public static function endsWith($value, $suffix, $message = '') |
|
| 625 | { |
|
| 626 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 627 | static::reportInvalidArgument(sprintf( |
|
| 628 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 629 | static::valueToString($value), |
|
| 630 | static::valueToString($suffix) |
|
| 631 | )); |
|
| 632 | } |
|
| 633 | } |
|
| 634 | ||
| 635 | public static function regex($value, $pattern, $message = '') |
|
| 636 | { |
|
| @@ 856-865 (lines=10) @@ | ||
| 853 | } |
|
| 854 | } |
|
| 855 | ||
| 856 | public static function implementsInterface($value, $interface, $message = '') |
|
| 857 | { |
|
| 858 | if (!in_array($interface, class_implements($value))) { |
|
| 859 | static::reportInvalidArgument(sprintf( |
|
| 860 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 861 | static::valueToString($value), |
|
| 862 | static::valueToString($interface) |
|
| 863 | )); |
|
| 864 | } |
|
| 865 | } |
|
| 866 | ||
| 867 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 868 | { |
|