| @@ 588-597 (lines=10) @@ | ||
| 585 | } |
|
| 586 | } |
|
| 587 | ||
| 588 | public static function endsWith($value, $suffix, $message = '') |
|
| 589 | { |
|
| 590 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 591 | static::reportInvalidArgument(sprintf( |
|
| 592 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 593 | static::valueToString($value), |
|
| 594 | static::valueToString($suffix) |
|
| 595 | )); |
|
| 596 | } |
|
| 597 | } |
|
| 598 | ||
| 599 | public static function regex($value, $pattern, $message = '') |
|
| 600 | { |
|
| @@ 808-817 (lines=10) @@ | ||
| 805 | } |
|
| 806 | } |
|
| 807 | ||
| 808 | public static function implementsInterface($value, $interface, $message = '') |
|
| 809 | { |
|
| 810 | if (!in_array($interface, class_implements($value))) { |
|
| 811 | static::reportInvalidArgument(sprintf( |
|
| 812 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 813 | static::valueToString($value), |
|
| 814 | static::valueToString($interface) |
|
| 815 | )); |
|
| 816 | } |
|
| 817 | } |
|
| 818 | ||
| 819 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 820 | { |
|