| @@ 622-631 (lines=10) @@ | ||
| 619 | } |
|
| 620 | } |
|
| 621 | ||
| 622 | public static function endsWith($value, $suffix, $message = '') |
|
| 623 | { |
|
| 624 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 625 | static::reportInvalidArgument(sprintf( |
|
| 626 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 627 | static::valueToString($value), |
|
| 628 | static::valueToString($suffix) |
|
| 629 | )); |
|
| 630 | } |
|
| 631 | } |
|
| 632 | ||
| 633 | public static function regex($value, $pattern, $message = '') |
|
| 634 | { |
|
| @@ 864-873 (lines=10) @@ | ||
| 861 | } |
|
| 862 | } |
|
| 863 | ||
| 864 | public static function implementsInterface($value, $interface, $message = '') |
|
| 865 | { |
|
| 866 | if (!in_array($interface, class_implements($value))) { |
|
| 867 | static::reportInvalidArgument(sprintf( |
|
| 868 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 869 | static::valueToString($value), |
|
| 870 | static::valueToString($interface) |
|
| 871 | )); |
|
| 872 | } |
|
| 873 | } |
|
| 874 | ||
| 875 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 876 | { |
|