*/ public function ipLookup(string $ip): array { $response = Http::acceptJson()->get(sprintf('%s/%s?api-key=%s', $this->baseUrl, $ip, $this->apiKey)); /** @var array $json */ $json = $response->json() ?? []; if (! $response->ok()) { $message = array_key_exists('message', $json) ? $json['message'] : 'Unknown error'; return [ 'message' => $message, 'status' => $response->status(), ]; } return $json; } }