| @@ 601-610 (lines=10) @@ | ||
| 598 | } |
|
| 599 | } |
|
| 600 | ||
| 601 | public static function endsWith($value, $suffix, $message = '') |
|
| 602 | { |
|
| 603 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 604 | static::reportInvalidArgument(sprintf( |
|
| 605 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 606 | static::valueToString($value), |
|
| 607 | static::valueToString($suffix) |
|
| 608 | )); |
|
| 609 | } |
|
| 610 | } |
|
| 611 | ||
| 612 | public static function regex($value, $pattern, $message = '') |
|
| 613 | { |
|
| @@ 821-830 (lines=10) @@ | ||
| 818 | } |
|
| 819 | } |
|
| 820 | ||
| 821 | public static function implementsInterface($value, $interface, $message = '') |
|
| 822 | { |
|
| 823 | if (!in_array($interface, class_implements($value))) { |
|
| 824 | static::reportInvalidArgument(sprintf( |
|
| 825 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 826 | static::valueToString($value), |
|
| 827 | static::valueToString($interface) |
|
| 828 | )); |
|
| 829 | } |
|
| 830 | } |
|
| 831 | ||
| 832 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 833 | { |
|