-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix reading of the METAR information for AviationWeather. Fix the DI * StyleCI fixes
- Loading branch information
Showing
11 changed files
with
122 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use App\Contracts\Metar; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class WeatherServiceProvider extends ServiceProvider | ||
{ | ||
public function boot(): void | ||
{ | ||
$this->app->bind( | ||
Metar::class, | ||
config('phpvms.metar') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
use App\Contracts\Metar as MetarProvider; | ||
use App\Contracts\Service; | ||
use App\Support\Metar; | ||
|
||
/** | ||
* Class AnalyticsService | ||
*/ | ||
class AirportService extends Service | ||
{ | ||
private $metarProvider; | ||
|
||
public function __construct( | ||
MetarProvider $metarProvider | ||
) { | ||
$this->metarProvider = $metarProvider; | ||
} | ||
|
||
/** | ||
* Return the METAR for a given airport | ||
* | ||
* @param $icao | ||
* | ||
* @return Metar|null | ||
*/ | ||
public function getMetar($icao): Metar | ||
{ | ||
$metar = null; | ||
$wind = null; | ||
$raw_metar = $this->metarProvider->get_metar($icao); | ||
|
||
if ($raw_metar && $raw_metar !== '') { | ||
return new Metar($raw_metar); | ||
} | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters