httpClient = $httpClient; } /** * @param string $ipAddress * @return array * @throws WrongIpException */ public function resolveIpLocation(string $ipAddress): array { try { $response = $this->httpClient->get(sprintf(self::SERVICE_PATTERN, $ipAddress)); return json_decode((string) $response->getBody(), true); } catch (GuzzleException $e) { throw WrongIpException::fromIpAddress($ipAddress, $e); } } }