| @@ 553-562 (lines=10) @@ | ||
| 550 | } |
|
| 551 | } |
|
| 552 | ||
| 553 | public static function endsWith($value, $suffix, $message = '') |
|
| 554 | { |
|
| 555 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 556 | static::reportInvalidArgument(sprintf( |
|
| 557 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 558 | static::valueToString($value), |
|
| 559 | static::valueToString($suffix) |
|
| 560 | )); |
|
| 561 | } |
|
| 562 | } |
|
| 563 | ||
| 564 | public static function regex($value, $pattern, $message = '') |
|
| 565 | { |
|
| @@ 773-782 (lines=10) @@ | ||
| 770 | } |
|
| 771 | } |
|
| 772 | ||
| 773 | public static function implementsInterface($value, $interface, $message = '') |
|
| 774 | { |
|
| 775 | if (!in_array($interface, class_implements($value))) { |
|
| 776 | static::reportInvalidArgument(sprintf( |
|
| 777 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 778 | static::valueToString($value), |
|
| 779 | static::valueToString($interface) |
|
| 780 | )); |
|
| 781 | } |
|
| 782 | } |
|
| 783 | ||
| 784 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 785 | { |
|