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