| @@ 1254-1263 (lines=10) @@ | ||
| 1251 | * |
|
| 1252 | * @throws InvalidArgumentException |
|
| 1253 | */ |
|
| 1254 | public static function endsWith($value, $suffix, $message = '') |
|
| 1255 | { |
|
| 1256 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1257 | static::reportInvalidArgument(\sprintf( |
|
| 1258 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1259 | static::valueToString($value), |
|
| 1260 | static::valueToString($suffix) |
|
| 1261 | )); |
|
| 1262 | } |
|
| 1263 | } |
|
| 1264 | ||
| 1265 | /** |
|
| 1266 | * @psalm-pure |
|
| @@ 1689-1698 (lines=10) @@ | ||
| 1686 | * |
|
| 1687 | * @throws InvalidArgumentException |
|
| 1688 | */ |
|
| 1689 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1690 | { |
|
| 1691 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1692 | static::reportInvalidArgument(\sprintf( |
|
| 1693 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1694 | static::valueToString($value), |
|
| 1695 | static::valueToString($interface) |
|
| 1696 | )); |
|
| 1697 | } |
|
| 1698 | } |
|
| 1699 | ||
| 1700 | /** |
|
| 1701 | * @psalm-pure |
|