| @@ 1078-1087 (lines=10) @@ | ||
| 1075 | * |
|
| 1076 | * @throws InvalidArgumentException |
|
| 1077 | */ |
|
| 1078 | public static function endsWith($value, $suffix, $message = '') |
|
| 1079 | { |
|
| 1080 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1081 | static::reportInvalidArgument(\sprintf( |
|
| 1082 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1083 | static::valueToString($value), |
|
| 1084 | static::valueToString($suffix) |
|
| 1085 | )); |
|
| 1086 | } |
|
| 1087 | } |
|
| 1088 | ||
| 1089 | /** |
|
| 1090 | * @param mixed $value |
|
| @@ 1481-1490 (lines=10) @@ | ||
| 1478 | * |
|
| 1479 | * @throws InvalidArgumentException |
|
| 1480 | */ |
|
| 1481 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1482 | { |
|
| 1483 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1484 | static::reportInvalidArgument(\sprintf( |
|
| 1485 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1486 | static::valueToString($value), |
|
| 1487 | static::valueToString($interface) |
|
| 1488 | )); |
|
| 1489 | } |
|
| 1490 | } |
|
| 1491 | ||
| 1492 | /** |
|
| 1493 | * @param string|object $classOrObject |
|