| @@ 513-522 (lines=10) @@ | ||
| 510 | } |
|
| 511 | } |
|
| 512 | ||
| 513 | public static function endsWith($value, $suffix, $message = '') |
|
| 514 | { |
|
| 515 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 516 | static::reportInvalidArgument(sprintf( |
|
| 517 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 518 | static::valueToString($value), |
|
| 519 | static::valueToString($suffix) |
|
| 520 | )); |
|
| 521 | } |
|
| 522 | } |
|
| 523 | ||
| 524 | public static function regex($value, $pattern, $message = '') |
|
| 525 | { |
|
| @@ 733-742 (lines=10) @@ | ||
| 730 | } |
|
| 731 | } |
|
| 732 | ||
| 733 | public static function implementsInterface($value, $interface, $message = '') |
|
| 734 | { |
|
| 735 | if (!in_array($interface, class_implements($value))) { |
|
| 736 | static::reportInvalidArgument(sprintf( |
|
| 737 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 738 | static::valueToString($value), |
|
| 739 | static::valueToString($interface) |
|
| 740 | )); |
|
| 741 | } |
|
| 742 | } |
|
| 743 | ||
| 744 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 745 | { |
|