| @@ 526-535 (lines=10) @@ | ||
| 523 | } |
|
| 524 | } |
|
| 525 | ||
| 526 | public static function endsWith($value, $suffix, $message = '') |
|
| 527 | { |
|
| 528 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 529 | static::reportInvalidArgument(sprintf( |
|
| 530 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 531 | static::valueToString($value), |
|
| 532 | static::valueToString($suffix) |
|
| 533 | )); |
|
| 534 | } |
|
| 535 | } |
|
| 536 | ||
| 537 | public static function regex($value, $pattern, $message = '') |
|
| 538 | { |
|
| @@ 746-755 (lines=10) @@ | ||
| 743 | } |
|
| 744 | } |
|
| 745 | ||
| 746 | public static function implementsInterface($value, $interface, $message = '') |
|
| 747 | { |
|
| 748 | if (!in_array($interface, class_implements($value))) { |
|
| 749 | static::reportInvalidArgument(sprintf( |
|
| 750 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 751 | static::valueToString($value), |
|
| 752 | static::valueToString($interface) |
|
| 753 | )); |
|
| 754 | } |
|
| 755 | } |
|
| 756 | ||
| 757 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 758 | { |
|