Replace METAR data with custom class

This commit is contained in:
Nabeel Shahzad
2018-04-07 09:05:06 -05:00
parent f4f41cd900
commit eae5989845
6 changed files with 151 additions and 163 deletions

View File

@@ -3,13 +3,7 @@
namespace App\Widgets;
use App\Interfaces\Widget;
use App\Support\Http;
use App\Support\MetarWrapper;
use App\Support\Units\Distance;
use App\Support\Units\Temperature;
use Illuminate\Support\Facades\Cache;
use MetarDecoder\MetarDecoder;
use SimpleXMLElement;
use App\Support\Metar;
/**
* This is a widget for the 3rd party CheckWX service
@@ -23,17 +17,6 @@ class Weather extends Widget
public const URL = 'https://avwx.rest/api/metar/';
/**
* Determine the category depending on the rules for visibility/ceiling
* https://www.aviationweather.gov/cva/help
* @param $metar
* @return string
*/
protected function determineCategory($metar): string
{
}
/**
* Attempt to get the data from the CheckWX API
*/
@@ -50,14 +33,12 @@ class Weather extends Widget
$raw_metar = $metar_class->get_metar($this->config['icao']);
if ($raw_metar && $raw_metar !== '') {
$metar = new MetarWrapper($raw_metar);
$wind = $metar->getWinds();
$metar = Metar::parse($raw_metar);
}
return view('widgets.weather', [
'config' => $this->config,
'metar' => $metar,
'wind' => $wind,
'unit_alt' => setting('units.altitude'),
'unit_dist' => setting('units.distance'),
'unit_temp' => setting('units.temperature'),