| @@ 620-629 (lines=10) @@ | ||
| 617 | } |
|
| 618 | } |
|
| 619 | ||
| 620 | public static function endsWith($value, $suffix, $message = '') |
|
| 621 | { |
|
| 622 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 623 | static::reportInvalidArgument(sprintf( |
|
| 624 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 625 | static::valueToString($value), |
|
| 626 | static::valueToString($suffix) |
|
| 627 | )); |
|
| 628 | } |
|
| 629 | } |
|
| 630 | ||
| 631 | public static function regex($value, $pattern, $message = '') |
|
| 632 | { |
|
| @@ 852-861 (lines=10) @@ | ||
| 849 | } |
|
| 850 | } |
|
| 851 | ||
| 852 | public static function implementsInterface($value, $interface, $message = '') |
|
| 853 | { |
|
| 854 | if (!in_array($interface, class_implements($value))) { |
|
| 855 | static::reportInvalidArgument(sprintf( |
|
| 856 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 857 | static::valueToString($value), |
|
| 858 | static::valueToString($interface) |
|
| 859 | )); |
|
| 860 | } |
|
| 861 | } |
|
| 862 | ||
| 863 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 864 | { |
|