resolvers = $resolvers; } /** * @throws WrongIpException */ public function resolveIpLocation(string $ipAddress): array { $error = null; foreach ($this->resolvers as $resolver) { try { return $resolver->resolveIpLocation($ipAddress); } catch (WrongIpException $e) { $error = $e; } } // If this instruction is reached, it means no resolver was capable of resolving the address throw WrongIpException::fromIpAddress($ipAddress, $error); } }