| @@ 691-700 (lines=10) @@ | ||
| 688 | } |
|
| 689 | } |
|
| 690 | ||
| 691 | public static function endsWith($value, $suffix, $message = '') |
|
| 692 | { |
|
| 693 | if ($suffix !== substr($value, -strlen($suffix))) { |
|
| 694 | static::reportInvalidArgument(sprintf( |
|
| 695 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 696 | static::valueToString($value), |
|
| 697 | static::valueToString($suffix) |
|
| 698 | )); |
|
| 699 | } |
|
| 700 | } |
|
| 701 | ||
| 702 | public static function regex($value, $pattern, $message = '') |
|
| 703 | { |
|
| @@ 945-954 (lines=10) @@ | ||
| 942 | } |
|
| 943 | } |
|
| 944 | ||
| 945 | public static function implementsInterface($value, $interface, $message = '') |
|
| 946 | { |
|
| 947 | if (!in_array($interface, class_implements($value))) { |
|
| 948 | static::reportInvalidArgument(sprintf( |
|
| 949 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 950 | static::valueToString($value), |
|
| 951 | static::valueToString($interface) |
|
| 952 | )); |
|
| 953 | } |
|
| 954 | } |
|
| 955 | ||
| 956 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 957 | { |
|