| @@ 711-720 (lines=10) @@ | ||
| 708 | } |
|
| 709 | } |
|
| 710 | ||
| 711 | public static function endsWith($value, $suffix, $message = '') |
|
| 712 | { |
|
| 713 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
| 714 | static::reportInvalidArgument(sprintf( |
|
| 715 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 716 | static::valueToString($value), |
|
| 717 | static::valueToString($suffix) |
|
| 718 | )); |
|
| 719 | } |
|
| 720 | } |
|
| 721 | ||
| 722 | public static function regex($value, $pattern, $message = '') |
|
| 723 | { |
|
| @@ 953-962 (lines=10) @@ | ||
| 950 | } |
|
| 951 | } |
|
| 952 | ||
| 953 | public static function implementsInterface($value, $interface, $message = '') |
|
| 954 | { |
|
| 955 | if (!in_array($interface, class_implements($value))) { |
|
| 956 | static::reportInvalidArgument(sprintf( |
|
| 957 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 958 | static::valueToString($value), |
|
| 959 | static::valueToString($interface) |
|
| 960 | )); |
|
| 961 | } |
|
| 962 | } |
|
| 963 | ||
| 964 | public static function propertyExists($classOrObject, $property, $message = '') |
|
| 965 | { |
|