| @@ 943-952 (lines=10) @@ | ||
| 940 | } |
|
| 941 | } |
|
| 942 | ||
| 943 | public static function implementsInterface($value, $interface, $message = '') |
|
| 944 | { |
|
| 945 | if (!in_array($interface, class_implements($value))) { |
|
| 946 | static::reportInvalidArgument(sprintf( |
|
| 947 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 948 | static::valueToString($value), |
|
| 949 | static::valueToString($interface) |
|
| 950 | )); |
|
| 951 | } |
|
| 952 | } |
|
| 953 | ||
| 954 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 955 | { |
|
| @@ 701-710 (lines=10) @@ | ||
| 698 | } |
|
| 699 | } |
|
| 700 | ||
| 701 | public static function endsWith($value, $suffix, $message = '') |
|
| 702 | { |
|
| 703 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 704 | static::reportInvalidArgument(sprintf( |
|
| 705 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 706 | static::valueToString($value), |
|
| 707 | static::valueToString($suffix) |
|
| 708 | )); |
|
| 709 | } |
|
| 710 | } |
|
| 711 | ||
| 712 | public static function regex($value, $pattern, $message = '') |
|
| 713 | { |
|