diff --git a/app/Support/Metar.php b/app/Support/Metar.php index 2d38be5a..7ed49663 100644 --- a/app/Support/Metar.php +++ b/app/Support/Metar.php @@ -751,6 +751,7 @@ class Metar implements \ArrayAccess * * @param mixed $part * + * @return bool * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue */ @@ -912,20 +913,15 @@ class Metar implements \ArrayAccess if (!empty($observed['runway'])) { $report = []; if ($observed['variable'] !== null) { - $unit = ' meters'; - if ($observed['variable'] <= 1) { - $unit = ' meter'; - } - - $report[] = $observed['variable'].$unit; - } elseif (null !== $observed['interval_min'] && null !== $observed['interval_max']) { + $report[] = $observed['variable']['nmi'].' nmi'; + } elseif ($observed['interval_min'] !== null && $observed['interval_max'] !== null) { if (isset(static::$rvr_prefix_codes[$observed['variable_prefix']])) { - $report[] = 'varying from a min. of '.$observed['interval_min'].' meters until a max. of '. + $report[] = 'varying from a min. of '.$observed['interval_min']['nmi'].' nmi until a max. of '. static::$rvr_prefix_codes[$observed['variable_prefix']].' that '. - $observed['interval_max'].' meters'; + $observed['interval_max']['nmi'].' nmi'; } else { - $report[] = 'varying from a min. of '.$observed['interval_min'].' meters until a max. of '. - $observed['interval_max'].' meters'; + $report[] = 'varying from a min. of '.$observed['interval_min']['nmi'].' nmi until a max. of '. + $observed['interval_max']['nmi'].' nmi'; } } diff --git a/tests/MetarTest.php b/tests/MetarTest.php index df259a35..ff46ced6 100644 --- a/tests/MetarTest.php +++ b/tests/MetarTest.php @@ -92,6 +92,15 @@ class MetarTest extends TestCase $this->assertNull($parsed['clouds'][3]['height']['ft']); } + public function testMetar3() + { + $metar = 'LEBL 310337Z 24006G18KT 210V320 1000 ' + .'R25R/P2000 R07L/1900N R07R/1700D R25L/1900N ' + .'+TSRA SCT006 BKN015 SCT030CB 22/21 Q1018 NOSIG'; + + $parsed = Metar::parse($metar); + } + public function testMetarTrends() { $metar =