Code cleanup from inspection results
This commit is contained in:
@@ -241,7 +241,7 @@ class AcarsReplay extends Command
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$files = $this->argument('files');
|
$files = $this->argument('files');
|
||||||
$manual_mode = $this->option('manual');
|
$manual_mode = $this->option('manual');
|
||||||
@@ -249,6 +249,7 @@ class AcarsReplay extends Command
|
|||||||
if ($this->option('write-all')) {
|
if ($this->option('write-all')) {
|
||||||
$this->info('In "dump-all" mode, just writing it all in');
|
$this->info('In "dump-all" mode, just writing it all in');
|
||||||
} else {
|
} else {
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if (!$manual_mode) {
|
if (!$manual_mode) {
|
||||||
$this->info('Going to send updates every 10s');
|
$this->info('Going to send updates every 10s');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ComposerCommand extends Command
|
|||||||
protected function postUpdate(): void
|
protected function postUpdate(): void
|
||||||
{
|
{
|
||||||
if (config('app.env') === 'dev') {
|
if (config('app.env') === 'dev') {
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
||||||
Artisan::call('ide-helper:generate');
|
Artisan::call('ide-helper:generate');
|
||||||
Artisan::call('ide-helper:meta');
|
Artisan::call('ide-helper:meta');
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class Version extends Command
|
|||||||
* Create the version number that gets written out
|
* Create the version number that gets written out
|
||||||
*
|
*
|
||||||
* @param mixed $cfg
|
* @param mixed $cfg
|
||||||
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
protected function createVersionNumber($cfg)
|
protected function createVersionNumber($cfg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,16 +14,6 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|||||||
*/
|
*/
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
protected $commands = [
|
|
||||||
/*Commands\AcarsReplay::class,
|
|
||||||
Commands\CreateDatabase::class,
|
|
||||||
Commands\DevCommands::class,
|
|
||||||
Commands\YamlImport::class,
|
|
||||||
Commands\ImportFromClassic::class,
|
|
||||||
Commands\NavdataImport::class,
|
|
||||||
Commands\TestApi::class,*/
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the application's command schedule.
|
* Define the application's command schedule.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Importer
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $creds = [];
|
private $creds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold the instance of the console logger
|
* Hold the instance of the console logger
|
||||||
@@ -55,8 +55,8 @@ class Importer
|
|||||||
/**
|
/**
|
||||||
* CONSTANTS
|
* CONSTANTS
|
||||||
*/
|
*/
|
||||||
const BATCH_READ_ROWS = 300;
|
public const BATCH_READ_ROWS = 300;
|
||||||
const SUBFLEET_NAME = 'Imported Aircraft';
|
public const SUBFLEET_NAME = 'Imported Aircraft';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Importer constructor.
|
* Importer constructor.
|
||||||
@@ -140,11 +140,12 @@ class Importer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $message
|
* @param string|array $message
|
||||||
*/
|
*/
|
||||||
protected function info($message)
|
protected function info($message)
|
||||||
{
|
{
|
||||||
if (\is_array($message)) {
|
if (\is_array($message)) {
|
||||||
|
/** @noinspection ForgottenDebugOutputInspection */
|
||||||
print_r($message);
|
print_r($message);
|
||||||
} else {
|
} else {
|
||||||
$this->log->writeln('<info>'.$message.'</info>');
|
$this->log->writeln('<info>'.$message.'</info>');
|
||||||
|
|||||||
@@ -28,21 +28,6 @@ class Handler extends ExceptionHandler
|
|||||||
\Illuminate\Validation\ValidationException::class,
|
\Illuminate\Validation\ValidationException::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Report or log an exception.
|
|
||||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
|
||||||
*
|
|
||||||
* @param \Exception $exception
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function report(Exception $exception)
|
|
||||||
{
|
|
||||||
parent::report($exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an error message
|
* Create an error message
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Utils extends Facade
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected static function getFacadeAccessor()
|
protected static function getFacadeAccessor(): string
|
||||||
{
|
{
|
||||||
return 'utils';
|
return 'utils';
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ class Utils extends Facade
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function isObject($obj)
|
public static function isObject($obj): bool
|
||||||
{
|
{
|
||||||
if (!$obj) {
|
if (!$obj) {
|
||||||
return false;
|
return false;
|
||||||
@@ -42,14 +42,15 @@ class Utils extends Facade
|
|||||||
* Download a URI. If a file is given, it will save the downloaded
|
* Download a URI. If a file is given, it will save the downloaded
|
||||||
* content into that file
|
* content into that file
|
||||||
*
|
*
|
||||||
* @param $uri
|
* @param string $uri
|
||||||
* @param null $file
|
* @param null $file
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function downloadUrl($uri, $file = null)
|
public static function downloadUrl($uri, $file = null): string
|
||||||
{
|
{
|
||||||
$opts = [];
|
$opts = [];
|
||||||
if ($file !== null) {
|
if ($file !== null) {
|
||||||
@@ -72,12 +73,16 @@ class Utils extends Facade
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function generateApiKey()
|
public static function generateApiKey(): string
|
||||||
{
|
{
|
||||||
$key = substr(sha1(time().mt_rand()), 0, 20);
|
$key = substr(sha1(time().mt_rand()), 0, 20);
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $minutes
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function minutesToTimeParts($minutes): array
|
public static function minutesToTimeParts($minutes): array
|
||||||
{
|
{
|
||||||
$hours = floor($minutes / 60);
|
$hours = floor($minutes / 60);
|
||||||
@@ -95,9 +100,10 @@ class Utils extends Facade
|
|||||||
/**
|
/**
|
||||||
* Convert seconds to an array of hours, minutes, seconds
|
* Convert seconds to an array of hours, minutes, seconds
|
||||||
*
|
*
|
||||||
* @param $seconds
|
* @param int $seconds
|
||||||
*
|
*
|
||||||
* @return array['h', 'm', 's']
|
* @return array['h', 'm', 's']
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function secondsToTimeParts($seconds): array
|
public static function secondsToTimeParts($seconds): array
|
||||||
{
|
{
|
||||||
@@ -117,10 +123,11 @@ class Utils extends Facade
|
|||||||
/**
|
/**
|
||||||
* Convert seconds to HH MM format
|
* Convert seconds to HH MM format
|
||||||
*
|
*
|
||||||
* @param $seconds
|
* @param int $seconds
|
||||||
* @param bool $incl_sec
|
* @param bool $incl_sec
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function secondsToTimeString($seconds, $incl_sec = false): string
|
public static function secondsToTimeString($seconds, $incl_sec = false): string
|
||||||
{
|
{
|
||||||
@@ -191,7 +198,7 @@ class Utils extends Facade
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function setDays(int $datefield, array $day_enums)
|
public static function setDays(int $datefield, array $day_enums): int
|
||||||
{
|
{
|
||||||
foreach ($day_enums as $day) {
|
foreach ($day_enums as $day) {
|
||||||
$datefield |= $day;
|
$datefield |= $day;
|
||||||
@@ -208,7 +215,7 @@ class Utils extends Facade
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function hasDay(int $datefield, int $day_enum)
|
public static function hasDay(int $datefield, int $day_enum): bool
|
||||||
{
|
{
|
||||||
return ($datefield & $day_enum) === $datefield;
|
return ($datefield & $day_enum) === $datefield;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ class AircraftController extends Controller
|
|||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @throws \Prettus\Repository\Exceptions\RepositoryException
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
@@ -101,6 +99,8 @@ class AircraftController extends Controller
|
|||||||
* Display the specified Aircraft.
|
* Display the specified Aircraft.
|
||||||
*
|
*
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
@@ -120,6 +120,8 @@ class AircraftController extends Controller
|
|||||||
* Show the form for editing the specified Aircraft.
|
* Show the form for editing the specified Aircraft.
|
||||||
*
|
*
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
@@ -143,6 +145,8 @@ class AircraftController extends Controller
|
|||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
*
|
*
|
||||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function update($id, UpdateAircraftRequest $request)
|
public function update($id, UpdateAircraftRequest $request)
|
||||||
{
|
{
|
||||||
@@ -164,6 +168,8 @@ class AircraftController extends Controller
|
|||||||
* Remove the specified Aircraft from storage.
|
* Remove the specified Aircraft from storage.
|
||||||
*
|
*
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
@@ -187,7 +193,7 @@ class AircraftController extends Controller
|
|||||||
*
|
*
|
||||||
* @throws \League\Csv\Exception
|
* @throws \League\Csv\Exception
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function export(Request $request)
|
public function export(Request $request)
|
||||||
{
|
{
|
||||||
@@ -207,7 +213,7 @@ class AircraftController extends Controller
|
|||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function import(Request $request)
|
public function import(Request $request)
|
||||||
{
|
{
|
||||||
@@ -254,7 +260,7 @@ class AircraftController extends Controller
|
|||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function expenses($id, Request $request)
|
public function expenses($id, Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class DashboardController extends Controller
|
|||||||
* S3 and then using the semver library to do the comparison. Just show
|
* S3 and then using the semver library to do the comparison. Just show
|
||||||
* a session flash file on this page that'll get cleared right away
|
* a session flash file on this page that'll get cleared right away
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
*/
|
*/
|
||||||
protected function checkNewVersion()
|
protected function checkNewVersion()
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,10 @@ class DashboardController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show the admin dashboard
|
* Show the admin dashboard
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class FlightController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log::info('PIREP Custom Fields', $custom_fields);
|
Log::info('PIREP Custom Fields', $custom_fields);
|
||||||
$this->flightSvc->updateCustomFields($flight->id, $custom_fields);
|
$this->flightSvc->updateCustomFields($flight, $custom_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -483,6 +483,9 @@ class FlightController extends Controller
|
|||||||
* Get all the fares that haven't been assigned to a given subfleet
|
* Get all the fares that haven't been assigned to a given subfleet
|
||||||
*
|
*
|
||||||
* @param mixed $flight
|
* @param mixed $flight
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getAvailFares($flight)
|
protected function getAvailFares($flight)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class PirepFieldController extends Controller
|
|||||||
*
|
*
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
*
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||||
*/
|
*/
|
||||||
public function update($id, UpdatePirepFieldRequest $request)
|
public function update($id, UpdatePirepFieldRequest $request)
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class SubfleetController extends Controller
|
|||||||
* Get all the fares that haven't been assigned to a given subfleet
|
* Get all the fares that haven't been assigned to a given subfleet
|
||||||
*
|
*
|
||||||
* @param mixed $subfleet
|
* @param mixed $subfleet
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getAvailFares($subfleet)
|
protected function getAvailFares($subfleet)
|
||||||
{
|
{
|
||||||
@@ -268,6 +269,7 @@ class SubfleetController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
*/
|
*/
|
||||||
public function export(Request $request)
|
public function export(Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use App\Models\Pirep;
|
|||||||
use App\Repositories\AcarsRepository;
|
use App\Repositories\AcarsRepository;
|
||||||
use App\Repositories\PirepRepository;
|
use App\Repositories\PirepRepository;
|
||||||
use App\Services\GeoService;
|
use App\Services\GeoService;
|
||||||
use App\Services\PirepService;
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -29,7 +28,6 @@ class AcarsController extends Controller
|
|||||||
private $acarsRepo;
|
private $acarsRepo;
|
||||||
private $geoSvc;
|
private $geoSvc;
|
||||||
private $pirepRepo;
|
private $pirepRepo;
|
||||||
private $pirepSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AcarsController constructor.
|
* AcarsController constructor.
|
||||||
@@ -37,18 +35,15 @@ class AcarsController extends Controller
|
|||||||
* @param AcarsRepository $acarsRepo
|
* @param AcarsRepository $acarsRepo
|
||||||
* @param GeoService $geoSvc
|
* @param GeoService $geoSvc
|
||||||
* @param PirepRepository $pirepRepo
|
* @param PirepRepository $pirepRepo
|
||||||
* @param PirepService $pirepSvc
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AcarsRepository $acarsRepo,
|
AcarsRepository $acarsRepo,
|
||||||
GeoService $geoSvc,
|
GeoService $geoSvc,
|
||||||
PirepRepository $pirepRepo,
|
PirepRepository $pirepRepo
|
||||||
PirepService $pirepSvc
|
|
||||||
) {
|
) {
|
||||||
$this->geoSvc = $geoSvc;
|
$this->geoSvc = $geoSvc;
|
||||||
$this->acarsRepo = $acarsRepo;
|
$this->acarsRepo = $acarsRepo;
|
||||||
$this->pirepRepo = $pirepRepo;
|
$this->pirepRepo = $pirepRepo;
|
||||||
$this->pirepSvc = $pirepSvc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ class PirepController extends Controller
|
|||||||
$pirep = new Pirep($attrs);
|
$pirep = new Pirep($attrs);
|
||||||
|
|
||||||
// See if this user is at the current airport
|
// See if this user is at the current airport
|
||||||
|
/** @noinspection NotOptimalIfConditionsInspection */
|
||||||
if (setting('pilots.only_flights_from_current')
|
if (setting('pilots.only_flights_from_current')
|
||||||
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
|
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
|
||||||
throw new UserNotAtAirport();
|
throw new UserNotAtAirport();
|
||||||
@@ -234,6 +235,7 @@ class PirepController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if this aircraft is at the departure airport
|
// See if this aircraft is at the departure airport
|
||||||
|
/** @noinspection NotOptimalIfConditionsInspection */
|
||||||
if (setting('pireps.only_aircraft_at_dpt_airport')
|
if (setting('pireps.only_aircraft_at_dpt_airport')
|
||||||
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
|
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
|
||||||
throw new AircraftNotAtAirport();
|
throw new AircraftNotAtAirport();
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class UserController extends Controller
|
|||||||
private $flightRepo;
|
private $flightRepo;
|
||||||
private $flightSvc;
|
private $flightSvc;
|
||||||
private $pirepRepo;
|
private $pirepRepo;
|
||||||
private $subfleetRepo;
|
|
||||||
private $userRepo;
|
private $userRepo;
|
||||||
private $userSvc;
|
private $userSvc;
|
||||||
|
|
||||||
@@ -39,7 +38,6 @@ class UserController extends Controller
|
|||||||
* @param FlightRepository $flightRepo
|
* @param FlightRepository $flightRepo
|
||||||
* @param FlightService $flightSvc
|
* @param FlightService $flightSvc
|
||||||
* @param PirepRepository $pirepRepo
|
* @param PirepRepository $pirepRepo
|
||||||
* @param SubfleetRepository $subfleetRepo
|
|
||||||
* @param UserRepository $userRepo
|
* @param UserRepository $userRepo
|
||||||
* @param UserService $userSvc
|
* @param UserService $userSvc
|
||||||
*/
|
*/
|
||||||
@@ -47,14 +45,12 @@ class UserController extends Controller
|
|||||||
FlightRepository $flightRepo,
|
FlightRepository $flightRepo,
|
||||||
FlightService $flightSvc,
|
FlightService $flightSvc,
|
||||||
PirepRepository $pirepRepo,
|
PirepRepository $pirepRepo,
|
||||||
SubfleetRepository $subfleetRepo,
|
|
||||||
UserRepository $userRepo,
|
UserRepository $userRepo,
|
||||||
UserService $userSvc
|
UserService $userSvc
|
||||||
) {
|
) {
|
||||||
$this->flightRepo = $flightRepo;
|
$this->flightRepo = $flightRepo;
|
||||||
$this->flightSvc = $flightSvc;
|
$this->flightSvc = $flightSvc;
|
||||||
$this->pirepRepo = $pirepRepo;
|
$this->pirepRepo = $pirepRepo;
|
||||||
$this->subfleetRepo = $subfleetRepo;
|
|
||||||
$this->userRepo = $userRepo;
|
$this->userRepo = $userRepo;
|
||||||
$this->userSvc = $userSvc;
|
$this->userSvc = $userSvc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ class AirportController extends Controller
|
|||||||
* Show the airport
|
* Show the airport
|
||||||
*
|
*
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function show($id, Request $request)
|
public function show($id, Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ class DownloadController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show the application dashboard.
|
* Show the application dashboard.
|
||||||
*
|
*
|
||||||
* @param mixed $id
|
* @param string $id
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\StreamedResponse
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ class PirepController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is the aircraft in the right place?
|
// is the aircraft in the right place?
|
||||||
|
/** @noinspection NotOptimalIfConditionsInspection */
|
||||||
if (setting('pireps.only_aircraft_at_dpt_airport')
|
if (setting('pireps.only_aircraft_at_dpt_airport')
|
||||||
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
|
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
|
||||||
return $this->flashError(
|
return $this->flashError(
|
||||||
@@ -356,7 +357,7 @@ class PirepController extends Controller
|
|||||||
|
|
||||||
// set the custom fields
|
// set the custom fields
|
||||||
foreach ($pirep->fields as $field) {
|
foreach ($pirep->fields as $field) {
|
||||||
if ($field->slug == null) {
|
if ($field->slug === null) {
|
||||||
$field->slug = str_slug($field->name);
|
$field->slug = str_slug($field->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,5 @@ class EncryptCookies extends BaseEncrypter
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [];
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class MeasureExecutionTime
|
|||||||
{
|
{
|
||||||
// Get the response
|
// Get the response
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
if (!defined('LUMEN_START')) {
|
if (!\defined('LUMEN_START')) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,5 @@ class VerifyCsrfToken extends BaseVerifier
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [];
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,11 @@ namespace App\Http\Requests\Acars;
|
|||||||
use App\Interfaces\FormRequest;
|
use App\Interfaces\FormRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class FileRequest
|
* Class CommentRequest
|
||||||
*/
|
*/
|
||||||
class CommentRequest extends FormRequest
|
class CommentRequest extends FormRequest
|
||||||
{
|
{
|
||||||
public function authorize()
|
public function rules(): array
|
||||||
{
|
|
||||||
return true; // Anyone can comment
|
|
||||||
}
|
|
||||||
|
|
||||||
public function rules()
|
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'comment' => 'required',
|
'comment' => 'required',
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Requests\Acars;
|
namespace App\Http\Requests\Acars;
|
||||||
|
|
||||||
use App\Interfaces\FormRequest;
|
use App\Interfaces\FormRequest;
|
||||||
use App\Models\Acars;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Requests\Acars;
|
namespace App\Http\Requests\Acars;
|
||||||
|
|
||||||
use App\Interfaces\FormRequest;
|
use App\Interfaces\FormRequest;
|
||||||
use App\Models\Pirep;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PrefileRequest
|
* Class PrefileRequest
|
||||||
|
|||||||
@@ -10,15 +10,5 @@ use Illuminate\Http\Resources\Json\Resource;
|
|||||||
*/
|
*/
|
||||||
class AcarsLog extends Resource
|
class AcarsLog extends Resource
|
||||||
{
|
{
|
||||||
public function toArray($request)
|
|
||||||
{
|
|
||||||
return parent::toArray($request);
|
|
||||||
/*return [
|
|
||||||
'id' => $this->id,
|
|
||||||
'name' => $this->name,
|
|
||||||
'log' => $this->log,
|
|
||||||
'lat' => $this->lat,
|
|
||||||
'lon' => $this->lon,
|
|
||||||
];*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,5 @@ use Illuminate\Http\Resources\Json\Resource;
|
|||||||
*/
|
*/
|
||||||
class AcarsRoute extends Resource
|
class AcarsRoute extends Resource
|
||||||
{
|
{
|
||||||
public function toArray($request)
|
|
||||||
{
|
|
||||||
return parent::toArray($request);
|
|
||||||
/*return [
|
|
||||||
'id' => $this->id,
|
|
||||||
'name' => $this->name,
|
|
||||||
'order' => $this->order,
|
|
||||||
'nav_type' => $this->nav_type,
|
|
||||||
'lat' => $this->lat,
|
|
||||||
'lon' => $this->lon,
|
|
||||||
];*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,5 @@ use Illuminate\Http\Resources\Json\Resource;
|
|||||||
|
|
||||||
class Aircraft extends Resource
|
class Aircraft extends Resource
|
||||||
{
|
{
|
||||||
public function toArray($request)
|
|
||||||
{
|
|
||||||
return parent::toArray($request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,5 @@ use Illuminate\Http\Resources\Json\Resource;
|
|||||||
|
|
||||||
class Airport extends Resource
|
class Airport extends Resource
|
||||||
{
|
{
|
||||||
public function toArray($request)
|
|
||||||
{
|
|
||||||
return parent::toArray($request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,5 @@ use Illuminate\Http\Resources\Json\Resource;
|
|||||||
*/
|
*/
|
||||||
class Response extends Resource
|
class Response extends Resource
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Transform the resource into an array.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function toArray($request)
|
|
||||||
{
|
|
||||||
return parent::toArray($request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ abstract class Award
|
|||||||
$e->getTrace()
|
$e->getTrace()
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $award;
|
return $award;
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
|
|||||||
$fields[$field] = $request->input($field);
|
$fields[$field] = $request->input($field);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if (array_key_exists($field, $request)) {
|
if (array_key_exists($field, $request)) {
|
||||||
$fields[$field] = $request[$field];
|
$fields[$field] = $request[$field];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ abstract class Enum
|
|||||||
*/
|
*/
|
||||||
final public function equals(self $enum): bool
|
final public function equals(self $enum): bool
|
||||||
{
|
{
|
||||||
return $this->getValue() === $enum->getValue() && get_called_class() == get_class($enum);
|
return $this->getValue() === $enum->getValue() && static::class === \get_class($enum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,7 +161,7 @@ abstract class Enum
|
|||||||
}
|
}
|
||||||
|
|
||||||
throw new \BadMethodCallException(
|
throw new \BadMethodCallException(
|
||||||
"No static method or enum constant '$name' in class ".get_called_class()
|
"No static method or enum constant '$name' in class ".static::class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class ImportExport
|
|||||||
*
|
*
|
||||||
* @param $code
|
* @param $code
|
||||||
*
|
*
|
||||||
* @return Airline
|
* @return \Illuminate\Database\Eloquent\Model
|
||||||
*/
|
*/
|
||||||
public function getAirline($code)
|
public function getAirline($code)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository
|
|||||||
*
|
*
|
||||||
* @return mixed|null
|
* @return mixed|null
|
||||||
*/
|
*/
|
||||||
public function findWithoutFail($id, $columns = ['*'])
|
public function findWithoutFail($id, array $columns = ['*'])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->find($id, $columns);
|
return $this->find($id, $columns);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Acars extends Model
|
|||||||
public function getDistanceAttribute()
|
public function getDistanceAttribute()
|
||||||
{
|
{
|
||||||
if (!array_key_exists('distance', $this->attributes)) {
|
if (!array_key_exists('distance', $this->attributes)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -127,7 +127,7 @@ class Acars extends Model
|
|||||||
public function getFuelAttribute()
|
public function getFuelAttribute()
|
||||||
{
|
{
|
||||||
if (!array_key_exists('fuel', $this->attributes)) {
|
if (!array_key_exists('fuel', $this->attributes)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ class Award extends Model
|
|||||||
/**
|
/**
|
||||||
* Get the referring object
|
* Get the referring object
|
||||||
*
|
*
|
||||||
* @param Award|null $award
|
* @param self $award
|
||||||
* @param User|null $user
|
* @param User|null $user
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ class Flight extends Model
|
|||||||
*/
|
*/
|
||||||
public static function findByDays(array $days)
|
public static function findByDays(array $days)
|
||||||
{
|
{
|
||||||
|
/** @noinspection DynamicInvocationViaScopeResolutionInspection */
|
||||||
$flights = self::where('active', true);
|
$flights = self::where('active', true);
|
||||||
foreach ($days as $day) {
|
foreach ($days as $day) {
|
||||||
$flights = $flights->where('days', '&', $day);
|
$flights = $flights->where('days', '&', $day);
|
||||||
@@ -139,7 +140,7 @@ class Flight extends Model
|
|||||||
public function getDistanceAttribute()
|
public function getDistanceAttribute()
|
||||||
{
|
{
|
||||||
if (!array_key_exists('distance', $this->attributes)) {
|
if (!array_key_exists('distance', $this->attributes)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class AircraftObserver
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Aircraft $aircraft
|
* @param Aircraft $aircraft
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function creating(Aircraft $aircraft): void
|
public function creating(Aircraft $aircraft): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
|||||||
* @property string flight_number
|
* @property string flight_number
|
||||||
* @property string route_code
|
* @property string route_code
|
||||||
* @property string route_leg
|
* @property string route_leg
|
||||||
* @property int airline_id
|
* @property int airline_id
|
||||||
* @property int user_id
|
* @property int user_id
|
||||||
* @property int aircraft_id
|
* @property int aircraft_id
|
||||||
* @property Aircraft aircraft
|
* @property Aircraft aircraft
|
||||||
* @property Airline airline
|
* @property Airline airline
|
||||||
* @property Airport arr_airport
|
* @property Airport arr_airport
|
||||||
@@ -32,13 +32,13 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
|||||||
* @property string dpt_airport_id
|
* @property string dpt_airport_id
|
||||||
* @property Carbon block_off_time
|
* @property Carbon block_off_time
|
||||||
* @property Carbon block_on_time
|
* @property Carbon block_on_time
|
||||||
* @property int block_time
|
* @property int block_time
|
||||||
* @property int flight_time In minutes
|
* @property int flight_time In minutes
|
||||||
* @property int planned_flight_time
|
* @property int planned_flight_time
|
||||||
* @property float distance
|
* @property float distance
|
||||||
* @property float planned_distance
|
* @property float planned_distance
|
||||||
* @property string route
|
* @property string route
|
||||||
* @property int score
|
* @property int score
|
||||||
* @property User user
|
* @property User user
|
||||||
* @property Flight|null flight
|
* @property Flight|null flight
|
||||||
* @property Collection fields
|
* @property Collection fields
|
||||||
@@ -50,6 +50,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
|||||||
* @property bool read_only
|
* @property bool read_only
|
||||||
* @property Acars position
|
* @property Acars position
|
||||||
* @property Acars[] acars
|
* @property Acars[] acars
|
||||||
|
* @property mixed cancelled
|
||||||
*/
|
*/
|
||||||
class Pirep extends Model
|
class Pirep extends Model
|
||||||
{
|
{
|
||||||
@@ -160,25 +161,29 @@ class Pirep extends Model
|
|||||||
/**
|
/**
|
||||||
* Return the block off time in carbon format
|
* Return the block off time in carbon format
|
||||||
*
|
*
|
||||||
* @return Carbon
|
* @return Carbon|null
|
||||||
*/
|
*/
|
||||||
public function getBlockOffTimeAttribute()
|
public function getBlockOffTimeAttribute()
|
||||||
{
|
{
|
||||||
if (array_key_exists('block_off_time', $this->attributes)) {
|
if (array_key_exists('block_off_time', $this->attributes)) {
|
||||||
return new Carbon($this->attributes['block_off_time']);
|
return new Carbon($this->attributes['block_off_time']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the block on time
|
* Return the block on time
|
||||||
*
|
*
|
||||||
* @return Carbon
|
* @return Carbon|null
|
||||||
*/
|
*/
|
||||||
public function getBlockOnTimeAttribute()
|
public function getBlockOnTimeAttribute()
|
||||||
{
|
{
|
||||||
if (array_key_exists('block_on_time', $this->attributes)) {
|
if (array_key_exists('block_on_time', $this->attributes)) {
|
||||||
return new Carbon($this->attributes['block_on_time']);
|
return new Carbon($this->attributes['block_on_time']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,6 +196,8 @@ class Pirep extends Model
|
|||||||
if (array_key_exists('submitted_at', $this->attributes)) {
|
if (array_key_exists('submitted_at', $this->attributes)) {
|
||||||
return new Carbon($this->attributes['submitted_at']);
|
return new Carbon($this->attributes['submitted_at']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,7 +208,7 @@ class Pirep extends Model
|
|||||||
public function getDistanceAttribute()
|
public function getDistanceAttribute()
|
||||||
{
|
{
|
||||||
if (!array_key_exists('distance', $this->attributes)) {
|
if (!array_key_exists('distance', $this->attributes)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -249,7 +256,7 @@ class Pirep extends Model
|
|||||||
public function getFuelUsedAttribute()
|
public function getFuelUsedAttribute()
|
||||||
{
|
{
|
||||||
if (!array_key_exists('fuel_used', $this->attributes)) {
|
if (!array_key_exists('fuel_used', $this->attributes)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -271,7 +278,7 @@ class Pirep extends Model
|
|||||||
public function getPlannedDistanceAttribute()
|
public function getPlannedDistanceAttribute()
|
||||||
{
|
{
|
||||||
if (!array_key_exists('planned_distance', $this->attributes)) {
|
if (!array_key_exists('planned_distance', $this->attributes)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -401,7 +408,7 @@ class Pirep extends Model
|
|||||||
/**
|
/**
|
||||||
* Return if this is cancelled or not
|
* Return if this is cancelled or not
|
||||||
*/
|
*/
|
||||||
public function getCancelledAttribute()
|
public function getCancelledAttribute(): bool
|
||||||
{
|
{
|
||||||
return $this->state === PirepState::CANCELLED;
|
return $this->state === PirepState::CANCELLED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
if ($this->app->environment() === 'dev') {
|
if ($this->app->environment() === 'dev') {
|
||||||
// Only load the IDE helper if it's included. This lets use distribute the
|
// Only load the IDE helper if it's included. This lets use distribute the
|
||||||
// package without any dev dependencies
|
// package without any dev dependencies
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
||||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,18 +16,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected $namespace = 'App\Http\Controllers';
|
protected $namespace = 'App\Http\Controllers';
|
||||||
|
|
||||||
/**
|
|
||||||
* Define your route model bindings, pattern filters, etc.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
|
|
||||||
parent::boot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the routes for the application.
|
* Define the routes for the application.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -51,25 +51,15 @@ class SettingRepository extends Repository implements CacheableInterface
|
|||||||
case 'bool':
|
case 'bool':
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$value = $setting->value;
|
$value = $setting->value;
|
||||||
if ($value === 'true' || $value === '1') {
|
return $value === 'true' || $value === '1' || $value === 1;
|
||||||
$value = true;
|
|
||||||
} elseif ($value === 'false' || $value === '0') {
|
|
||||||
$value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (bool) $value;
|
|
||||||
break;
|
|
||||||
case 'date':
|
case 'date':
|
||||||
return Carbon::parse($setting->value);
|
return Carbon::parse($setting->value);
|
||||||
break;
|
|
||||||
case 'int':
|
case 'int':
|
||||||
case 'integer':
|
case 'integer':
|
||||||
case 'number':
|
case 'number':
|
||||||
return (int) $setting->value;
|
return (int) $setting->value;
|
||||||
break;
|
|
||||||
case 'float':
|
case 'float':
|
||||||
return (float) $setting->value;
|
return (float) $setting->value;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return $setting->value;
|
return $setting->value;
|
||||||
}
|
}
|
||||||
@@ -80,6 +70,7 @@ class SettingRepository extends Repository implements CacheableInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param mixed $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function save($key, $value)
|
public function save($key, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class DatabaseService extends Service
|
|||||||
// see if this table uses a UUID as the PK
|
// see if this table uses a UUID as the PK
|
||||||
// if no ID is specified
|
// if no ID is specified
|
||||||
if (\in_array($table, $this->uuid_tables, true)) {
|
if (\in_array($table, $this->uuid_tables, true)) {
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if (!array_key_exists('id', $row)) {
|
if (!array_key_exists('id', $row)) {
|
||||||
$row['id'] = Uuid::generate()->string;
|
$row['id'] = Uuid::generate()->string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class FareService extends Service
|
|||||||
$subfleet->fares()->syncWithoutDetaching([$fare->id]);
|
$subfleet->fares()->syncWithoutDetaching([$fare->id]);
|
||||||
|
|
||||||
// modify any pivot values?
|
// modify any pivot values?
|
||||||
if (count($override) > 0) {
|
if (\count($override) > 0) {
|
||||||
$subfleet->fares()->updateExistingPivot($fare->id, $override);
|
$subfleet->fares()->updateExistingPivot($fare->id, $override);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class PirepFinanceService extends Service
|
|||||||
private $expenseRepo;
|
private $expenseRepo;
|
||||||
private $fareSvc;
|
private $fareSvc;
|
||||||
private $journalRepo;
|
private $journalRepo;
|
||||||
private $pirepSvc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FinanceService constructor.
|
* FinanceService constructor.
|
||||||
@@ -32,18 +31,15 @@ class PirepFinanceService extends Service
|
|||||||
* @param ExpenseRepository $expenseRepo
|
* @param ExpenseRepository $expenseRepo
|
||||||
* @param FareService $fareSvc
|
* @param FareService $fareSvc
|
||||||
* @param JournalRepository $journalRepo
|
* @param JournalRepository $journalRepo
|
||||||
* @param PirepService $pirepSvc
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ExpenseRepository $expenseRepo,
|
ExpenseRepository $expenseRepo,
|
||||||
FareService $fareSvc,
|
FareService $fareSvc,
|
||||||
JournalRepository $journalRepo,
|
JournalRepository $journalRepo
|
||||||
PirepService $pirepSvc
|
|
||||||
) {
|
) {
|
||||||
$this->expenseRepo = $expenseRepo;
|
$this->expenseRepo = $expenseRepo;
|
||||||
$this->fareSvc = $fareSvc;
|
$this->fareSvc = $fareSvc;
|
||||||
$this->journalRepo = $journalRepo;
|
$this->journalRepo = $journalRepo;
|
||||||
$this->pirepSvc = $pirepSvc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,6 +284,7 @@ class PirepFinanceService extends Service
|
|||||||
.$expense->name.'", A='.$expense->amount);
|
.$expense->name.'", A='.$expense->amount);
|
||||||
|
|
||||||
// If an airline_id is filled, then see if it matches
|
// If an airline_id is filled, then see if it matches
|
||||||
|
/** @noinspection NotOptimalIfConditionsInspection */
|
||||||
if (filled($expense->airline_id) && $expense->airline_id !== $pirep->airline_id) {
|
if (filled($expense->airline_id) && $expense->airline_id !== $pirep->airline_id) {
|
||||||
Log::info('Finance: Expense has an airline ID and it doesn\'t match, skipping');
|
Log::info('Finance: Expense has an airline ID and it doesn\'t match, skipping');
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class FlightService extends Service
|
class FlightService extends Service
|
||||||
{
|
{
|
||||||
private $fareSvc;
|
|
||||||
private $flightRepo;
|
private $flightRepo;
|
||||||
private $navDataRepo;
|
private $navDataRepo;
|
||||||
private $userSvc;
|
private $userSvc;
|
||||||
@@ -25,18 +24,15 @@ class FlightService extends Service
|
|||||||
/**
|
/**
|
||||||
* FlightService constructor.
|
* FlightService constructor.
|
||||||
*
|
*
|
||||||
* @param FareService $fareSvc
|
|
||||||
* @param FlightRepository $flightRepo
|
* @param FlightRepository $flightRepo
|
||||||
* @param NavdataRepository $navdataRepo
|
* @param NavdataRepository $navdataRepo
|
||||||
* @param UserService $userSvc
|
* @param UserService $userSvc
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
FareService $fareSvc,
|
|
||||||
FlightRepository $flightRepo,
|
FlightRepository $flightRepo,
|
||||||
NavdataRepository $navdataRepo,
|
NavdataRepository $navdataRepo,
|
||||||
UserService $userSvc
|
UserService $userSvc
|
||||||
) {
|
) {
|
||||||
$this->fareSvc = $fareSvc;
|
|
||||||
$this->flightRepo = $flightRepo;
|
$this->flightRepo = $flightRepo;
|
||||||
$this->navDataRepo = $navdataRepo;
|
$this->navDataRepo = $navdataRepo;
|
||||||
$this->userSvc = $userSvc;
|
$this->userSvc = $userSvc;
|
||||||
@@ -128,19 +124,11 @@ class FlightService extends Service
|
|||||||
// Return any flights that have the same route code and leg
|
// Return any flights that have the same route code and leg
|
||||||
// If this list is > 0, then this has a duplicate
|
// If this list is > 0, then this has a duplicate
|
||||||
$found_flights = $found_flights->filter(function ($value, $key) use ($flight) {
|
$found_flights = $found_flights->filter(function ($value, $key) use ($flight) {
|
||||||
if ($flight->route_code === $value->route_code
|
return $flight->route_code === $value->route_code
|
||||||
&& $flight->route_leg === $value->route_leg) {
|
&& $flight->route_leg === $value->route_leg;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($found_flights->count() === 0) {
|
return !($found_flights->count() === 0);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,9 +179,7 @@ class FlightService extends Service
|
|||||||
return collect();
|
return collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$route_points = array_map(function ($point) {
|
$route_points = array_map('strtoupper', explode(' ', $flight->route));
|
||||||
return strtoupper($point);
|
|
||||||
}, explode(' ', $flight->route));
|
|
||||||
|
|
||||||
$route = $this->navDataRepo->findWhereIn('id', $route_points);
|
$route = $this->navDataRepo->findWhereIn('id', $route_points);
|
||||||
|
|
||||||
@@ -251,6 +237,7 @@ class FlightService extends Service
|
|||||||
throw new BidExists('A bid already exists for this flight');
|
throw new BidExists('A bid already exists for this flight');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if ($flight->has_bid === true) {
|
if ($flight->has_bid === true) {
|
||||||
Log::info('Bid exists, flight='.$flight->id.'; no entry in bids table, cleaning up');
|
Log::info('Bid exists, flight='.$flight->id.'; no entry in bids table, cleaning up');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,6 +253,9 @@ class GeoService extends Service
|
|||||||
* Return a single feature point for the
|
* Return a single feature point for the
|
||||||
*
|
*
|
||||||
* @param mixed $pireps
|
* @param mixed $pireps
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @return \GeoJson\Feature\FeatureCollection
|
||||||
*/
|
*/
|
||||||
public function getFeatureForLiveFlights($pireps)
|
public function getFeatureForLiveFlights($pireps)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace App\Services\ImportExport;
|
|||||||
|
|
||||||
use App\Interfaces\ImportExport;
|
use App\Interfaces\ImportExport;
|
||||||
use App\Models\Aircraft;
|
use App\Models\Aircraft;
|
||||||
use App\Models\Flight;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The flight importer can be imported or export. Operates on rows
|
* The flight importer can be imported or export. Operates on rows
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class AircraftImporter extends ImportExport
|
|||||||
* @param int $index
|
* @param int $index
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function import(array $row, $index): bool
|
public function import(array $row, $index): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class AviationWeather extends Metar
|
|||||||
try {
|
try {
|
||||||
$res = Http::get($url, []);
|
$res = Http::get($url, []);
|
||||||
$xml = simplexml_load_string($res);
|
$xml = simplexml_load_string($res);
|
||||||
if (count($xml->data->METAR->raw_text) == 0) {
|
if (\count($xml->data->METAR->raw_text) === 0) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return $xml->data->METAR->raw_text->__toString();
|
return $xml->data->METAR->raw_text->__toString();
|
||||||
|
|||||||
@@ -31,23 +31,19 @@ class PirepService extends Service
|
|||||||
{
|
{
|
||||||
private $geoSvc;
|
private $geoSvc;
|
||||||
private $pilotSvc;
|
private $pilotSvc;
|
||||||
private $pirepRepo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PirepService constructor.
|
* PirepService constructor.
|
||||||
*
|
*
|
||||||
* @param GeoService $geoSvc
|
* @param GeoService $geoSvc
|
||||||
* @param PirepRepository $pirepRepo
|
|
||||||
* @param UserService $pilotSvc
|
* @param UserService $pilotSvc
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
GeoService $geoSvc,
|
GeoService $geoSvc,
|
||||||
PirepRepository $pirepRepo,
|
|
||||||
UserService $pilotSvc
|
UserService $pilotSvc
|
||||||
) {
|
) {
|
||||||
$this->geoSvc = $geoSvc;
|
$this->geoSvc = $geoSvc;
|
||||||
$this->pilotSvc = $pilotSvc;
|
$this->pilotSvc = $pilotSvc;
|
||||||
$this->pirepRepo = $pirepRepo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,6 +196,7 @@ class PirepService extends Service
|
|||||||
* Submit the PIREP. Figure out its default state
|
* Submit the PIREP. Figure out its default state
|
||||||
*
|
*
|
||||||
* @param Pirep $pirep
|
* @param Pirep $pirep
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function submit(Pirep $pirep)
|
public function submit(Pirep $pirep)
|
||||||
{
|
{
|
||||||
@@ -306,6 +303,7 @@ class PirepService extends Service
|
|||||||
* @param Pirep $pirep
|
* @param Pirep $pirep
|
||||||
*
|
*
|
||||||
* @return Pirep
|
* @return Pirep
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function accept(Pirep $pirep): Pirep
|
public function accept(Pirep $pirep): Pirep
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class ICAO
|
|||||||
* @param null $country
|
* @param null $country
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function createHexCode($country = null)
|
public static function createHexCode($country = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ class Metar implements \ArrayAccess
|
|||||||
if (array_key_exists('cavok', $this->result) && $this->result['cavok']) {
|
if (array_key_exists('cavok', $this->result) && $this->result['cavok']) {
|
||||||
$this->result['category'] = 'VFR';
|
$this->result['category'] = 'VFR';
|
||||||
} else {
|
} else {
|
||||||
|
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||||
if (array_key_exists('cloud_height', $this->result) && array_key_exists('visibility', $this->result)) {
|
if (array_key_exists('cloud_height', $this->result) && array_key_exists('visibility', $this->result)) {
|
||||||
if ($this->result['cloud_height']['ft'] > 3000 && $this->result['visibility']['nmi'] > 5) {
|
if ($this->result['cloud_height']['ft'] > 3000 && $this->result['visibility']['nmi'] > 5) {
|
||||||
$this->result['category'] = 'VFR';
|
$this->result['category'] = 'VFR';
|
||||||
@@ -566,6 +567,7 @@ class Metar implements \ArrayAccess
|
|||||||
* Decodes TAF code if present.
|
* Decodes TAF code if present.
|
||||||
*
|
*
|
||||||
* @param mixed $part
|
* @param mixed $part
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function get_taf($part)
|
private function get_taf($part)
|
||||||
{
|
{
|
||||||
@@ -770,6 +772,7 @@ class Metar implements \ArrayAccess
|
|||||||
if ($found[1] === 'CAVOK' || $found[1] === '9999') {
|
if ($found[1] === 'CAVOK' || $found[1] === '9999') {
|
||||||
$this->set_result_value('visibility', new Distance(10000, 'm'));
|
$this->set_result_value('visibility', new Distance(10000, 'm'));
|
||||||
$this->set_result_value('visibility_report', 'Greater than 10 km');
|
$this->set_result_value('visibility_report', 'Greater than 10 km');
|
||||||
|
/** @noinspection NotOptimalIfConditionsInspection */
|
||||||
if ($found[1] === 'CAVOK') {
|
if ($found[1] === 'CAVOK') {
|
||||||
$this->set_result_value('cavok', true);
|
$this->set_result_value('cavok', true);
|
||||||
$this->method += 4; // can skip the next 4 methods: visibility_min, runway_vr, present_weather, clouds
|
$this->method += 4; // can skip the next 4 methods: visibility_min, runway_vr, present_weather, clouds
|
||||||
@@ -887,7 +890,7 @@ class Metar implements \ArrayAccess
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Runway past tendency
|
// Runway past tendency
|
||||||
if (isset($found[8]) && isset(static::$rvr_tendency_codes[$found[8]])) {
|
if (isset($found[8], static::$rvr_tendency_codes[$found[8]])) {
|
||||||
$observed['tendency'] = $found[8];
|
$observed['tendency'] = $found[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1002,7 +1005,7 @@ class Metar implements \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Type
|
// Type
|
||||||
if (isset($found[6]) && !empty($found[6]) && isset(static::$cloud_type_codes[$found[6]]) && $found[4] != 'VV') {
|
if (isset($found[6], static::$cloud_type_codes[$found[6]]) && !empty($found[6]) && $found[4] !== 'VV') {
|
||||||
$observed['type'] = $found[6];
|
$observed['type'] = $found[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1204,13 +1207,13 @@ class Metar implements \ArrayAccess
|
|||||||
|
|
||||||
// Build runways report
|
// Build runways report
|
||||||
$report = [];
|
$report = [];
|
||||||
if (null !== $observed['deposits']) {
|
if ($observed['deposits'] !== null) {
|
||||||
$report[] = static::$runway_deposits_codes[$observed['deposits']];
|
$report[] = static::$runway_deposits_codes[$observed['deposits']];
|
||||||
if (null !== $observed['deposits_extent']) {
|
if (null !== $observed['deposits_extent']) {
|
||||||
$report[] = 'contamination '.static::$runway_deposits_extent_codes[$observed['deposits_extent']];
|
$report[] = 'contamination '.static::$runway_deposits_extent_codes[$observed['deposits_extent']];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $observed['deposits_depth']) {
|
if ($observed['deposits_depth'] !== null) {
|
||||||
if ($observed['deposits_depth'] === '99') {
|
if ($observed['deposits_depth'] === '99') {
|
||||||
$report[] = 'runway closed';
|
$report[] = 'runway closed';
|
||||||
} elseif (isset(static::$runway_deposits_depth_codes[$observed['deposits_depth']])) {
|
} elseif (isset(static::$runway_deposits_depth_codes[$observed['deposits_depth']])) {
|
||||||
@@ -1221,7 +1224,7 @@ class Metar implements \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $observed['friction']) {
|
if ($observed['friction'] !== null) {
|
||||||
if (isset(static::$runway_friction_codes[$observed['friction']])) {
|
if (isset(static::$runway_friction_codes[$observed['friction']])) {
|
||||||
$report[] = 'a braking action is '.static::$runway_friction_codes[$observed['friction']];
|
$report[] = 'a braking action is '.static::$runway_friction_codes[$observed['friction']];
|
||||||
} else {
|
} else {
|
||||||
@@ -1385,7 +1388,7 @@ class Metar implements \ArrayAccess
|
|||||||
while ($this->part < \count($this->raw_parts)) {
|
while ($this->part < \count($this->raw_parts)) {
|
||||||
if (preg_match($r, $this->raw_parts[$this->part], $found)) {
|
if (preg_match($r, $this->raw_parts[$this->part], $found)) {
|
||||||
// Get trend flag
|
// Get trend flag
|
||||||
if (isset($found[2]) && isset(static::$trends_flag_codes[$found[2]])) {
|
if (isset($found[2], static::$trends_flag_codes[$found[2]])) {
|
||||||
$trend['flag'] = $found[2];
|
$trend['flag'] = $found[2];
|
||||||
} // Get PROBpp formatted period
|
} // Get PROBpp formatted period
|
||||||
|
|
||||||
@@ -1393,7 +1396,7 @@ class Metar implements \ArrayAccess
|
|||||||
$trend['probability'] = $found[4];
|
$trend['probability'] = $found[4];
|
||||||
} // Get AT, FM, TL formatted period
|
} // Get AT, FM, TL formatted period
|
||||||
|
|
||||||
elseif (isset($found[8]) && isset(static::$trends_time_codes[$found[5]])) {
|
elseif (isset($found[8], static::$trends_time_codes[$found[5]])) {
|
||||||
$trend['period']['flag'] = $found[5];
|
$trend['period']['flag'] = $found[5];
|
||||||
if (!empty($found[6])) {
|
if (!empty($found[6])) {
|
||||||
$trend['period']['day'] = (int) $found[6];
|
$trend['period']['day'] = (int) $found[6];
|
||||||
@@ -1512,7 +1515,7 @@ class Metar implements \ArrayAccess
|
|||||||
|
|
||||||
$remarks = [];
|
$remarks = [];
|
||||||
// Get all parts after
|
// Get all parts after
|
||||||
while ($this->part < count($this->raw_parts)) {
|
while ($this->part < \count($this->raw_parts)) {
|
||||||
if (isset($this->raw_parts[$this->part])) {
|
if (isset($this->raw_parts[$this->part])) {
|
||||||
$remarks[] = $this->raw_parts[$this->part];
|
$remarks[] = $this->raw_parts[$this->part];
|
||||||
}
|
}
|
||||||
@@ -1582,11 +1585,11 @@ class Metar implements \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $observed['characteristics']) {
|
if ($observed['characteristics'] !== null) {
|
||||||
$report[] = static::$weather_char_codes[$observed['characteristics']];
|
$report[] = static::$weather_char_codes[$observed['characteristics']];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $observed['types']) {
|
if ($observed['types'] !== null) {
|
||||||
foreach ($observed['types'] as $code) {
|
foreach ($observed['types'] as $code) {
|
||||||
$report[] = static::$weather_type_codes[$code];
|
$report[] = static::$weather_type_codes[$code];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,20 +15,20 @@ class TimezonelistExtended extends Timezonelist
|
|||||||
* @param bool $htmlencode
|
* @param bool $htmlencode
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Exception
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
protected function formatTimezone($timezone, $continent, $htmlencode = true)
|
protected function formatTimezone($timezone, $continent, $htmlencode = true)
|
||||||
{
|
{
|
||||||
$time = new \DateTimeImmutable(null, new DateTimeZone($timezone));
|
$time = new \DateTimeImmutable(null, new DateTimeZone($timezone));
|
||||||
$offset = $time->format('P');
|
$offset = $time->format('P');
|
||||||
if ($htmlencode) {
|
if ($htmlencode) {
|
||||||
$offset = str_replace('-', ' − ', $offset);
|
$offset = str_replace(['-', '+'], array(' − ', ' + '), $offset);
|
||||||
$offset = str_replace('+', ' + ', $offset);
|
|
||||||
}
|
}
|
||||||
$timezone = substr($timezone, strlen($continent) + 1);
|
$timezone = substr($timezone, \strlen($continent) + 1);
|
||||||
$timezone = str_replace('St_', 'St. ', $timezone);
|
$timezone = str_replace(['St_', '_'], array('St. ', ' '), $timezone);
|
||||||
$timezone = str_replace('_', ' ', $timezone);
|
|
||||||
$formatted = '(GMT/UTC'.$offset.')'.self::WHITESPACE_SEP.$timezone;
|
return '(GMT/UTC'.$offset.')'.self::WHITESPACE_SEP.$timezone;
|
||||||
return $formatted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,7 @@ class TimezonelistExtended extends Timezonelist
|
|||||||
// Attributes for select element
|
// Attributes for select element
|
||||||
$attrSet = '';
|
$attrSet = '';
|
||||||
if (!empty($attr)) {
|
if (!empty($attr)) {
|
||||||
if (is_array($attr)) {
|
if (\is_array($attr)) {
|
||||||
foreach ($attr as $attr_name => $attr_value) {
|
foreach ($attr as $attr_name => $attr_value) {
|
||||||
$attrSet .= ' '.$attr_name.'="'.$attr_value.'"';
|
$attrSet .= ' '.$attr_name.'="'.$attr_value.'"';
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ class TimezonelistExtended extends Timezonelist
|
|||||||
// Add popular timezones
|
// Add popular timezones
|
||||||
$listbox .= '<optgroup label="General">';
|
$listbox .= '<optgroup label="General">';
|
||||||
foreach ($this->popularTimezones as $key => $value) {
|
foreach ($this->popularTimezones as $key => $value) {
|
||||||
$selected_attr = ($selected == $key) ? ' selected="selected"' : '';
|
$selected_attr = ($selected === $key) ? ' selected="selected"' : '';
|
||||||
$listbox .= '<option value="'.$key.'"'.$selected_attr.'>'.$value.'</option>';
|
$listbox .= '<option value="'.$key.'"'.$selected_attr.'>'.$value.'</option>';
|
||||||
}
|
}
|
||||||
$listbox .= '</optgroup>';
|
$listbox .= '</optgroup>';
|
||||||
@@ -70,7 +70,7 @@ class TimezonelistExtended extends Timezonelist
|
|||||||
$listbox .= '<optgroup label="'.$continent.'">';
|
$listbox .= '<optgroup label="'.$continent.'">';
|
||||||
// create option tags
|
// create option tags
|
||||||
foreach ($timezones as $timezone) {
|
foreach ($timezones as $timezone) {
|
||||||
$selected_attr = ($selected == $timezone) ? ' selected="selected"' : '';
|
$selected_attr = ($selected === $timezone) ? ' selected="selected"' : '';
|
||||||
$listbox .= '<option value="'.$timezone.'"'.$selected_attr.'>';
|
$listbox .= '<option value="'.$timezone.'"'.$selected_attr.'>';
|
||||||
$listbox .= $this->formatTimezone($timezone, $continent, $htmlencode);
|
$listbox .= $this->formatTimezone($timezone, $continent, $htmlencode);
|
||||||
$listbox .= '</option>';
|
$listbox .= '</option>';
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ if (!function_exists('skin_view')) {
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
function skin_view($template, array $vars = [], $merge_data = [])
|
function skin_view($template, array $vars = [], array $merge_data = [])
|
||||||
{
|
{
|
||||||
// Add the current skin name so we don't need to hardcode it in the templates
|
// Add the current skin name so we don't need to hardcode it in the templates
|
||||||
// Makes it a bit easier to create a new skin by modifying an existing one
|
// Makes it a bit easier to create a new skin by modifying an existing one
|
||||||
@@ -149,7 +149,7 @@ if (!function_exists('setting')) {
|
|||||||
* set
|
* set
|
||||||
*/
|
*/
|
||||||
if (!function_exists('public_asset')) {
|
if (!function_exists('public_asset')) {
|
||||||
function public_asset($path, $parameters = [], $secure = null)
|
function public_asset($path, array $parameters = [], $secure = null)
|
||||||
{
|
{
|
||||||
$publicBaseUrl = app()->publicUrlPath();
|
$publicBaseUrl = app()->publicUrlPath();
|
||||||
$path = $publicBaseUrl.$path;
|
$path = $publicBaseUrl.$path;
|
||||||
@@ -174,7 +174,7 @@ if (!function_exists('show_datetime')) {
|
|||||||
*/
|
*/
|
||||||
function show_datetime(\Carbon\Carbon $date = null)
|
function show_datetime(\Carbon\Carbon $date = null)
|
||||||
{
|
{
|
||||||
if (empty($date)) {
|
if ($date === null) {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,10 +103,10 @@ class application extends Illuminate\Foundation\Application
|
|||||||
return $this->basePath.DS.'config'.($path ? DS.$path : $path);
|
return $this->basePath.DS.'config'.($path ? DS.$path : $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function environmentPath()
|
/*public function environmentPath()
|
||||||
{
|
{
|
||||||
return $this->environmentPath ?: $this->basePath;
|
return $this->environmentPath ?: $this->basePath;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public function langPath()
|
public function langPath()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
"homepage": "http://www.phpvms.net",
|
"homepage": "http://www.phpvms.net",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
|
"ext-calendar": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-pdo": "*",
|
||||||
"laravel/framework": "^5.6",
|
"laravel/framework": "^5.6",
|
||||||
"laravelcollective/html": "5.6.x",
|
"laravelcollective/html": "5.6.x",
|
||||||
"prettus/l5-repository": "2.6.x",
|
"prettus/l5-repository": "2.6.x",
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ class InstallerController extends Controller
|
|||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function usersetup(Request $request)
|
public function usersetup(Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
|
|
||||||
namespace Modules\Installer\Providers;
|
namespace Modules\Installer\Providers;
|
||||||
|
|
||||||
|
use App\Services\ModuleService;
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Route;
|
use Route;
|
||||||
|
|
||||||
|
|
||||||
class InstallerServiceProvider extends ServiceProvider
|
class InstallerServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
protected $defer = false;
|
|
||||||
protected $moduleSvc;
|
protected $moduleSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +16,7 @@ class InstallerServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->moduleSvc = app('App\Services\ModuleService');
|
$this->moduleSvc = app(ModuleService::class);
|
||||||
|
|
||||||
$this->registerRoutes();
|
$this->registerRoutes();
|
||||||
$this->registerTranslations();
|
$this->registerTranslations();
|
||||||
@@ -78,9 +77,15 @@ class InstallerServiceProvider extends ServiceProvider
|
|||||||
$sourcePath => $viewPath
|
$sourcePath => $viewPath
|
||||||
],'views');
|
],'views');
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$paths = array_map(
|
||||||
return $path . '/modules/installer';
|
function ($path) {
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'installer');
|
return $path.'/modules/installer';
|
||||||
|
},
|
||||||
|
\Config::get('view.paths')
|
||||||
|
);
|
||||||
|
|
||||||
|
$paths[] = $sourcePath;
|
||||||
|
$this->loadViewsFrom($paths, 'installer');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +116,7 @@ class InstallerServiceProvider extends ServiceProvider
|
|||||||
/**
|
/**
|
||||||
* Get the services provided by the provider.
|
* Get the services provided by the provider.
|
||||||
*/
|
*/
|
||||||
public function provides()
|
public function provides(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class RequirementsService extends Service
|
|||||||
$extensions = [];
|
$extensions = [];
|
||||||
foreach(config('installer.extensions') as $ext) {
|
foreach(config('installer.extensions') as $ext) {
|
||||||
$pass = true;
|
$pass = true;
|
||||||
if(!extension_loaded($ext)) {
|
if(!\extension_loaded($ext)) {
|
||||||
$pass = false;
|
$pass = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
|
|
||||||
namespace Modules\Sample\Providers;
|
namespace Modules\Sample\Providers;
|
||||||
|
|
||||||
|
use App\Services\ModuleService;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
use Route;
|
use Route;
|
||||||
|
|
||||||
|
|
||||||
class SampleServiceProvider extends ServiceProvider
|
class SampleServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
protected $defer = false;
|
|
||||||
protected $moduleSvc;
|
protected $moduleSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +16,7 @@ class SampleServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->moduleSvc = app('App\Services\ModuleService');
|
$this->moduleSvc = app(ModuleService::class);
|
||||||
|
|
||||||
$this->registerRoutes();
|
$this->registerRoutes();
|
||||||
$this->registerTranslations();
|
$this->registerTranslations();
|
||||||
@@ -121,9 +120,15 @@ class SampleServiceProvider extends ServiceProvider
|
|||||||
$sourcePath => $viewPath
|
$sourcePath => $viewPath
|
||||||
],'views');
|
],'views');
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$paths = array_map(
|
||||||
return $path . '/modules/sample';
|
function ($path) {
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'sample');
|
return $path.'/modules/sample';
|
||||||
|
},
|
||||||
|
\Config::get('view.paths')
|
||||||
|
);
|
||||||
|
|
||||||
|
$paths[] = $sourcePath;
|
||||||
|
$this->loadViewsFrom($paths, 'sample');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +159,7 @@ class SampleServiceProvider extends ServiceProvider
|
|||||||
/**
|
/**
|
||||||
* Get the services provided by the provider.
|
* Get the services provided by the provider.
|
||||||
*/
|
*/
|
||||||
public function provides()
|
public function provides(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,10 @@
|
|||||||
namespace Modules\Vacentral\Providers;
|
namespace Modules\Vacentral\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
use App\Services\ModuleService;
|
||||||
use Route;
|
|
||||||
|
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
protected $defer = false;
|
|
||||||
protected $moduleSvc;
|
protected $moduleSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +14,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->moduleSvc = app('App\Services\ModuleService');
|
$this->moduleSvc = app(ModuleService::class);
|
||||||
$this->registerConfig();
|
$this->registerConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Modules\Vacentral\Providers;
|
namespace Modules\Vacentral\Providers;
|
||||||
|
|
||||||
use App\Events\PirepAccepted;
|
use App\Events\PirepAccepted;
|
||||||
use App\Events\TestEvent;
|
|
||||||
use Modules\Vacentral\Listeners\PirepAcceptedEventListener;
|
use Modules\Vacentral\Listeners\PirepAcceptedEventListener;
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
@@ -15,12 +14,4 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
protected $listen = [
|
protected $listen = [
|
||||||
PirepAccepted::class => [PirepAcceptedEventListener::class],
|
PirepAccepted::class => [PirepAcceptedEventListener::class],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any events for your application.
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
parent::boot();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'401' => [
|
401 => [
|
||||||
'title' => 'Unauthorized Access',
|
'title' => 'Unauthorized Access',
|
||||||
'message' => 'Well, this is embarrassing, you are not authorized to access or perform this function. '.
|
'message' => 'Well, this is embarrassing, you are not authorized to access or perform this function. '.
|
||||||
'Click <a href=":link">here</a> to go back to the home page.',
|
'Click <a href=":link">here</a> to go back to the home page.',
|
||||||
],
|
],
|
||||||
'404' => [
|
404 => [
|
||||||
'title' => 'Page Not Found',
|
'title' => 'Page Not Found',
|
||||||
'message' => 'Well, this is embarrassing, the page you requested does not exist.'.
|
'message' => 'Well, this is embarrassing, the page you requested does not exist.'.
|
||||||
'Click <a href=":link">here</a> to go back to the home page.',
|
'Click <a href=":link">here</a> to go back to the home page.',
|
||||||
],
|
],
|
||||||
'503' => [
|
503 => [
|
||||||
'title' => 'Internal Error',
|
'title' => 'Internal Error',
|
||||||
'message' => 'An Error Occured',
|
'message' => 'An Error Occured',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'401' => [
|
401 => [
|
||||||
'title' => 'Acceso no autorizado',
|
'title' => 'Acceso no autorizado',
|
||||||
'message' => 'Bueno, esto es embarazoso, no estás autorizado a acceder o realizar esta acción. '.
|
'message' => 'Bueno, esto es embarazoso, no estás autorizado a acceder o realizar esta acción. '.
|
||||||
'Clic <a href=":link">aquí</a> para retroceder a la página de inicio.',
|
'Clic <a href=":link">aquí</a> para retroceder a la página de inicio.',
|
||||||
],
|
],
|
||||||
'404' => [
|
404 => [
|
||||||
'title' => 'Página no encontrada',
|
'title' => 'Página no encontrada',
|
||||||
'message' => 'Bueno, esto es embarazoso, la página solicitada no existe.'.
|
'message' => 'Bueno, esto es embarazoso, la página solicitada no existe.'.
|
||||||
'Clic <a href=":link">aquí</a> para retroceder a la página de inicio.',
|
'Clic <a href=":link">aquí</a> para retroceder a la página de inicio.',
|
||||||
],
|
],
|
||||||
'503' => [
|
503 => [
|
||||||
'title' => 'Error interno',
|
'title' => 'Error interno',
|
||||||
'message' => 'Ocurrió un error',
|
'message' => 'Ocurrió un error',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'401' => [
|
401 => [
|
||||||
'title' => 'Non Autorizzato',
|
'title' => 'Non Autorizzato',
|
||||||
'message' => 'Beh, è imbarazzante, non sei autorizzato ad accedere o ad eseguire questa funzionalità. '.
|
'message' => 'Beh, è imbarazzante, non sei autorizzato ad accedere o ad eseguire questa funzionalità. '.
|
||||||
'Clicca <a href=":link">qui</a> per tornare alla home page.',
|
'Clicca <a href=":link">qui</a> per tornare alla home page.',
|
||||||
],
|
],
|
||||||
'404' => [
|
404 => [
|
||||||
'title' => 'Page Not Found',
|
'title' => 'Page Not Found',
|
||||||
'message' => 'Beh, è imbarazzante, la pagina che hai richiesto non esiste.'.
|
'message' => 'Beh, è imbarazzante, la pagina che hai richiesto non esiste.'.
|
||||||
'Clicca <a href=":link">qui</a> per tornare alla home page.',
|
'Clicca <a href=":link">qui</a> per tornare alla home page.',
|
||||||
],
|
],
|
||||||
'503' => [
|
503 => [
|
||||||
'title' => 'Internal Error',
|
'title' => 'Internal Error',
|
||||||
'message' => 'Torniamo subito.',
|
'message' => 'Torniamo subito.',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class AcarsTest extends TestCase
|
|||||||
* @param $points
|
* @param $points
|
||||||
* @param array $addtl_fields
|
* @param array $addtl_fields
|
||||||
*/
|
*/
|
||||||
protected function allPointsInRoute($route, $points, $addtl_fields = [])
|
protected function allPointsInRoute($route, $points, array $addtl_fields = [])
|
||||||
{
|
{
|
||||||
if (empty($addtl_fields)) {
|
if (empty($addtl_fields)) {
|
||||||
$addtl_fields = [];
|
$addtl_fields = [];
|
||||||
@@ -40,7 +40,7 @@ class AcarsTest extends TestCase
|
|||||||
$addtl_fields
|
$addtl_fields
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(\count($route), \count($points));
|
$this->assertCount(\count($route), $points);
|
||||||
foreach ($route as $idx => $point) {
|
foreach ($route as $idx => $point) {
|
||||||
$this->assertHasKeys($points[$idx], $fields);
|
$this->assertHasKeys($points[$idx], $fields);
|
||||||
foreach ($fields as $f) {
|
foreach ($fields as $f) {
|
||||||
@@ -556,6 +556,7 @@ class AcarsTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test publishing multiple, batched updates
|
* Test publishing multiple, batched updates
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function testMultipleAcarsPositionUpdates()
|
public function testMultipleAcarsPositionUpdates()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ class ApiTest extends TestCase
|
|||||||
$this->assertTrue(array_key_exists('user', $response['data'][0]));
|
$this->assertTrue(array_key_exists('user', $response['data'][0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function testGetAirlines()
|
public function testGetAirlines()
|
||||||
{
|
{
|
||||||
$size = \random_int(5, 10);
|
$size = \random_int(5, 10);
|
||||||
@@ -134,6 +137,7 @@ class ApiTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test getting the subfleets
|
* Test getting the subfleets
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function testGetSubfleets()
|
public function testGetSubfleets()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ class FlightTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flight's route
|
* Get the flight's route
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function testFlightRoute()
|
public function testFlightRoute()
|
||||||
{
|
{
|
||||||
@@ -398,7 +399,7 @@ class FlightTest extends TestCase
|
|||||||
$req->assertStatus(200);
|
$req->assertStatus(200);
|
||||||
|
|
||||||
$body = $req->json()['data'];
|
$body = $req->json()['data'];
|
||||||
$this->assertEquals(1, count($body['bids']));
|
$this->assertCount(1, $body['bids']);
|
||||||
$this->assertEquals($flight->id, $body['bids'][0]['flight_id']);
|
$this->assertEquals($flight->id, $body['bids'][0]['flight_id']);
|
||||||
|
|
||||||
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
|
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
|
||||||
@@ -435,7 +436,7 @@ class FlightTest extends TestCase
|
|||||||
|
|
||||||
$body = $req->json()['data'];
|
$body = $req->json()['data'];
|
||||||
$this->assertEquals($user->id, $body['id']);
|
$this->assertEquals($user->id, $body['id']);
|
||||||
$this->assertEquals(0, count($body['bids']));
|
$this->assertCount(0, $body['bids']);
|
||||||
|
|
||||||
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
|
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
|
||||||
$req->assertStatus(200);
|
$req->assertStatus(200);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class GeoTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure the departure airports/sid/star are all filtered out
|
* Make sure the departure airports/sid/star are all filtered out
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function testGetCoords()
|
public function testGetCoords()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ class ImporterTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test exporting all the flights to a file
|
* Test exporting all the flights to a file
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
*/
|
*/
|
||||||
public function testAircraftExporter(): void
|
public function testAircraftExporter(): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ class PIREPTest extends TestCase
|
|||||||
return $saved_route;
|
return $saved_route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function testAddPirep()
|
public function testAddPirep()
|
||||||
{
|
{
|
||||||
$user = factory(App\Models\User::class)->create();
|
$user = factory(App\Models\User::class)->create();
|
||||||
@@ -59,7 +62,11 @@ class PIREPTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$pirep = $this->pirepSvc->create($pirep, []);
|
$pirep = $this->pirepSvc->create($pirep, []);
|
||||||
$this->pirepSvc->saveRoute($pirep);
|
try {
|
||||||
|
$this->pirepSvc->saveRoute($pirep);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the initial state info
|
* Check the initial state info
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class RegistrationTest extends TestCase
|
|||||||
* A basic test example.
|
* A basic test example.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function testRegistration()
|
public function testRegistration()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,10 +59,11 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
{
|
{
|
||||||
if ($user !== null) {
|
if ($user !== null) {
|
||||||
$headers['x-api-key'] = $user->api_key;
|
$headers['x-api-key'] = $user->api_key;
|
||||||
} else {
|
return $headers;
|
||||||
if ($this->user !== null) {
|
}
|
||||||
$headers['x-api-key'] = $this->user->api_key;
|
|
||||||
}
|
if ($this->user !== null) {
|
||||||
|
$headers['x-api-key'] = $this->user->api_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $headers;
|
return $headers;
|
||||||
@@ -90,7 +91,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
* @param $obj
|
* @param $obj
|
||||||
* @param array $keys
|
* @param array $keys
|
||||||
*/
|
*/
|
||||||
public function assertHasKeys($obj, $keys = [])
|
public function assertHasKeys($obj, array $keys = []): void
|
||||||
{
|
{
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$this->assertArrayHasKey($key, $obj);
|
$this->assertArrayHasKey($key, $obj);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ trait TestData
|
|||||||
* @param null $airport_id
|
* @param null $airport_id
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null)
|
public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ class UtilsTest extends TestCase
|
|||||||
$this->assertNotNull($carbon);
|
$this->assertNotNull($carbon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function testSecondsToTimeParts()
|
public function testSecondsToTimeParts()
|
||||||
{
|
{
|
||||||
$t = Utils::secondsToTimeParts(3600);
|
$t = Utils::secondsToTimeParts(3600);
|
||||||
|
|||||||
Reference in New Issue
Block a user