380 vacentral library (#381)
* Update vaCentral library for new API server format * Formatting * Remove missing/unused import
This commit is contained in:
@@ -4,11 +4,18 @@ namespace App\Services\AirportLookup;
|
||||
|
||||
use App\Contracts\AirportLookup;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use VaCentral\Airport;
|
||||
use VaCentral\HttpException;
|
||||
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
|
||||
*
|
||||
@@ -19,10 +26,12 @@ class VaCentralLookup extends AirportLookup
|
||||
public function getAirport($icao)
|
||||
{
|
||||
try {
|
||||
return Airport::get($icao);
|
||||
$airport = $this->client->getAirport($icao);
|
||||
$airport->location = $airport->city;
|
||||
return $airport;
|
||||
} catch (HttpException $e) {
|
||||
Log::error($e);
|
||||
return;
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user