phpvms/app/Services/AirportLookup/VaCentralLookup.php
Nabeel S 3d211535f7
Remove Google Analytics #728 (#745)
* Remove Google Analytics #728

* Remove config file

* Don't set the vacentral url
2020-06-04 10:36:55 -04:00

39 lines
781 B
PHP

<?php
namespace App\Services\AirportLookup;
use App\Contracts\AirportLookup;
use Illuminate\Support\Facades\Log;
use VaCentral\Contracts\IVaCentral;
use VaCentral\Exceptions\HttpException;
class VaCentralLookup extends AirportLookup
{
private $client;
public function __construct(IVaCentral $client)
{
$this->client = $client;
}
/**
* Lookup the information for an airport
*
* @param string $icao
*
* @return mixed
*/
public function getAirport($icao)
{
try {
$airport = $this->client->getAirport($icao);
$airport->location = $airport->city;
return $airport;
} catch (HttpException $e) {
Log::error($e);
return [];
}
}
}