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