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