| @@ 1087-1096 (lines=10) @@ | ||
| 1084 | * |
|
| 1085 | * @throws InvalidArgumentException |
|
| 1086 | */ |
|
| 1087 | public static function endsWith($value, $suffix, $message = '') |
|
| 1088 | { |
|
| 1089 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1090 | static::reportInvalidArgument(\sprintf( |
|
| 1091 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1092 | static::valueToString($value), |
|
| 1093 | static::valueToString($suffix) |
|
| 1094 | )); |
|
| 1095 | } |
|
| 1096 | } |
|
| 1097 | ||
| 1098 | /** |
|
| 1099 | * @param mixed $value |
|
| @@ 1494-1503 (lines=10) @@ | ||
| 1491 | * |
|
| 1492 | * @throws InvalidArgumentException |
|
| 1493 | */ |
|
| 1494 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1495 | { |
|
| 1496 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1497 | static::reportInvalidArgument(\sprintf( |
|
| 1498 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1499 | static::valueToString($value), |
|
| 1500 | static::valueToString($interface) |
|
| 1501 | )); |
|
| 1502 | } |
|
| 1503 | } |
|
| 1504 | ||
| 1505 | /** |
|
| 1506 | * @param string|object $classOrObject |
|