httpClient = $httpClient; } /** * Implement the METAR - Return the string * * @param $icao * * @throws \Exception * @throws \GuzzleHttp\Exception\GuzzleException * * @return string */ protected function metar($icao): string { $url = static::METAR_URL.$icao; try { $res = $this->httpClient->get($url, []); $xml = simplexml_load_string($res); if (\count($xml->data->METAR->raw_text) === 0) { return ''; } return $xml->data->METAR->raw_text->__toString(); } catch (\Exception $e) { Log::error('Error reading METAR: '.$e->getMessage()); throw $e; } } }