| @@ 575-584 (lines=10) @@ | ||
| 572 | } |
|
| 573 | } |
|
| 574 | ||
| 575 | public static function endsWith($value, $suffix, $message = '') |
|
| 576 | { |
|
| 577 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 578 | static::reportInvalidArgument(sprintf( |
|
| 579 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 580 | static::valueToString($value), |
|
| 581 | static::valueToString($suffix) |
|
| 582 | )); |
|
| 583 | } |
|
| 584 | } |
|
| 585 | ||
| 586 | public static function regex($value, $pattern, $message = '') |
|
| 587 | { |
|
| @@ 795-804 (lines=10) @@ | ||
| 792 | } |
|
| 793 | } |
|
| 794 | ||
| 795 | public static function implementsInterface($value, $interface, $message = '') |
|
| 796 | { |
|
| 797 | if (!in_array($interface, class_implements($value))) { |
|
| 798 | static::reportInvalidArgument(sprintf( |
|
| 799 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 800 | static::valueToString($value), |
|
| 801 | static::valueToString($interface) |
|
| 802 | )); |
|
| 803 | } |
|
| 804 | } |
|
| 805 | ||
| 806 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 807 | { |
|