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:
Nabeel S
2019-08-08 17:41:53 -04:00
committed by GitHub
parent 5cafebe4d6
commit 47be7507f0
7 changed files with 86 additions and 13 deletions

View File

@@ -60,7 +60,7 @@
value: gallons
options: 'gallons,l=liters'
type: select
description: 'The units for fuel for display'
description: 'The units of volume for display'
- key: units.temperature
name: 'Temperature Units'
group: units

View File

@@ -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;
}
}

View File

@@ -35,6 +35,10 @@ class AviationWeather extends Metar
*/
protected function metar($icao): string
{
if ($icao === '') {
return '';
}
$url = static::METAR_URL.$icao;
try {