| @@ 635-644 (lines=10) @@ | ||
| 632 | } |
|
| 633 | } |
|
| 634 | ||
| 635 | public static function endsWith($value, $suffix, $message = '') |
|
| 636 | { |
|
| 637 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 638 | static::reportInvalidArgument(sprintf( |
|
| 639 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 640 | static::valueToString($value), |
|
| 641 | static::valueToString($suffix) |
|
| 642 | )); |
|
| 643 | } |
|
| 644 | } |
|
| 645 | ||
| 646 | public static function endsNotWith($value, $suffix, $message = '') |
|
| 647 | { |
|
| @@ 646-655 (lines=10) @@ | ||
| 643 | } |
|
| 644 | } |
|
| 645 | ||
| 646 | public static function endsNotWith($value, $suffix, $message = '') |
|
| 647 | { |
|
| 648 | if ($suffix === substr($value, -static::strlen($suffix))) { |
|
| 649 | static::reportInvalidArgument(sprintf( |
|
| 650 | $message ?: 'Expected a value to not end with %2$s.', |
|
| 651 | static::valueToString($value), |
|
| 652 | static::valueToString($suffix) |
|
| 653 | )); |
|
| 654 | } |
|
| 655 | } |
|
| 656 | ||
| 657 | public static function regex($value, $pattern, $message = '') |
|
| 658 | { |
|
| @@ 878-887 (lines=10) @@ | ||
| 875 | } |
|
| 876 | } |
|
| 877 | ||
| 878 | public static function implementsInterface($value, $interface, $message = '') |
|
| 879 | { |
|
| 880 | if (!in_array($interface, class_implements($value))) { |
|
| 881 | static::reportInvalidArgument(sprintf( |
|
| 882 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 883 | static::valueToString($value), |
|
| 884 | static::valueToString($interface) |
|
| 885 | )); |
|
| 886 | } |
|
| 887 | } |
|
| 888 | ||
| 889 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 890 | { |
|