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