| @@ 533-542 (lines=10) @@ | ||
| 530 | } |
|
| 531 | } |
|
| 532 | ||
| 533 | public static function endsWith($value, $suffix, $message = '') |
|
| 534 | { |
|
| 535 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 536 | static::reportInvalidArgument(sprintf( |
|
| 537 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 538 | static::valueToString($value), |
|
| 539 | static::valueToString($suffix) |
|
| 540 | )); |
|
| 541 | } |
|
| 542 | } |
|
| 543 | ||
| 544 | public static function regex($value, $pattern, $message = '') |
|
| 545 | { |
|
| @@ 753-762 (lines=10) @@ | ||
| 750 | } |
|
| 751 | } |
|
| 752 | ||
| 753 | public static function implementsInterface($value, $interface, $message = '') |
|
| 754 | { |
|
| 755 | if (!in_array($interface, class_implements($value))) { |
|
| 756 | static::reportInvalidArgument(sprintf( |
|
| 757 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 758 | static::valueToString($value), |
|
| 759 | static::valueToString($interface) |
|
| 760 | )); |
|
| 761 | } |
|
| 762 | } |
|
| 763 | ||
| 764 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 765 | { |
|