| @@ 692-701 (lines=10) @@ | ||
| 689 | } |
|
| 690 | } |
|
| 691 | ||
| 692 | public static function endsWith($value, $suffix, $message = '') |
|
| 693 | { |
|
| 694 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 695 | static::reportInvalidArgument(sprintf( |
|
| 696 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 697 | static::valueToString($value), |
|
| 698 | static::valueToString($suffix) |
|
| 699 | )); |
|
| 700 | } |
|
| 701 | } |
|
| 702 | ||
| 703 | public static function regex($value, $pattern, $message = '') |
|
| 704 | { |
|
| @@ 934-943 (lines=10) @@ | ||
| 931 | } |
|
| 932 | } |
|
| 933 | ||
| 934 | public static function implementsInterface($value, $interface, $message = '') |
|
| 935 | { |
|
| 936 | if (!in_array($interface, class_implements($value))) { |
|
| 937 | static::reportInvalidArgument(sprintf( |
|
| 938 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 939 | static::valueToString($value), |
|
| 940 | static::valueToString($interface) |
|
| 941 | )); |
|
| 942 | } |
|
| 943 | } |
|
| 944 | ||
| 945 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 946 | { |
|