Fix/metar reading (#354)
* Account for empty ICAO; added tests * Fix null returns * Fix typo in volume units display * Add version field for bug report template * Some more changes to the bug report template
This commit is contained in:
@@ -26,16 +26,16 @@ class AirportService extends Service
|
||||
*
|
||||
* @return Metar|null
|
||||
*/
|
||||
public function getMetar($icao): Metar
|
||||
public function getMetar($icao)
|
||||
{
|
||||
$metar = null;
|
||||
$wind = null;
|
||||
$raw_metar = $this->metarProvider->get_metar($icao);
|
||||
$icao = trim($icao);
|
||||
if ($icao === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$raw_metar = $this->metarProvider->get_metar($icao);
|
||||
if ($raw_metar && $raw_metar !== '') {
|
||||
return new Metar($raw_metar);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ class AviationWeather extends Metar
|
||||
*/
|
||||
protected function metar($icao): string
|
||||
{
|
||||
if ($icao === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$url = static::METAR_URL.$icao;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user