diff --git a/app/Awards/PilotFlightAwards.php b/app/Awards/PilotFlightAwards.php index 43190cc5..4955550d 100644 --- a/app/Awards/PilotFlightAwards.php +++ b/app/Awards/PilotFlightAwards.php @@ -7,13 +7,13 @@ use App\Interfaces\Award; /** * Simple example of an awards class, where you can apply an award when a user * has 100 flights. All award classes need to extend the AwardInterface - * @package App\Awards */ class PilotFlightAwards extends Award { /** * Set the name of this award class to make it easier to see when * assigning to a specific award + * * @var string */ public $name = 'Pilot Flights'; @@ -22,6 +22,7 @@ class PilotFlightAwards extends Award * The description to show under the parameters field, so the admin knows * what the parameter actually controls. You can leave this blank if there * isn't a parameter. + * * @var string */ public $param_description = 'The number of flights at which to give this award'; @@ -33,7 +34,9 @@ class PilotFlightAwards extends Award * If no parameter is passed in, just default it to 100. You should check if there * is a parameter or not. You can call it whatever you want, since that would make * sense with the $param_description. + * * @param int|null $number_of_flights The parameters passed in from the UI + * * @return bool */ public function check($number_of_flights = null): bool diff --git a/app/Bootstrap/LoadConfiguration.php b/app/Bootstrap/LoadConfiguration.php index bd1d2cc9..76782c77 100644 --- a/app/Bootstrap/LoadConfiguration.php +++ b/app/Bootstrap/LoadConfiguration.php @@ -7,30 +7,22 @@ use Illuminate\Contracts\Foundation\Application; /** * Class LoadConfiguration - * @package App\Bootstrap - * - * I'm overriding this to take advantage of the configuration caching - * and not needing to read the files from disk every time. - * - * Hopefully it won't affect anything within core framework but this - * should be ok. Will just have to be cognizant of any changes to the - * LoadConfiguration parent class, or if the Kernel changes the boot - * order -NS */ class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfiguration { /** * Load the configuration items from all of the files. * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Contracts\Config\Repository $repository + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Config\Repository $repository + * * @throws \Exception */ protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) { parent::loadConfigurationFiles($app, $repository); - /** + /* * Read in the base config, only if it exists */ if (file_exists($app->basePath().'/config.php')) { diff --git a/app/Console/Command.php b/app/Console/Command.php index 6be4a2f6..b073440d 100644 --- a/app/Console/Command.php +++ b/app/Console/Command.php @@ -7,7 +7,6 @@ use Symfony\Component\Process\Process; /** * Class BaseCommand - * @package App\Console */ abstract class Command extends \Illuminate\Console\Command { @@ -52,7 +51,9 @@ abstract class Command extends \Illuminate\Console\Command /** * Streaming file reader + * * @param $filename + * * @return \Generator */ public function readFile($filename): ?\Generator @@ -71,16 +72,19 @@ abstract class Command extends \Illuminate\Console\Command } /** - * @param $cmd - * @param bool $return - * @return string + * @param $cmd + * @param bool $return + * @param mixed $verbose + * * @throws \Symfony\Component\Process\Exception\RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException + * + * @return string */ public function runCommand($cmd, $return = false, $verbose = true): string { if (\is_array($cmd)) { - $cmd = join(' ', $cmd); + $cmd = implode(' ', $cmd); } if ($verbose) { diff --git a/app/Console/Commands/AcarsReplay.php b/app/Console/Commands/AcarsReplay.php index 69e83d29..f52671d2 100644 --- a/app/Console/Commands/AcarsReplay.php +++ b/app/Console/Commands/AcarsReplay.php @@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Collection; /** * Class AcarsReplay - * @package App\Console\Commands */ class AcarsReplay extends Command { @@ -18,12 +17,14 @@ class AcarsReplay extends Command /** * API Key to post as + * * @var string */ protected $apiKey = 'testadminapikey'; /** * For automatic updates, how many seconds to sleep between updates + * * @var int */ protected $sleepTime = 10; @@ -50,19 +51,22 @@ class AcarsReplay extends Command 'base_uri' => config('app.url'), 'headers' => [ 'Authorization' => $this->apiKey, - ] + ], ]); } /** * Make a request to start a PIREP + * * @param \stdClass $flight - * @return string + * * @throws \RuntimeException + * + * @return string */ protected function startPirep($flight): string { - # convert the planned flight time to be completely in minutes + // convert the planned flight time to be completely in minutes $pft = Utils::hoursToMinutes( $flight->planned_hrsenroute, $flight->planned_minenroute @@ -80,7 +84,7 @@ class AcarsReplay extends Command 'level' => $flight->planned_altitude, 'planned_flight_time' => $pft, 'route' => $flight->planned_route, - ] + ], ]); $body = \json_decode($response->getBody()->getContents()); @@ -90,14 +94,17 @@ class AcarsReplay extends Command /** * Mark the PIREP as filed + * * @param $pirep_id - * @return mixed + * * @throws \RuntimeException + * + * @return mixed */ protected function filePirep($pirep_id) { $response = $this->httpClient->post('/api/pireps/'.$pirep_id.'/file', [ - 'json' => [] + 'json' => [], ]); $body = \json_decode($response->getBody()->getContents()); @@ -108,8 +115,10 @@ class AcarsReplay extends Command /** * @param $pirep_id * @param $data - * @return array + * * @throws \RuntimeException + * + * @return array */ protected function postUpdate($pirep_id, $data) { @@ -127,15 +136,15 @@ class AcarsReplay extends Command $upd = [ 'positions' => [ - $position - ] + $position, + ], ]; $this->info("Update: $data->callsign, $position[lat] x $position[lon] \t\t" ."hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]"); $response = $this->httpClient->post($uri, [ - 'json' => $upd + 'json' => $upd, ]); $body = \json_decode($response->getBody()->getContents()); @@ -146,13 +155,15 @@ class AcarsReplay extends Command $position['lon'], $position['heading'], $position['altitude'], - $position['gs'] + $position['gs'], ]; } /** * Parse this file and run the updates + * * @param array $files + * * @throws \RuntimeException */ protected function updatesFromFile(array $files) @@ -168,20 +179,19 @@ class AcarsReplay extends Command $contents = \json_decode($contents); return collect($contents->updates); - } else { - $this->error($file.' not found, skipping'); - - return false; } + $this->error($file.' not found, skipping'); + + return false; }) - # remove any of errored file entries + // remove any of errored file entries ->filter(function ($value, $key) { return $value !== false; }); $this->info('Starting playback'); - /** + /* * File the initial pirep to get a "preflight" status */ $flights->each(function ($updates, $idx) { @@ -191,7 +201,7 @@ class AcarsReplay extends Command $this->info('Prefiled '.$update->callsign.', ID: '.$pirep_id); }); - /** + /* * Iterate through all of the flights, retrieving the updates * from each individual flight. Remove the update. Continue through * until there are no updates left, at which point we remove the flight @@ -206,7 +216,7 @@ class AcarsReplay extends Command $this->postUpdate($pirep_id, $update); - # we're done and don't put the "no-submit" option + // we're done and don't put the "no-submit" option if ($updates->count() === 0 && !$this->option('no-submit')) { $this->filePirep($pirep_id); } @@ -226,8 +236,10 @@ class AcarsReplay extends Command /** * Execute the console command. - * @return mixed + * * @throws \RuntimeException + * + * @return mixed */ public function handle() { diff --git a/app/Console/Commands/ComposerCommand.php b/app/Console/Commands/ComposerCommand.php index f828dbc8..086cb311 100644 --- a/app/Console/Commands/ComposerCommand.php +++ b/app/Console/Commands/ComposerCommand.php @@ -7,7 +7,6 @@ use Artisan; /** * Class ComposerCommand - * @package App\Console\Commands */ class ComposerCommand extends Command { @@ -19,8 +18,7 @@ class ComposerCommand extends Command */ public function handle() { - switch(trim($this->argument('cmd'))) - { + switch (trim($this->argument('cmd'))) { case 'post-update': $this->postUpdate(); break; diff --git a/app/Console/Commands/CreateDatabase.php b/app/Console/Commands/CreateDatabase.php index e4e626e8..ea821cbb 100644 --- a/app/Console/Commands/CreateDatabase.php +++ b/app/Console/Commands/CreateDatabase.php @@ -7,7 +7,6 @@ use Log; /** * Class CreateDatabase - * @package App\Console\Commands */ class CreateDatabase extends Command { @@ -26,7 +25,9 @@ class CreateDatabase extends Command /** * Create the mysql database + * * @param $dbkey + * * @return bool */ protected function create_mysql($dbkey) @@ -52,6 +53,7 @@ class CreateDatabase extends Command if ($this->option('reset') === true) { $sql = "DROP DATABASE IF EXISTS `$name`"; + try { Log::info('Dropping database: '.$sql); $conn->exec($sql); @@ -74,6 +76,7 @@ class CreateDatabase extends Command /** * Create the sqlite database + * * @param $dbkey */ protected function create_sqlite($dbkey) diff --git a/app/Console/Commands/DevCommands.php b/app/Console/Commands/DevCommands.php index 2e42cd3f..adeb437f 100644 --- a/app/Console/Commands/DevCommands.php +++ b/app/Console/Commands/DevCommands.php @@ -15,7 +15,6 @@ use Symfony\Component\Yaml\Yaml; /** * Class DevCommands - * @package App\Console\Commands */ class DevCommands extends Command { @@ -25,6 +24,7 @@ class DevCommands extends Command /** * DevCommands constructor. + * * @param DatabaseService $dbSvc */ public function __construct(DatabaseService $dbSvc) @@ -173,7 +173,7 @@ class DevCommands extends Command } $yaml[$table_name][] = $yaml_row; - ++$count; + $count++; } $this->info('Exporting '.$count.' rows'); @@ -198,9 +198,8 @@ class DevCommands extends Command $yml = Yaml::parse(file_get_contents($file)); foreach ($yml as $table => $rows) { - - $this->info('Importing table ' . $table); - $this->info('Number of rows: ' . \count($rows)); + $this->info('Importing table '.$table); + $this->info('Number of rows: '.\count($rows)); foreach ($rows as $row) { try { diff --git a/app/Console/Commands/DevInstall.php b/app/Console/Commands/DevInstall.php index 10fb9aef..652aef19 100644 --- a/app/Console/Commands/DevInstall.php +++ b/app/Console/Commands/DevInstall.php @@ -7,7 +7,6 @@ use Modules\Installer\Services\ConfigService; /** * Create a fresh development install - * @package App\Console\Commands */ class DevInstall extends Command { @@ -24,6 +23,7 @@ class DevInstall extends Command /** * Run dev related commands + * * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException */ public function handle() @@ -32,7 +32,7 @@ class DevInstall extends Command $this->rewriteConfigs(); } - # Reload the configuration + // Reload the configuration \App::boot(); $this->info('Recreating database'); @@ -45,13 +45,13 @@ class DevInstall extends Command '--seed' => true, ]); - # - # + // + // $this->info('Importing sample data'); - foreach($this->yaml_imports as $yml) { + foreach ($this->yaml_imports as $yml) { $this->call('phpvms:yaml-import', [ - 'files' => ['app/Database/seeds/' . $yml], + 'files' => ['app/Database/seeds/'.$yml], ]); } @@ -60,6 +60,7 @@ class DevInstall extends Command /** * Rewrite the configuration files + * * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException */ protected function rewriteConfigs() @@ -68,7 +69,7 @@ class DevInstall extends Command $this->info('Removing the old config files'); - # Remove the old files + // Remove the old files $config_file = base_path('config.php'); if (file_exists($config_file)) { unlink($config_file); diff --git a/app/Console/Commands/ImportCsv.php b/app/Console/Commands/ImportCsv.php index dceb3374..4621a2aa 100644 --- a/app/Console/Commands/ImportCsv.php +++ b/app/Console/Commands/ImportCsv.php @@ -1,7 +1,4 @@ importer->importSubfleets($file); } - foreach($status['success'] as $line) { + foreach ($status['success'] as $line) { $this->info($line); } diff --git a/app/Console/Commands/ImportFromClassic.php b/app/Console/Commands/ImportFromClassic.php index a5380f99..35183f78 100644 --- a/app/Console/Commands/ImportFromClassic.php +++ b/app/Console/Commands/ImportFromClassic.php @@ -19,7 +19,7 @@ class ImportFromClassic extends Command 'name' => $this->argument('db_name'), 'user' => $this->argument('db_user'), 'pass' => $this->argument('db_pass'), - 'table_prefix' => $this->argument('table_prefix') + 'table_prefix' => $this->argument('table_prefix'), ]; $importerSvc = new \App\Console\Services\Importer($db_creds); diff --git a/app/Console/Commands/NavdataImport.php b/app/Console/Commands/NavdataImport.php index b993e404..93550d76 100644 --- a/app/Console/Commands/NavdataImport.php +++ b/app/Console/Commands/NavdataImport.php @@ -8,7 +8,6 @@ use App\Models\Navdata; /** * Class NavdataImport - * @package App\Console\Commands */ class NavdataImport extends Command { @@ -16,8 +15,9 @@ class NavdataImport extends Command protected $description = ''; /** - * @return void * @throws \League\Geotools\Exception\InvalidArgumentException + * + * @return void */ public function handle() { @@ -31,8 +31,10 @@ class NavdataImport extends Command /** * Read and parse in the navaid file - * @return void + * * @throws \League\Geotools\Exception\InvalidArgumentException + * + * @return void */ public function read_wp_nav_aid(): void { @@ -87,7 +89,7 @@ class NavdataImport extends Command 'class' => trim($line[60]), ]; - # Map to the Navaid enum + // Map to the Navaid enum switch ($navaid['type']) { case 'ILS': $navaid['type'] = NavaidType::LOC; @@ -117,7 +119,7 @@ class NavdataImport extends Command }*/ Navdata::updateOrCreate([ - 'id' => $navaid['id'], 'name' => $navaid['name'] + 'id' => $navaid['id'], 'name' => $navaid['name'], ], $navaid); $imported++; @@ -173,7 +175,7 @@ class NavdataImport extends Command ]; Navdata::updateOrCreate([ - 'id' => $navfix['id'], 'name' => $navfix['name'] + 'id' => $navfix['id'], 'name' => $navfix['name'], ], $navfix); $imported++; diff --git a/app/Console/Commands/TestApi.php b/app/Console/Commands/TestApi.php index a4d01723..d65441cf 100644 --- a/app/Console/Commands/TestApi.php +++ b/app/Console/Commands/TestApi.php @@ -7,7 +7,6 @@ use GuzzleHttp\Client; /** * Class TestApi - * @package App\Console\Commands */ class TestApi extends Command { @@ -24,7 +23,7 @@ class TestApi extends Command 'Authorization' => $this->argument('apikey'), 'Content-type' => 'application/json', 'X-API-Key' => $this->argument('apikey'), - ] + ], ]); $result = $this->httpClient->get($this->argument('url')); diff --git a/app/Console/Commands/Version.php b/app/Console/Commands/Version.php index 5e2bd52f..cd153de6 100644 --- a/app/Console/Commands/Version.php +++ b/app/Console/Commands/Version.php @@ -7,7 +7,6 @@ use Symfony\Component\Yaml\Yaml; /** * Class Version - * @package App\Console\Commands */ class Version extends Command { @@ -15,13 +14,15 @@ class Version extends Command /** * Create the version number that gets written out + * + * @param mixed $cfg */ protected function createVersionNumber($cfg) { exec($cfg['git']['git-local'], $version); $version = substr($version[0], 0, $cfg['build']['length']); - # prefix with the date in YYMMDD format + // prefix with the date in YYMMDD format $date = date('ymd'); $version = $date.'-'.$version; @@ -30,6 +31,7 @@ class Version extends Command /** * Run dev related commands + * * @throws \Symfony\Component\Yaml\Exception\ParseException */ public function handle() @@ -37,7 +39,7 @@ class Version extends Command $version_file = config_path('version.yml'); $cfg = Yaml::parse(file_get_contents($version_file)); - # Get the current build id + // Get the current build id $build_number = $this->createVersionNumber($cfg); $cfg['build']['number'] = $build_number; @@ -48,13 +50,13 @@ class Version extends Command file_put_contents($version_file, Yaml::dump($cfg, 4, 2)); } - # Only show the major.minor.patch version + // Only show the major.minor.patch version if ($this->option('base-only')) { $version = 'v'.$cfg['current']['major'].'.' .$cfg['current']['minor'].'.' .$cfg['current']['patch']; } - print $version."\n"; + echo $version."\n"; } } diff --git a/app/Console/Commands/YamlExport.php b/app/Console/Commands/YamlExport.php index f5c5902a..19775c92 100644 --- a/app/Console/Commands/YamlExport.php +++ b/app/Console/Commands/YamlExport.php @@ -9,7 +9,6 @@ use Symfony\Component\Yaml\Yaml; /** * Class YamlExport - * @package App\Console\Commands */ class YamlExport extends Command { @@ -18,6 +17,7 @@ class YamlExport extends Command /** * YamlExport constructor. + * * @param DatabaseService $dbSvc */ public function __construct(DatabaseService $dbSvc) @@ -47,6 +47,6 @@ class YamlExport extends Command } $yaml = Yaml::dump($export_tables, 4, 2); - print($yaml); + echo $yaml; } } diff --git a/app/Console/Commands/YamlImport.php b/app/Console/Commands/YamlImport.php index d7725dc0..8eb137a9 100644 --- a/app/Console/Commands/YamlImport.php +++ b/app/Console/Commands/YamlImport.php @@ -7,7 +7,6 @@ use App\Services\DatabaseService; /** * Class YamlImport - * @package App\Console\Commands */ class YamlImport extends Command { @@ -17,6 +16,7 @@ class YamlImport extends Command /** * YamlImport constructor. + * * @param DatabaseService $dbSvc */ public function __construct(DatabaseService $dbSvc) @@ -27,6 +27,7 @@ class YamlImport extends Command /** * Run dev related commands + * * @throws \Exception */ public function handle() diff --git a/app/Console/Cron/Hourly.php b/app/Console/Cron/Hourly.php index def6d7c5..e278b7fd 100644 --- a/app/Console/Cron/Hourly.php +++ b/app/Console/Cron/Hourly.php @@ -8,7 +8,6 @@ use App\Events\CronHourly; /** * This just calls the CronHourly event, so all of the * listeners, etc can just be called to run those tasks - * @package App\Console\Cron */ class Hourly extends Command { @@ -16,9 +15,6 @@ class Hourly extends Command protected $description = 'Run the hourly cron tasks'; protected $schedule; - /** - * - */ public function handle(): void { $this->redirectLoggingToStdout('cron'); diff --git a/app/Console/Cron/Monthly.php b/app/Console/Cron/Monthly.php index f18fcfcd..efa3e445 100644 --- a/app/Console/Cron/Monthly.php +++ b/app/Console/Cron/Monthly.php @@ -10,9 +10,6 @@ use App\Events\CronMonthly; * listeners, etc can just be called to run those tasks * * The actual cron tasks are in app/Cron - * - * @package App\Console\Cron - * */ class Monthly extends Command { @@ -20,9 +17,6 @@ class Monthly extends Command protected $description = 'Run the monthly cron tasks'; protected $schedule; - /** - * - */ public function handle(): void { $this->redirectLoggingToStdout('cron'); diff --git a/app/Console/Cron/Nightly.php b/app/Console/Cron/Nightly.php index 1b2d69ad..9f0131dd 100644 --- a/app/Console/Cron/Nightly.php +++ b/app/Console/Cron/Nightly.php @@ -8,10 +8,8 @@ use App\Events\CronNightly; /** * This just calls the CronNightly event, so all of the * listeners, etc can just be called to run those tasks - * - * The actual cron tasks are in app/Cron * - * @package App\Console\Cron + * The actual cron tasks are in app/Cron */ class Nightly extends Command { @@ -19,9 +17,6 @@ class Nightly extends Command protected $description = 'Run the nightly cron tasks'; protected $schedule; - /** - * - */ public function handle(): void { $this->redirectLoggingToStdout('cron'); diff --git a/app/Console/Cron/Weekly.php b/app/Console/Cron/Weekly.php index d41c021d..4109d127 100644 --- a/app/Console/Cron/Weekly.php +++ b/app/Console/Cron/Weekly.php @@ -10,8 +10,6 @@ use App\Events\CronWeekly; * listeners, etc can just be called to run those tasks. * * The actual cron tasks are in app/Cron - * - * @package App\Console\Cron */ class Weekly extends Command { @@ -19,9 +17,6 @@ class Weekly extends Command protected $description = 'Run the weekly cron tasks'; protected $schedule; - /** - * - */ public function handle(): void { $this->redirectLoggingToStdout('cron'); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 0e56bb88..76008907 100755 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -11,7 +11,6 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel; /** * Class Kernel - * @package App\Console */ class Kernel extends ConsoleKernel { @@ -27,7 +26,9 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. - * @param \Illuminate\Console\Scheduling\Schedule $schedule + * + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * * @return void */ protected function schedule(Schedule $schedule): void @@ -40,6 +41,7 @@ class Kernel extends ConsoleKernel /** * Register the Closure based commands for the application. + * * @return void */ protected function commands(): void diff --git a/app/Console/Logger.php b/app/Console/Logger.php index c1945a31..aa64354f 100644 --- a/app/Console/Logger.php +++ b/app/Console/Logger.php @@ -6,13 +6,13 @@ use Monolog\Handler\StreamHandler; /** * Just a simple custom logger that dumps to the console - * @package App\Console */ class Logger { public function __invoke(array $config) { $logger = new \Monolog\Logger('console'); + try { $logger->pushHandler(new StreamHandler('php://stdout')); } catch (\Exception $e) { diff --git a/app/Console/Services/Database.php b/app/Console/Services/Database.php index 222787d4..aa1dae51 100644 --- a/app/Console/Services/Database.php +++ b/app/Console/Services/Database.php @@ -2,20 +2,20 @@ namespace App\Console\Services; -use PDOException; use PDO; /** * Class Database - * @package App\Console\Services */ class Database { /** * Create the base connection DSN, optionally include the DB name + * * @param $host * @param $port * @param null $name + * * @return string */ public function createDsn($host, $port, $name = null) @@ -33,8 +33,10 @@ class Database * @param $dsn * @param $user * @param $pass - * @return PDO + * * @throws \PDOException + * + * @return PDO */ public function createPDO($dsn, $user, $pass) { diff --git a/app/Console/Services/Importer.php b/app/Console/Services/Importer.php index 69b96c4d..305868be 100644 --- a/app/Console/Services/Importer.php +++ b/app/Console/Services/Importer.php @@ -15,17 +15,16 @@ use App\Models\Rank; use App\Models\Subfleet; use App\Models\User; use Carbon\Carbon; -use PDOException; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; use PDO; +use PDOException; use Symfony\Component\Console\Output\ConsoleOutput; /** * Class Importer * TODO: Batch import - * @package App\Console\Services */ class Importer { @@ -36,6 +35,7 @@ class Importer /** * Hold the PDO connection to the old database + * * @var */ private $conn; @@ -47,6 +47,7 @@ class Importer /** * Hold the instance of the console logger + * * @var */ private $log; @@ -54,12 +55,12 @@ class Importer /** * CONSTANTS */ - const BATCH_READ_ROWS = 300; - const SUBFLEET_NAME = 'Imported Aircraft'; + const SUBFLEET_NAME = 'Imported Aircraft'; /** * Importer constructor. + * * @param $db_creds */ public function __construct($db_creds) @@ -67,14 +68,14 @@ class Importer // Setup the logger $this->log = new ConsoleOutput(); - # The db credentials + // The db credentials $this->creds = array_merge([ 'host' => '127.0.0.1', 'port' => 3306, 'name' => '', 'user' => '', 'pass' => '', - 'table_prefix' => 'phpvms_' + 'table_prefix' => 'phpvms_', ], $db_creds); } @@ -85,7 +86,7 @@ class Importer { $this->reconnect(); - # Import all the different parts + // Import all the different parts $this->importRanks(); $this->importAirlines(); $this->importAircraft(); @@ -95,7 +96,7 @@ class Importer $this->importFlights(); $this->importPireps(); - # Finish up + // Finish up $this->findLastPireps(); $this->recalculateRanks(); } @@ -108,7 +109,7 @@ class Importer $dsn = 'mysql:'.implode(';', [ 'host='.$this->creds['host'], 'port='.$this->creds['port'], - 'dbname='.$this->creds['name'] + 'dbname='.$this->creds['name'], ]); $this->info('Connection string: '.$dsn); @@ -152,7 +153,9 @@ class Importer /** * Return the table name with the prefix + * * @param $table + * * @return string */ protected function tableName($table) @@ -165,8 +168,8 @@ class Importer } /** - * * @param \Illuminate\Database\Eloquent\Model $model + * * @return bool */ protected function saveModel($model) @@ -186,6 +189,7 @@ class Importer /** * Create a new mapping between an old ID and the new one + * * @param $entity * @param $old_id * @param $new_id @@ -201,8 +205,10 @@ class Importer /** * Return the ID for a mapping + * * @param $entity * @param $old_id + * * @return bool */ protected function getMapping($entity, $old_id) @@ -221,6 +227,7 @@ class Importer /** * @param $date + * * @return Carbon */ protected function parseDate($date) @@ -232,7 +239,9 @@ class Importer /** * Take a decimal duration and convert it to minutes + * * @param $duration + * * @return float|int */ protected function convertDuration($duration) @@ -242,7 +251,7 @@ class Importer } elseif (strpos($duration, ':')) { $delim = ':'; } else { - # no delimiter, assume it's just a straight hour + // no delimiter, assume it's just a straight hour return (int) $duration * 60; } @@ -255,6 +264,7 @@ class Importer /** * @param $table + * * @return mixed */ protected function getTotalRows($table) @@ -271,8 +281,10 @@ class Importer /** * Read all the rows in a table, but read them in a batched manner + * * @param string $table The name of the table * @param null $read_rows Number of rows to read + * * @return \Generator */ protected function readRows($table, $read_rows = null) @@ -318,6 +330,7 @@ class Importer /** * Return the subfleet + * * @return mixed */ protected function getSubfleet() @@ -332,10 +345,8 @@ class Importer } /** - * * All the individual importers, done on a per-table basis * Some tables get saved locally for tables that use FK refs - * */ /** @@ -356,7 +367,7 @@ class Importer $this->addMapping('ranks', $row->rank, $rank->id); if ($rank->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -382,7 +393,7 @@ class Importer $this->addMapping('airlines', $row->code, $airline->id); if ($airline->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -406,13 +417,13 @@ class Importer ['name' => $row->fullname, 'registration' => $row->registration], ['icao' => $row->icao, 'subfleet_id' => $subfleet->id, - 'active' => $row->enabled + 'active' => $row->enabled, ]); $this->addMapping('aircraft', $row->id, $aircraft->id); if ($aircraft->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -444,7 +455,7 @@ class Importer ); if ($airport->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -483,7 +494,7 @@ class Importer $attrs ); } catch (\Exception $e) { - #$this->error($e); + //$this->error($e); } $this->addMapping('flights', $row->id, $flight->id); @@ -491,7 +502,7 @@ class Importer // TODO: deserialize route_details into ACARS table if ($flight->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -513,7 +524,7 @@ class Importer $aircraft_id = $this->getMapping('aircraft', $row->aircraft); $attrs = [ - #'id' => $pirep_id, + //'id' => $pirep_id, 'user_id' => $user_id, 'airline_id' => $airline_id, 'aircraft_id' => $aircraft_id, @@ -527,24 +538,24 @@ class Importer 'updated_at' => $this->parseDate($row->modifieddate), ]; - # Set the distance + // Set the distance $distance = round($row->distance ?: 0, 2); $attrs['distance'] = $distance; $attrs['planned_distance'] = $distance; - # Set the flight time properly + // Set the flight time properly $duration = $this->convertDuration($row->flighttime_stamp); $attrs['flight_time'] = $duration; $attrs['planned_flight_time'] = $duration; - # Set how it was filed + // Set how it was filed if (strtoupper($row->source) === 'MANUAL') { $attrs['source'] = PirepSource::MANUAL; } else { $attrs['source'] = PirepSource::ACARS; } - # Set the flight type + // Set the flight type $row->flighttype = strtoupper($row->flighttype); if ($row->flighttype === 'P') { $attrs['flight_type'] = FlightType::SCHED_PAX; @@ -554,7 +565,7 @@ class Importer $attrs['flight_type'] = FlightType::CHARTER_PAX_ONLY; } - # Set the flight level of the PIREP is set + // Set the flight level of the PIREP is set if (property_exists($row, 'flightlevel')) { $attrs['level'] = $row->flightlevel; } else { @@ -568,18 +579,18 @@ class Importer $source = strtoupper($row->source); if ($source === 'SMARTCARS') { - # TODO: Parse smartcars log into the acars table + // TODO: Parse smartcars log into the acars table } elseif ($source === 'KACARS') { - # TODO: Parse kACARS log into acars table + // TODO: Parse kACARS log into acars table } elseif ($source === 'XACARS') { - # TODO: Parse XACARS log into acars table + // TODO: Parse XACARS log into acars table } - # TODO: Add extra fields in as PIREP fields + // TODO: Add extra fields in as PIREP fields $this->addMapping('pireps', $row->pirepid, $pirep->id); if ($pirep->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -592,7 +603,7 @@ class Importer $count = 0; foreach ($this->readRows('pilots', 50) as $row) { - # TODO: What to do about pilot ids + // TODO: What to do about pilot ids $name = $row->firstname.' '.$row->lastname; @@ -624,7 +635,7 @@ class Importer $this->addMapping('users', $row->pilotid, $user->id); if ($user->wasRecentlyCreated) { - ++$count; + $count++; } } @@ -648,7 +659,9 @@ class Importer /** * Get the user's new state from their original state + * * @param $state + * * @return int */ protected function getUserState($state) @@ -662,21 +675,20 @@ class Importer 'ACTIVE' => 0, 'INACTIVE' => 1, 'BANNED' => 2, - 'ON_LEAVE' => 3 + 'ON_LEAVE' => 3, ]; // Decide which state they will be in accordance with v7 if ($state === $phpvms_classic_states['ACTIVE']) { return UserState::ACTIVE; } elseif ($state === $phpvms_classic_states['INACTIVE']) { - # TODO: Make an inactive state? + // TODO: Make an inactive state? return UserState::REJECTED; } elseif ($state === $phpvms_classic_states['BANNED']) { return UserState::SUSPENDED; } elseif ($state === $phpvms_classic_states['ON_LEAVE']) { return UserState::ON_LEAVE; - } else { - $this->error('Unknown status: '.$state); } + $this->error('Unknown status: '.$state); } } diff --git a/app/Cron/Hourly/RemoveExpiredBids.php b/app/Cron/Hourly/RemoveExpiredBids.php index 319018a0..f3e942db 100644 --- a/app/Cron/Hourly/RemoveExpiredBids.php +++ b/app/Cron/Hourly/RemoveExpiredBids.php @@ -9,18 +9,19 @@ use Carbon\Carbon; /** * Remove expired bids - * @package App\Listeners\Cron\Hourly */ class RemoveExpiredBids extends Listener { /** * Remove expired bids + * * @param CronHourly $event + * * @throws \Exception */ public function handle(CronHourly $event): void { - if(setting('bids.expire_time') === 0) { + if (setting('bids.expire_time') === 0) { return; } diff --git a/app/Cron/Monthly/ApplyExpenses.php b/app/Cron/Monthly/ApplyExpenses.php index 619ed5ae..6acfd942 100644 --- a/app/Cron/Monthly/ApplyExpenses.php +++ b/app/Cron/Monthly/ApplyExpenses.php @@ -9,7 +9,6 @@ use App\Services\Finance\RecurringFinanceService; /** * Go through and apply any finances that are daily - * @package App\Listeners\Cron\Nightly */ class ApplyExpenses extends Listener { @@ -17,6 +16,7 @@ class ApplyExpenses extends Listener /** * ApplyExpenses constructor. + * * @param RecurringFinanceService $financeSvc */ public function __construct(RecurringFinanceService $financeSvc) @@ -26,7 +26,9 @@ class ApplyExpenses extends Listener /** * Apply all of the expenses for a month + * * @param CronMonthly $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException diff --git a/app/Cron/Nightly/ApplyExpenses.php b/app/Cron/Nightly/ApplyExpenses.php index 22307cb4..1d30a0f5 100644 --- a/app/Cron/Nightly/ApplyExpenses.php +++ b/app/Cron/Nightly/ApplyExpenses.php @@ -9,7 +9,6 @@ use App\Services\Finance\RecurringFinanceService; /** * Go through and apply any finances that are daily - * @package App\Listeners\Cron\Nightly */ class ApplyExpenses extends Listener { @@ -17,6 +16,7 @@ class ApplyExpenses extends Listener /** * ApplyExpenses constructor. + * * @param RecurringFinanceService $financeSvc */ public function __construct(RecurringFinanceService $financeSvc) @@ -26,7 +26,9 @@ class ApplyExpenses extends Listener /** * Apply all of the expenses for a day + * * @param CronNightly $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException diff --git a/app/Cron/Nightly/PilotLeave.php b/app/Cron/Nightly/PilotLeave.php index 8128c69c..78c6ffd1 100644 --- a/app/Cron/Nightly/PilotLeave.php +++ b/app/Cron/Nightly/PilotLeave.php @@ -11,7 +11,6 @@ use Carbon\Carbon; /** * Determine if any pilots should be set to ON LEAVE status - * @package App\Listeners\Cron\Nightly */ class PilotLeave extends Listener { @@ -27,13 +26,15 @@ class PilotLeave extends Listener /** * Set any users to being on leave after X days + * * @param CronNightly $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ public function handle(CronNightly $event): void { - if(setting('pilots.auto_leave_days') === 0) { + if (setting('pilots.auto_leave_days') === 0) { return; } @@ -41,7 +42,7 @@ class PilotLeave extends Listener $users = User::where('status', UserState::ACTIVE) ->whereDate('updated_at', '<', $date); - foreach($users as $user) { + foreach ($users as $user) { Log::info('Setting user '.$user->ident.' to ON LEAVE status'); $this->userSvc->setStatusOnLeave($user); } diff --git a/app/Cron/Nightly/RecalculateBalances.php b/app/Cron/Nightly/RecalculateBalances.php index b713ee55..b78103fd 100644 --- a/app/Cron/Nightly/RecalculateBalances.php +++ b/app/Cron/Nightly/RecalculateBalances.php @@ -10,7 +10,6 @@ use Log; /** * This recalculates the balances on all of the journals - * @package App\Listeners\Cron */ class RecalculateBalances extends Listener { @@ -18,6 +17,7 @@ class RecalculateBalances extends Listener /** * Nightly constructor. + * * @param JournalRepository $journalRepo */ public function __construct(JournalRepository $journalRepo) @@ -27,7 +27,9 @@ class RecalculateBalances extends Listener /** * Recalculate all the balances for the different ledgers + * * @param CronNightly $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ diff --git a/app/Cron/Nightly/RecalculateStats.php b/app/Cron/Nightly/RecalculateStats.php index 71947836..84cdfac0 100644 --- a/app/Cron/Nightly/RecalculateStats.php +++ b/app/Cron/Nightly/RecalculateStats.php @@ -5,19 +5,17 @@ namespace App\Cron\Nightly; use App\Events\CronNightly; use App\Interfaces\Listener; use App\Models\Enums\UserState; -use App\Models\Journal; use App\Repositories\UserRepository; use App\Services\UserService; use Log; /** * This recalculates the balances on all of the journals - * @package App\Listeners\Cron */ class RecalculateStats extends Listener { - private $userRepo, - $userSvc; + private $userRepo; + private $userSvc; public function __construct(UserRepository $userRepo, UserService $userService) { @@ -27,7 +25,9 @@ class RecalculateStats extends Listener /** * Recalculate the stats for active users + * * @param CronNightly $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ @@ -36,7 +36,7 @@ class RecalculateStats extends Listener Log::info('Recalculating balances'); $w = [ - ['state', '!=', UserState::REJECTED] + ['state', '!=', UserState::REJECTED], ]; $users = $this->userRepo->findWhere($w, ['id', 'name', 'airline_id']); diff --git a/app/Cron/Nightly/SetActiveFlights.php b/app/Cron/Nightly/SetActiveFlights.php index c68b96a0..311d89d5 100644 --- a/app/Cron/Nightly/SetActiveFlights.php +++ b/app/Cron/Nightly/SetActiveFlights.php @@ -11,7 +11,6 @@ use Illuminate\Support\Facades\Log; /** * Figure out what flights need to be active for today - * @package App\Cron\Nightly */ class SetActiveFlights extends Listener { @@ -38,7 +37,7 @@ class SetActiveFlights extends Listener /** * @var Flight $flight */ - foreach($flights as $flight) { + foreach ($flights as $flight) { if (!$flight->active) { continue; } @@ -73,8 +72,8 @@ class SetActiveFlights extends Listener if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) { if ($flight->days !== null && $flight->days > 0) { $visible = Days::isToday($flight->days); - if($flight->visible !== $visible) { - Log::info('Toggling flight '.$flight->ident.' to '.($visible?'shown':'hidden').''); + if ($flight->visible !== $visible) { + Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').''); $flight->visible = $visible; if ($visible === false) { diff --git a/app/Database/factories/AircraftFactory.php b/app/Database/factories/AircraftFactory.php index 25453ed4..17062581 100644 --- a/app/Database/factories/AircraftFactory.php +++ b/app/Database/factories/AircraftFactory.php @@ -4,11 +4,11 @@ use Faker\Generator as Faker; $factory->define(App\Models\Aircraft::class, function (Faker $faker) { return [ - 'id' => null, - 'subfleet_id' => function () { + 'id' => null, + 'subfleet_id' => function () { return factory(App\Models\Subfleet::class)->create()->id; }, - 'airport_id' => function () { + 'airport_id' => function () { return factory(App\Models\Airport::class)->create()->id; }, 'iata' => $faker->unique()->text(5), diff --git a/app/Database/factories/AirlineFactory.php b/app/Database/factories/AirlineFactory.php index 143ccf81..25224b74 100644 --- a/app/Database/factories/AirlineFactory.php +++ b/app/Database/factories/AirlineFactory.php @@ -3,23 +3,23 @@ use Faker\Generator as Faker; use Hashids\Hashids; -/** +/* * Add any number of airports. Don't really care if they're real or not */ $factory->define(App\Models\Airline::class, function (Faker $faker) { return [ - 'id' => null, - 'icao' => function (array $apt) use ($faker) { + 'id' => null, + 'icao' => function (array $apt) use ($faker) { $hashids = new Hashids(microtime(), 5); $mt = str_replace('.', '', microtime(true)); return $hashids->encode($mt); }, - 'iata' => function (array $apt) { + 'iata' => function (array $apt) { return $apt['icao']; }, 'name' => $faker->sentence(3), 'country' => $faker->country, - 'active' => 1 + 'active' => 1, ]; }); diff --git a/app/Database/factories/AirportFactory.php b/app/Database/factories/AirportFactory.php index a1b686d0..1909a8f5 100644 --- a/app/Database/factories/AirportFactory.php +++ b/app/Database/factories/AirportFactory.php @@ -2,7 +2,7 @@ use Faker\Generator as Faker; -/** +/* * Add any number of airports. Don't really care if they're real or not */ $factory->define(App\Models\Airport::class, function (Faker $faker) { @@ -17,10 +17,10 @@ $factory->define(App\Models\Airport::class, function (Faker $faker) { return $string; }, - 'icao' => function (array $apt) { + 'icao' => function (array $apt) { return $apt['id']; }, - 'iata' => function (array $apt) { + 'iata' => function (array $apt) { return $apt['id']; }, 'name' => $faker->sentence(3), diff --git a/app/Database/factories/FareFactory.php b/app/Database/factories/FareFactory.php index 634e573f..56e8ee78 100644 --- a/app/Database/factories/FareFactory.php +++ b/app/Database/factories/FareFactory.php @@ -4,11 +4,11 @@ use Faker\Generator as Faker; $factory->define(App\Models\Fare::class, function (Faker $faker) { return [ - 'id' => null, - 'code' => $faker->unique()->text(50), - 'name' => $faker->text(50), - 'price' => $faker->randomFloat(2, 100, 1000), - 'cost' => function (array $fare) { + 'id' => null, + 'code' => $faker->unique()->text(50), + 'name' => $faker->text(50), + 'price' => $faker->randomFloat(2, 100, 1000), + 'cost' => function (array $fare) { return round($fare['price'] / 2); }, 'capacity' => $faker->randomFloat(0, 20, 500), diff --git a/app/Database/factories/FlightFactory.php b/app/Database/factories/FlightFactory.php index 63b5e3bf..327ba2f4 100644 --- a/app/Database/factories/FlightFactory.php +++ b/app/Database/factories/FlightFactory.php @@ -2,13 +2,12 @@ /** * Create flights */ - use Faker\Generator as Faker; $factory->define(App\Models\Flight::class, function (Faker $faker) { return [ - 'id' => $faker->unique()->numberBetween(10, 10000000), - 'airline_id' => function () { + 'id' => $faker->unique()->numberBetween(10, 10000000), + 'airline_id' => function () { return factory(App\Models\Airline::class)->create()->id; }, 'flight_number' => $faker->unique()->numberBetween(10, 1000000), @@ -23,20 +22,20 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) { 'alt_airport_id' => function () { return factory(App\Models\Airport::class)->create()->id; }, - 'distance' => $faker->numberBetween(0, 3000), - 'route' => null, - 'level' => 0, - 'dpt_time' => $faker->time(), - 'arr_time' => $faker->time(), - 'flight_time' => $faker->numberBetween(60, 360), - 'has_bid' => false, - 'active' => true, - 'visible' => true, - 'days' => 0, - 'start_date' => null, - 'end_date' => null, - 'created_at' => $faker->dateTimeBetween('-1 week', 'now'), - 'updated_at' => function (array $flight) { + 'distance' => $faker->numberBetween(0, 3000), + 'route' => null, + 'level' => 0, + 'dpt_time' => $faker->time(), + 'arr_time' => $faker->time(), + 'flight_time' => $faker->numberBetween(60, 360), + 'has_bid' => false, + 'active' => true, + 'visible' => true, + 'days' => 0, + 'start_date' => null, + 'end_date' => null, + 'created_at' => $faker->dateTimeBetween('-1 week', 'now'), + 'updated_at' => function (array $flight) { return $flight['created_at']; }, ]; diff --git a/app/Database/factories/JournalTransactionsFactory.php b/app/Database/factories/JournalTransactionsFactory.php index a46d2693..55c80b9b 100644 --- a/app/Database/factories/JournalTransactionsFactory.php +++ b/app/Database/factories/JournalTransactionsFactory.php @@ -8,10 +8,10 @@ $factory->define(App\Models\JournalTransactions::class, function (Faker $faker) 'journal_id' => function () { return factory(App\Models\Journal::class)->create()->id; }, - 'credit' => $faker->numberBetween(100, 10000), - 'debit' => $faker->numberBetween(100, 10000), - 'currency' => 'USD', - 'memo' => $faker->sentence(6), - 'post_date' => \Carbon\Carbon::now(), + 'credit' => $faker->numberBetween(100, 10000), + 'debit' => $faker->numberBetween(100, 10000), + 'currency' => 'USD', + 'memo' => $faker->sentence(6), + 'post_date' => \Carbon\Carbon::now(), ]; }); diff --git a/app/Database/factories/NewsFactory.php b/app/Database/factories/NewsFactory.php index eda10901..1e0c6adb 100644 --- a/app/Database/factories/NewsFactory.php +++ b/app/Database/factories/NewsFactory.php @@ -5,7 +5,7 @@ use Faker\Generator as Faker; $factory->define(App\Models\News::class, function (Faker $faker) { return [ 'id' => null, - 'user_id' => function() { + 'user_id' => function () { return factory(App\Models\User::class)->create()->id; }, 'subject' => $faker->text(), diff --git a/app/Database/factories/PirepFactory.php b/app/Database/factories/PirepFactory.php index e7e94611..e08aeb82 100644 --- a/app/Database/factories/PirepFactory.php +++ b/app/Database/factories/PirepFactory.php @@ -3,32 +3,32 @@ use Carbon\Carbon; use Faker\Generator as Faker; -/** +/* * Create a new PIREP */ $factory->define(App\Models\Pirep::class, function (Faker $faker) { return [ - 'id' => $faker->unique()->numberBetween(10, 10000000), - 'airline_id' => function () { + 'id' => $faker->unique()->numberBetween(10, 10000000), + 'airline_id' => function () { return factory(App\Models\Airline::class)->create()->id; }, - 'user_id' => function () { + 'user_id' => function () { return factory(App\Models\User::class)->create()->id; }, - 'aircraft_id' => function () { + 'aircraft_id' => function () { return factory(App\Models\Aircraft::class)->create()->id; }, - 'flight_number' => function (array $pirep) { + 'flight_number' => function (array $pirep) { return factory(App\Models\Flight::class)->create([ - 'airline_id' => $pirep['airline_id'] + 'airline_id' => $pirep['airline_id'], ])->flight_number; }, - 'route_code' => null, - 'route_leg' => null, - 'dpt_airport_id' => function () { + 'route_code' => null, + 'route_leg' => null, + 'dpt_airport_id' => function () { return factory(App\Models\Airport::class)->create()->id; }, - 'arr_airport_id' => function () { + 'arr_airport_id' => function () { return factory(App\Models\Airport::class)->create()->id; }, 'level' => $faker->numberBetween(20, 400), @@ -43,15 +43,15 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) { 'block_off_time' => function (array $pirep) { return $pirep['block_on_time']->subMinutes($pirep['flight_time']); }, - 'route' => $faker->text(200), - 'notes' => $faker->text(200), - 'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]), - 'source_name' => 'Test Factory', - 'state' => PirepState::PENDING, - 'status' => PirepStatus::SCHEDULED, - 'submitted_at' => Carbon::now('UTC')->toDateTimeString(), - 'created_at' => Carbon::now('UTC')->toDateTimeString(), - 'updated_at' => function (array $pirep) { + 'route' => $faker->text(200), + 'notes' => $faker->text(200), + 'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]), + 'source_name' => 'Test Factory', + 'state' => PirepState::PENDING, + 'status' => PirepStatus::SCHEDULED, + 'submitted_at' => Carbon::now('UTC')->toDateTimeString(), + 'created_at' => Carbon::now('UTC')->toDateTimeString(), + 'updated_at' => function (array $pirep) { return $pirep['created_at']; }, ]; diff --git a/app/Database/factories/SubfleetFactory.php b/app/Database/factories/SubfleetFactory.php index 3fa500e6..d4e24459 100644 --- a/app/Database/factories/SubfleetFactory.php +++ b/app/Database/factories/SubfleetFactory.php @@ -4,8 +4,8 @@ use Faker\Generator as Faker; $factory->define(App\Models\Subfleet::class, function (Faker $faker) { return [ - 'id' => null, - 'airline_id' => function () { + 'id' => null, + 'airline_id' => function () { return factory(App\Models\Airline::class)->create()->id; }, 'name' => $faker->unique()->text(50), diff --git a/app/Database/factories/UserFactory.php b/app/Database/factories/UserFactory.php index f8a5d206..a6ae14f0 100644 --- a/app/Database/factories/UserFactory.php +++ b/app/Database/factories/UserFactory.php @@ -7,12 +7,12 @@ $factory->define(App\Models\User::class, function (Faker $faker) { static $password; return [ - 'id' => null, - 'name' => $faker->name, - 'email' => $faker->safeEmail, - 'password' => $password ?: $password = Hash::make('secret'), - 'api_key' => $faker->sha1, - 'airline_id' => function () { + 'id' => null, + 'name' => $faker->name, + 'email' => $faker->safeEmail, + 'password' => $password ?: $password = Hash::make('secret'), + 'api_key' => $faker->sha1, + 'airline_id' => function () { return factory(App\Models\Airline::class)->create()->id; }, 'rank_id' => 1, diff --git a/app/Database/migrations/2017_06_07_014930_create_settings_table.php b/app/Database/migrations/2017_06_07_014930_create_settings_table.php index b70fe1b5..19d5de55 100644 --- a/app/Database/migrations/2017_06_07_014930_create_settings_table.php +++ b/app/Database/migrations/2017_06_07_014930_create_settings_table.php @@ -30,7 +30,7 @@ class CreateSettingsTable extends Migration $table->timestamps(); }); - /** + /* * Initial default settings */ @@ -122,7 +122,7 @@ class CreateSettingsTable extends Migration 'description' => 'The units for temperature', ]); - /** + /* * ACARS Settings */ @@ -151,7 +151,7 @@ class CreateSettingsTable extends Migration 'description' => 'Initial zoom level on the map', ]); - /** + /* * BIDS */ @@ -179,7 +179,7 @@ class CreateSettingsTable extends Migration 'description' => 'Number of hours to expire bids after', ]); - /** + /* * PIREPS */ @@ -223,7 +223,7 @@ class CreateSettingsTable extends Migration 'description' => 'When a PIREP is accepted, remove the bid, if it exists', ]); - /** + /* * PILOTS */ diff --git a/app/Database/migrations/2017_06_08_0001_roles_permissions_tables.php b/app/Database/migrations/2017_06_08_0001_roles_permissions_tables.php index 63292b47..1116927d 100644 --- a/app/Database/migrations/2017_06_08_0001_roles_permissions_tables.php +++ b/app/Database/migrations/2017_06_08_0001_roles_permissions_tables.php @@ -8,7 +8,7 @@ class RolesPermissionsTables extends Migration /** * Run the migrations. * - * @return void + * @return void */ public function up() { @@ -67,7 +67,7 @@ class RolesPermissionsTables extends Migration $table->primary(['permission_id', 'role_id']); }); - # create a default user/role + // create a default user/role $roles = [ [ 'id' => 1, @@ -77,7 +77,7 @@ class RolesPermissionsTables extends Migration [ 'id' => 2, 'name' => 'user', - 'display_name' => 'Pilot' + 'display_name' => 'Pilot', ], ]; @@ -87,7 +87,7 @@ class RolesPermissionsTables extends Migration /** * Reverse the migrations. * - * @return void + * @return void */ public function down() { diff --git a/app/Database/migrations/2017_06_17_214650_create_flight_tables.php b/app/Database/migrations/2017_06_17_214650_create_flight_tables.php index a3f8b7b1..ce534c27 100644 --- a/app/Database/migrations/2017_06_17_214650_create_flight_tables.php +++ b/app/Database/migrations/2017_06_17_214650_create_flight_tables.php @@ -57,7 +57,7 @@ class CreateFlightTables extends Migration $table->primary(['flight_id', 'fare_id']); }); - /** + /* * Hold a master list of fields */ Schema::create('flight_fields', function (Blueprint $table) { @@ -66,7 +66,7 @@ class CreateFlightTables extends Migration $table->string('slug', 50)->nullable(); }); - /** + /* * The values for the actual fields */ Schema::create('flight_field_values', function (Blueprint $table) { diff --git a/app/Database/migrations/2017_06_21_165410_create_ranks_table.php b/app/Database/migrations/2017_06_21_165410_create_ranks_table.php index a4dd72f4..a4568167 100644 --- a/app/Database/migrations/2017_06_21_165410_create_ranks_table.php +++ b/app/Database/migrations/2017_06_21_165410_create_ranks_table.php @@ -39,7 +39,7 @@ class CreateRanksTable extends Migration 'hours' => 0, 'acars_base_pay_rate' => 50, 'manual_base_pay_rate' => 25, - ] + ], ]; $this->addData('ranks', $ranks); diff --git a/app/Database/migrations/2017_12_20_004147_create_navdata_tables.php b/app/Database/migrations/2017_12_20_004147_create_navdata_tables.php index 898f4f10..b4f59c19 100644 --- a/app/Database/migrations/2017_12_20_004147_create_navdata_tables.php +++ b/app/Database/migrations/2017_12_20_004147_create_navdata_tables.php @@ -13,7 +13,7 @@ class CreateNavdataTables extends Migration */ public function up() { - /** + /* * See for defs, modify/update based on this * https://github.com/skiselkov/openfmc/blob/master/airac.h */ diff --git a/app/Database/migrations/2018_01_28_180522_create_awards_table.php b/app/Database/migrations/2018_01_28_180522_create_awards_table.php index 4f0daf8a..03ef0a5e 100644 --- a/app/Database/migrations/2018_01_28_180522_create_awards_table.php +++ b/app/Database/migrations/2018_01_28_180522_create_awards_table.php @@ -19,11 +19,11 @@ class CreateAwardsTable extends Migration $table->text('description')->nullable(); $table->text('image_url')->nullable(); - # ref fields are expenses tied to some model object - # EG, the airports has an internal expense for gate costs + // ref fields are expenses tied to some model object + // EG, the airports has an internal expense for gate costs $table->string('ref_model')->nullable(); $table->text('ref_model_params')->nullable(); - #$table->string('ref_model_id', 36)->nullable(); + //$table->string('ref_model_id', 36)->nullable(); $table->timestamps(); diff --git a/app/Database/migrations/2018_02_26_185121_create_expenses_table.php b/app/Database/migrations/2018_02_26_185121_create_expenses_table.php index 0b217791..1c43086f 100644 --- a/app/Database/migrations/2018_02_26_185121_create_expenses_table.php +++ b/app/Database/migrations/2018_02_26_185121_create_expenses_table.php @@ -19,8 +19,8 @@ class CreateExpensesTable extends Migration $table->boolean('multiplier')->nullable()->default(0); $table->boolean('active')->nullable()->default(true); - # ref fields are expenses tied to some model object - # EG, the airports has an internal expense for gate costs + // ref fields are expenses tied to some model object + // EG, the airports has an internal expense for gate costs $table->string('ref_model')->nullable(); $table->string('ref_model_id', 36)->nullable(); diff --git a/app/Database/migrations/2018_04_01_193443_create_files_table.php b/app/Database/migrations/2018_04_01_193443_create_files_table.php index f275fbef..2a4cd308 100644 --- a/app/Database/migrations/2018_04_01_193443_create_files_table.php +++ b/app/Database/migrations/2018_04_01_193443_create_files_table.php @@ -1,13 +1,14 @@ [ 'status' => $status_code, 'message' => $message, - ] + ], ]; } /** * Render an exception into an HTTP response. * - * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Illuminate\Http\Request $request + * @param \Exception $exception + * * @return mixed */ public function render($request, Exception $exception) @@ -76,7 +81,7 @@ class Handler extends ExceptionHandler $error = $this->createError(404, $exception->getMessage()); } - # Custom exceptions should be extending HttpException + // Custom exceptions should be extending HttpException elseif ($exception instanceof HttpException) { $error = $this->createError( $exception->getStatusCode(), @@ -86,7 +91,7 @@ class Handler extends ExceptionHandler $headers = $exception->getHeaders(); } - # Create the detailed errors from the validation errors + // Create the detailed errors from the validation errors elseif ($exception instanceof ValidationException) { $error_messages = []; $errors = $exception->errors(); @@ -99,13 +104,11 @@ class Handler extends ExceptionHandler $error['error']['errors'] = $errors; Log::error('Validation errors', $errors); - } - - else { + } else { $error = $this->createError(400, $exception->getMessage()); } - # Only add trace if in dev + // Only add trace if in dev if (config('app.env') === 'dev') { $error['error']['trace'] = $exception->getTrace()[0]; } @@ -124,8 +127,9 @@ class Handler extends ExceptionHandler /** * Convert an authentication exception into an unauthenticated response. * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $exception + * * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) @@ -140,7 +144,9 @@ class Handler extends ExceptionHandler /** * Render the given HttpException. + * * @param HttpException $e + * * @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) @@ -153,7 +159,7 @@ class Handler extends ExceptionHandler ]); if (view()->exists("errors::{$status}")) { - #if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) { + //if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) { return response()->view("errors::{$status}", [ 'exception' => $e, 'SKIN_NAME' => config('phpvms.skin'), diff --git a/app/Exceptions/InternalError.php b/app/Exceptions/InternalError.php index 6013a8f4..39f2e4bb 100644 --- a/app/Exceptions/InternalError.php +++ b/app/Exceptions/InternalError.php @@ -3,14 +3,13 @@ namespace App\Exceptions; use Illuminate\Validation\ValidationException; -use Validator; use Log; +use Validator; /** * Show an internal error, bug piggyback off of the validation * exception type - this has a place to show up in the UI as a * flash message. - * @package App\Exceptions */ class InternalError extends ValidationException { @@ -19,6 +18,7 @@ class InternalError extends ValidationException /** * InternalError constructor. + * * @param string|null $message * @param null $field */ diff --git a/app/Exceptions/PirepCancelled.php b/app/Exceptions/PirepCancelled.php index 8db80e2a..61233c7a 100644 --- a/app/Exceptions/PirepCancelled.php +++ b/app/Exceptions/PirepCancelled.php @@ -6,7 +6,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException; /** * Class PirepCancelled - * @package App\Exceptions */ class PirepCancelled extends HttpException { diff --git a/app/Exceptions/SettingNotFound.php b/app/Exceptions/SettingNotFound.php index f5030f84..589f1cd4 100644 --- a/app/Exceptions/SettingNotFound.php +++ b/app/Exceptions/SettingNotFound.php @@ -6,7 +6,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException; /** * Class SettingNotFound - * @package App\Exceptions */ class SettingNotFound extends HttpException { diff --git a/app/Exceptions/UserNotAtAirport.php b/app/Exceptions/UserNotAtAirport.php index 5ec73ee5..ef65c3ea 100644 --- a/app/Exceptions/UserNotAtAirport.php +++ b/app/Exceptions/UserNotAtAirport.php @@ -2,10 +2,8 @@ namespace App\Exceptions; - /** * Class UserNotAtAirport - * @package App\Exceptions */ class UserNotAtAirport extends InternalError { diff --git a/app/Facades/Utils.php b/app/Facades/Utils.php index 0c5a4d63..6a17e0bd 100644 --- a/app/Facades/Utils.php +++ b/app/Facades/Utils.php @@ -7,7 +7,6 @@ use Illuminate\Support\Facades\Facade; /** * Class Utils - * @package App\Facades */ class Utils extends Facade { @@ -21,7 +20,9 @@ class Utils extends Facade /** * Simple check on the first character if it's an object or not + * * @param $obj + * * @return bool */ public static function isObject($obj) @@ -40,10 +41,13 @@ class Utils extends Facade /** * Download a URI. If a file is given, it will save the downloaded * content into that file + * * @param $uri * @param null $file - * @return string + * * @throws \RuntimeException + * + * @return string */ public static function downloadUrl($uri, $file = null) { @@ -65,6 +69,7 @@ class Utils extends Facade /** * Returns a 40 character API key that a user can use + * * @return string */ public static function generateApiKey() @@ -89,13 +94,15 @@ class Utils extends Facade /** * Convert seconds to an array of hours, minutes, seconds + * * @param $seconds + * * @return array['h', 'm', 's'] */ public static function secondsToTimeParts($seconds): array { - $dtF = new \DateTime('@0', new \DateTimeZone('UTC')); - $dtT = new \DateTime("@$seconds", new \DateTimeZone('UTC')); + $dtF = new \DateTimeImmutable('@0', new \DateTimeZone('UTC')); + $dtT = new \DateTimeImmutable("@$seconds", new \DateTimeZone('UTC')); $t = $dtF->diff($dtT); @@ -109,8 +116,10 @@ class Utils extends Facade /** * Convert seconds to HH MM format + * * @param $seconds * @param bool $incl_sec + * * @return string */ public static function secondsToTimeString($seconds, $incl_sec = false): string @@ -126,6 +135,7 @@ class Utils extends Facade /** * @param $minutes + * * @return float|int */ public static function minutesToSeconds($minutes) @@ -135,7 +145,9 @@ class Utils extends Facade /** * Convert the seconds to minutes and then round it up + * * @param $seconds + * * @return float|int */ public static function secondsToMinutes($seconds) @@ -145,7 +157,9 @@ class Utils extends Facade /** * Convert hours to minutes. Pretty complex + * * @param $minutes + * * @return float|int */ public static function minutesToHours($minutes) @@ -156,6 +170,7 @@ class Utils extends Facade /** * @param $hours * @param null $minutes + * * @return float|int */ public static function hoursToMinutes($hours, $minutes = null) @@ -170,8 +185,10 @@ class Utils extends Facade /** * Bitwise operator for setting days of week to integer field + * * @param int $datefield initial datefield * @param array $day_enums Array of values from config("enum.days") + * * @return int */ public static function setDays(int $datefield, array $day_enums) @@ -185,8 +202,10 @@ class Utils extends Facade /** * Bit check if a day exists within a integer bitfield + * * @param int $datefield datefield from database * @param int $day_enum Value from config("enum.days") + * * @return bool */ public static function hasDay(int $datefield, int $day_enum) diff --git a/app/Http/Controllers/Admin/AircraftController.php b/app/Http/Controllers/Admin/AircraftController.php index 556fc30a..817debf3 100644 --- a/app/Http/Controllers/Admin/AircraftController.php +++ b/app/Http/Controllers/Admin/AircraftController.php @@ -16,20 +16,19 @@ use App\Services\ImportService; use Flash; use Illuminate\Http\Request; use Log; -use Prettus\Repository\Criteria\RequestCriteria; use Storage; /** * Class AircraftController - * @package App\Http\Controllers\Admin */ class AircraftController extends Controller { - private $aircraftRepo, - $importSvc; + private $aircraftRepo; + private $importSvc; /** * AircraftController constructor. + * * @param AircraftRepository $aircraftRepo * @param ImportService $importSvc */ @@ -43,16 +42,19 @@ class AircraftController extends Controller /** * Display a listing of the Aircraft. + * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { // If subfleet ID is passed part of the query string, then only // show the aircraft that are in that subfleet $w = []; - if($request->filled('subfleet')) { + if ($request->filled('subfleet')) { $w['subfleet_id'] = $request->input('subfleet'); } @@ -60,27 +62,30 @@ class AircraftController extends Controller $aircraft = $aircraft->all(); return view('admin.aircraft.index', [ - 'aircraft' => $aircraft, + 'aircraft' => $aircraft, 'subfleet_id' => $request->input('subfleet'), ]); } /** * Show the form for creating a new Aircraft. + * * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create(Request $request) { return view('admin.aircraft.create', [ - 'subfleets' => Subfleet::all()->pluck('name', 'id'), - 'statuses' => AircraftStatus::select(true), - 'subfleet_id' => $request->query('subfleet') + 'subfleets' => Subfleet::all()->pluck('name', 'id'), + 'statuses' => AircraftStatus::select(true), + 'subfleet_id' => $request->query('subfleet'), ]); } /** * Store a newly created Aircraft in storage. + * * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function store(CreateAircraftRequest $request) @@ -94,6 +99,8 @@ class AircraftController extends Controller /** * Display the specified Aircraft. + * + * @param mixed $id */ public function show($id) { @@ -111,6 +118,8 @@ class AircraftController extends Controller /** * Show the form for editing the specified Aircraft. + * + * @param mixed $id */ public function edit($id) { @@ -130,6 +139,9 @@ class AircraftController extends Controller /** * Update the specified Aircraft in storage. + * + * @param mixed $id + * * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function update($id, UpdateAircraftRequest $request) @@ -150,6 +162,8 @@ class AircraftController extends Controller /** * Remove the specified Aircraft from storage. + * + * @param mixed $id */ public function destroy($id) { @@ -168,9 +182,12 @@ class AircraftController extends Controller /** * Run the aircraft exporter + * * @param Request $request - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + * * @throws \League\Csv\Exception + * + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function export(Request $request) { @@ -187,8 +204,10 @@ class AircraftController extends Controller /** * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Illuminate\Validation\ValidationException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function import(Request $request) { @@ -215,6 +234,7 @@ class AircraftController extends Controller /** * @param Aircraft|null $aircraft + * * @return mixed */ protected function return_expenses_view(Aircraft $aircraft) @@ -228,10 +248,13 @@ class AircraftController extends Controller /** * Operations for associating ranks to the subfleet + * * @param $id * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Exception + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function expenses($id, Request $request) { diff --git a/app/Http/Controllers/Admin/AirlinesController.php b/app/Http/Controllers/Admin/AirlinesController.php index 264faa29..7536a435 100644 --- a/app/Http/Controllers/Admin/AirlinesController.php +++ b/app/Http/Controllers/Admin/AirlinesController.php @@ -14,7 +14,6 @@ use Response; /** * Class AirlinesController - * @package App\Http\Controllers\Admin */ class AirlinesController extends Controller { @@ -22,14 +21,17 @@ class AirlinesController extends Controller /** * AirlinesController constructor. + * * @param AirlineRepository $airlinesRepo */ - public function __construct(AirlineRepository $airlinesRepo) { + public function __construct(AirlineRepository $airlinesRepo) + { $this->airlineRepo = $airlinesRepo; } /** * Display a listing of the Airlines. + * * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function index(Request $request) @@ -54,6 +56,7 @@ class AirlinesController extends Controller /** * Store a newly created Airlines in storage. + * * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function store(CreateAirlineRequest $request) @@ -67,7 +70,9 @@ class AirlinesController extends Controller /** * Display the specified Airlines. - * @param int $id + * + * @param int $id + * * @return mixed */ public function show($id) @@ -86,7 +91,9 @@ class AirlinesController extends Controller /** * Show the form for editing the specified Airlines. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -106,10 +113,13 @@ class AirlinesController extends Controller /** * Update the specified Airlines in storage. - * @param int $id + * + * @param int $id * @param UpdateAirlineRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateAirlineRequest $request) { @@ -128,7 +138,9 @@ class AirlinesController extends Controller /** * Remove the specified Airlines from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) diff --git a/app/Http/Controllers/Admin/AirportController.php b/app/Http/Controllers/Admin/AirportController.php index b2bbd8f8..703e5d7f 100644 --- a/app/Http/Controllers/Admin/AirportController.php +++ b/app/Http/Controllers/Admin/AirportController.php @@ -21,12 +21,11 @@ use Storage; /** * Class AirportController - * @package App\Http\Controllers\Admin */ class AirportController extends Controller { - private $airportRepo, - $importSvc; + private $airportRepo; + private $importSvc; /** * @param AirportRepository $airportRepo @@ -42,9 +41,12 @@ class AirportController extends Controller /** * Display a listing of the Airport. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -65,6 +67,7 @@ class AirportController extends Controller /** * Show the form for creating a new Airport. + * * @return Response */ public function create() @@ -76,9 +79,12 @@ class AirportController extends Controller /** * Store a newly created Airport in storage. + * * @param CreateAirportRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreateAirportRequest $request) { @@ -93,7 +99,9 @@ class AirportController extends Controller /** * Display the specified Airport. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -112,7 +120,9 @@ class AirportController extends Controller /** * Show the form for editing the specified Airport. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -132,10 +142,13 @@ class AirportController extends Controller /** * Update the specified Airport in storage. - * @param int $id + * + * @param int $id * @param UpdateAirportRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateAirportRequest $request) { @@ -157,7 +170,9 @@ class AirportController extends Controller /** * Remove the specified Airport from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -177,9 +192,12 @@ class AirportController extends Controller /** * Run the airport exporter + * * @param Request $request - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + * * @throws \League\Csv\Exception + * + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function export(Request $request) { @@ -195,10 +213,11 @@ class AirportController extends Controller } /** - * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Illuminate\Validation\ValidationException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function import(Request $request) { @@ -225,6 +244,7 @@ class AirportController extends Controller /** * @param Airport $airport + * * @return mixed */ protected function return_expenses_view(Airport $airport) @@ -237,10 +257,13 @@ class AirportController extends Controller /** * Operations for associating ranks to the subfleet + * * @param $id * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Exception + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function expenses($id, Request $request) { @@ -273,7 +296,9 @@ class AirportController extends Controller /** * Set fuel prices for this airport + * * @param Request $request + * * @return mixed */ public function fuel(Request $request) diff --git a/app/Http/Controllers/Admin/AwardController.php b/app/Http/Controllers/Admin/AwardController.php index 93d39be7..4d4c68ac 100755 --- a/app/Http/Controllers/Admin/AwardController.php +++ b/app/Http/Controllers/Admin/AwardController.php @@ -14,20 +14,20 @@ use Response; class AwardController extends Controller { - /** @var AwardRepository */ - private $awardRepository, - $awardSvc; + /** @var AwardRepository */ + private $awardRepository; + private $awardSvc; /** * AwardController constructor. + * * @param AwardRepository $awardRepo * @param AwardService $awardSvc */ public function __construct( AwardRepository $awardRepo, AwardService $awardSvc - ) - { + ) { $this->awardRepository = $awardRepo; $this->awardSvc = $awardSvc; } @@ -57,9 +57,12 @@ class AwardController extends Controller /** * Display a listing of the Fare. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -73,6 +76,7 @@ class AwardController extends Controller /** * Show the form for creating a new Fare. + * * @return Response */ public function create() @@ -87,9 +91,12 @@ class AwardController extends Controller /** * Store a newly created Fare in storage. + * * @param CreateAwardRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreateAwardRequest $request) { @@ -102,7 +109,9 @@ class AwardController extends Controller /** * Display the specified Fare. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -121,7 +130,9 @@ class AwardController extends Controller /** * Show the form for editing the specified award. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -144,10 +155,13 @@ class AwardController extends Controller /** * Update the specified award in storage. - * @param int $id + * + * @param int $id * @param UpdateAwardRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateAwardRequest $request) { @@ -167,7 +181,7 @@ class AwardController extends Controller /** * Remove the specified Fare from storage. * - * @param int $id + * @param int $id * * @return Response */ diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index a74d575b..be9cba0b 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -16,16 +16,16 @@ use vierbergenlars\SemVer\version as semver; /** * Class DashboardController - * @package App\Http\Controllers\Admin */ class DashboardController extends Controller { - private $newsRepo, - $pirepRepo, - $userRepo; + private $newsRepo; + private $pirepRepo; + private $userRepo; /** * DashboardController constructor. + * * @param NewsRepository $newsRepo * @param PirepRepository $pirepRepo * @param UserRepository $userRepo @@ -44,6 +44,7 @@ class DashboardController extends Controller * Check if a new version is available by checking the VERSION file from * 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 + * * @throws \RuntimeException */ protected function checkNewVersion() @@ -63,6 +64,7 @@ class DashboardController extends Controller /** * Show the admin dashboard + * * @throws \RuntimeException */ public function index(Request $request) @@ -78,8 +80,10 @@ class DashboardController extends Controller /** * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function news(Request $request) { diff --git a/app/Http/Controllers/Admin/ExpenseController.php b/app/Http/Controllers/Admin/ExpenseController.php index 92310bc3..fa622eb4 100644 --- a/app/Http/Controllers/Admin/ExpenseController.php +++ b/app/Http/Controllers/Admin/ExpenseController.php @@ -19,16 +19,16 @@ use Storage; /** * Class ExpenseController - * @package App\Http\Controllers\Admin */ class ExpenseController extends Controller { - private $airlineRepo, - $expenseRepo, - $importSvc; + private $airlineRepo; + private $expenseRepo; + private $importSvc; /** * expensesController constructor. + * * @param AirlineRepository $airlineRepo * @param ExpenseRepository $expenseRepo * @param ImportService $importSvc @@ -45,19 +45,22 @@ class ExpenseController extends Controller /** * Display a listing of the expenses. + * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { $this->expenseRepo->pushCriteria(new RequestCriteria($request)); $expenses = $this->expenseRepo->findWhere([ - 'ref_model' => Expense::class + 'ref_model' => Expense::class, ]); return view('admin.expenses.index', [ - 'expenses' => $expenses + 'expenses' => $expenses, ]); } @@ -74,9 +77,12 @@ class ExpenseController extends Controller /** * Store a newly created expenses in storage. + * * @param Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(Request $request) { @@ -91,7 +97,9 @@ class ExpenseController extends Controller /** * Display the specified expenses. - * @param int $id + * + * @param int $id + * * @return mixed */ public function show($id) @@ -111,7 +119,9 @@ class ExpenseController extends Controller /** * Show the form for editing the specified expenses. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -133,10 +143,13 @@ class ExpenseController extends Controller /** * Update the specified expenses in storage. - * @param int $id + * + * @param int $id * @param Request $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, Request $request) { @@ -157,7 +170,9 @@ class ExpenseController extends Controller /** * Remove the specified expenses from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -177,9 +192,12 @@ class ExpenseController extends Controller /** * Run the airport exporter + * * @param Request $request - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + * * @throws \League\Csv\Exception + * + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function export(Request $request) { @@ -195,10 +213,11 @@ class ExpenseController extends Controller } /** - * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Illuminate\Validation\ValidationException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function import(Request $request) { diff --git a/app/Http/Controllers/Admin/FareController.php b/app/Http/Controllers/Admin/FareController.php index 7aa42fb3..0505614b 100644 --- a/app/Http/Controllers/Admin/FareController.php +++ b/app/Http/Controllers/Admin/FareController.php @@ -18,15 +18,15 @@ use Storage; /** * Class FareController - * @package App\Http\Controllers\Admin */ class FareController extends Controller { - private $fareRepo, - $importSvc; + private $fareRepo; + private $importSvc; /** * FareController constructor. + * * @param FareRepository $fareRepo * @param ImportService $importSvc */ @@ -40,9 +40,12 @@ class FareController extends Controller /** * Display a listing of the Fare. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -65,9 +68,12 @@ class FareController extends Controller /** * Store a newly created Fare in storage. + * * @param CreateFareRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreateFareRequest $request) { @@ -80,7 +86,9 @@ class FareController extends Controller /** * Display the specified Fare. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -96,7 +104,9 @@ class FareController extends Controller /** * Show the form for editing the specified Fare. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -112,10 +122,13 @@ class FareController extends Controller /** * Update the specified Fare in storage. - * @param int $id + * + * @param int $id * @param UpdateFareRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateFareRequest $request) { @@ -133,7 +146,9 @@ class FareController extends Controller /** * Remove the specified Fare from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -152,9 +167,12 @@ class FareController extends Controller /** * Run the aircraft exporter + * * @param Request $request - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + * * @throws \League\Csv\Exception + * + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function export(Request $request) { @@ -170,10 +188,11 @@ class FareController extends Controller } /** - * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Illuminate\Validation\ValidationException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function import(Request $request) { diff --git a/app/Http/Controllers/Admin/FileController.php b/app/Http/Controllers/Admin/FileController.php index 4d5ad49b..c9627b61 100644 --- a/app/Http/Controllers/Admin/FileController.php +++ b/app/Http/Controllers/Admin/FileController.php @@ -14,7 +14,6 @@ use Validator; /** * Class FileController - * @package App\Http\Controllers\Admin */ class FileController extends Controller { @@ -27,9 +26,12 @@ class FileController extends Controller /** * Store a newly file + * * @param Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Hashids\HashidsException + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(Request $request) { @@ -41,7 +43,7 @@ class FileController extends Controller $validator = Validator::make($request->all(), [ 'filename' => 'required', 'file_description' => 'nullable', - 'file' => 'required|file' + 'file' => 'required|file', ]); if ($validator->fails()) { @@ -50,7 +52,6 @@ class FileController extends Controller Log::info('Uploading files', $attrs); - $file = $request->file('file'); $this->fileSvc->saveFile($file, 'files', [ 'name' => $attrs['filename'], @@ -65,9 +66,12 @@ class FileController extends Controller /** * Remove the file from storage. + * * @param $id - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy($id) { diff --git a/app/Http/Controllers/Admin/FinanceController.php b/app/Http/Controllers/Admin/FinanceController.php index a9db4a90..62c65b73 100644 --- a/app/Http/Controllers/Admin/FinanceController.php +++ b/app/Http/Controllers/Admin/FinanceController.php @@ -13,14 +13,13 @@ use Illuminate\Http\Request; /** * Class FinanceController - * @package App\Http\Controllers\Admin */ class FinanceController extends Controller { private $airlineRepo; /** - * @param AirlineRepository $airlineRepo + * @param AirlineRepository $airlineRepo */ public function __construct( AirlineRepository $airlineRepo @@ -30,10 +29,13 @@ class FinanceController extends Controller /** * Display the summation tables for a given month by airline + * * @param Request $request - * @return mixed + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return mixed */ public function index(Request $request) { @@ -48,15 +50,15 @@ class FinanceController extends Controller $transaction_groups = []; $airlines = $this->airlineRepo->orderBy('icao')->all(); - # group by the airline + // group by the airline foreach ($airlines as $airline) { - # Return all the transactions, grouped by the transaction group + // Return all the transactions, grouped by the transaction group $transactions = JournalTransaction::groupBy('transaction_group', 'currency') ->selectRaw('transaction_group, currency, SUM(credit) as sum_credits, SUM(debit) as sum_debits') ->where([ - 'journal_id' => $airline->journal->id + 'journal_id' => $airline->journal->id, ]) ->whereBetween('created_at', $between, 'AND') ->orderBy('sum_credits', 'desc') @@ -64,7 +66,7 @@ class FinanceController extends Controller ->orderBy('transaction_group', 'asc') ->get(); - # Summate it so we can show it on the footer of the table + // Summate it so we can show it on the footer of the table $sum_all_credits = 0; $sum_all_debits = 0; foreach ($transactions as $ta) { @@ -89,6 +91,8 @@ class FinanceController extends Controller /** * Show a month + * + * @param mixed $id */ public function show($id) { diff --git a/app/Http/Controllers/Admin/FlightController.php b/app/Http/Controllers/Admin/FlightController.php index 89411211..b0299713 100644 --- a/app/Http/Controllers/Admin/FlightController.php +++ b/app/Http/Controllers/Admin/FlightController.php @@ -30,22 +30,22 @@ use Storage; /** * Class FlightController - * @package App\Http\Controllers\Admin */ class FlightController extends Controller { - private $airlineRepo, - $airportRepo, - $fareRepo, - $flightRepo, - $flightFieldRepo, - $fareSvc, - $flightSvc, - $importSvc, - $subfleetRepo; + private $airlineRepo; + private $airportRepo; + private $fareRepo; + private $flightRepo; + private $flightFieldRepo; + private $fareSvc; + private $flightSvc; + private $importSvc; + private $subfleetRepo; /** * FlightController constructor. + * * @param AirlineRepository $airlineRepo * @param AirportRepository $airportRepo * @param FareRepository $fareRepo @@ -80,6 +80,7 @@ class FlightController extends Controller /** * Save any custom fields found + * * @param Flight $flight * @param Request $request */ @@ -93,8 +94,8 @@ class FlightController extends Controller } $custom_fields[] = [ - 'name' => $field->name, - 'value' => $request->input($field->slug) + 'name' => $field->name, + 'value' => $request->input($field->slug), ]; } @@ -104,6 +105,7 @@ class FlightController extends Controller /** * @param $flight + * * @return array */ protected function getAvailSubfleets($flight) @@ -123,8 +125,10 @@ class FlightController extends Controller /** * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { @@ -142,6 +146,7 @@ class FlightController extends Controller /** * Show the form for creating a new Flight. + * * @return Response */ public function create() @@ -159,8 +164,10 @@ class FlightController extends Controller /** * @param CreateFlightRequest $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(CreateFlightRequest $request) { @@ -190,6 +197,7 @@ class FlightController extends Controller /** * @param $id + * * @return mixed */ public function show($id) @@ -212,6 +220,7 @@ class FlightController extends Controller /** * @param $id + * * @return mixed */ public function edit($id) @@ -244,8 +253,10 @@ class FlightController extends Controller /** * @param $id * @param UpdateFlightRequest $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update($id, UpdateFlightRequest $request) { @@ -258,11 +269,11 @@ class FlightController extends Controller $input = $request->all(); - # apply the updates here temporarily, don't save - # the repo->update() call will actually do it + // apply the updates here temporarily, don't save + // the repo->update() call will actually do it $flight->fill($input); - if($this->flightSvc->isFlightDuplicate($flight)) { + if ($this->flightSvc->isFlightDuplicate($flight)) { Flash::error('Duplicate flight with same number/code/leg found, please change to proceed'); return redirect()->back()->withInput($request->all()); } @@ -285,8 +296,10 @@ class FlightController extends Controller /** * @param $id - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy($id) { @@ -305,9 +318,12 @@ class FlightController extends Controller /** * Run the flight exporter + * * @param Request $request - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + * * @throws \League\Csv\Exception + * + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function export(Request $request) { @@ -323,16 +339,17 @@ class FlightController extends Controller } /** - * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Illuminate\Validation\ValidationException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function import(Request $request) { $logs = [ 'success' => [], - 'errors' => [], + 'errors' => [], ]; if ($request->isMethod('post')) { @@ -352,6 +369,7 @@ class FlightController extends Controller /** * @param $flight + * * @return mixed */ protected function return_fields_view($flight) @@ -366,6 +384,7 @@ class FlightController extends Controller /** * @param $flight_id * @param Request $request + * * @return mixed */ public function field_values($flight_id, Request $request) @@ -388,11 +407,11 @@ class FlightController extends Controller } elseif ($request->isMethod('put')) { Log::info('Updating flight field, flight: '.$flight_id, $request->input()); $field = FlightFieldValue::where([ - 'name' => $request->input('name'), + 'name' => $request->input('name'), 'flight_id' => $flight_id, ])->first(); - if(!$field) { + if (!$field) { Log::info('Field not found, creating new'); $field = new FlightFieldValue(); $field->name = $request->input('name'); @@ -401,11 +420,11 @@ class FlightController extends Controller $field->flight_id = $flight_id; $field->value = $request->input('value'); $field->save(); - // update the field value + // update the field value } // remove custom field from flight elseif ($request->isMethod('delete')) { Log::info('Deleting flight field, flight: '.$flight_id, $request->input()); - if($flight_id && $request->input('field_id')) { + if ($flight_id && $request->input('field_id')) { FlightFieldValue::destroy($request->input('field_id')); } } @@ -415,6 +434,7 @@ class FlightController extends Controller /** * @param $flight + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ protected function return_subfleet_view($flight) @@ -430,6 +450,7 @@ class FlightController extends Controller /** * @param $id * @param Request $request + * * @return mixed */ public function subfleets($id, Request $request) @@ -444,7 +465,7 @@ class FlightController extends Controller // add aircraft to flight $subfleet = $this->subfleetRepo->findWithoutFail($request->subfleet_id); - if(!$subfleet) { + if (!$subfleet) { return $this->return_subfleet_view($flight); } @@ -460,6 +481,8 @@ class FlightController extends Controller /** * Get all the fares that haven't been assigned to a given subfleet + * + * @param mixed $flight */ protected function getAvailFares($flight) { @@ -475,6 +498,7 @@ class FlightController extends Controller /** * @param Flight $flight + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ protected function return_fares_view(Flight $flight) @@ -489,6 +513,7 @@ class FlightController extends Controller /** * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function fares(Request $request) @@ -515,7 +540,7 @@ class FlightController extends Controller 'value' => 'nullable', // regex:/([\d%]*)/ ]); - /** + /* * update specific fare data */ if ($request->isMethod('post')) { diff --git a/app/Http/Controllers/Admin/FlightFieldController.php b/app/Http/Controllers/Admin/FlightFieldController.php index 341d6466..452959fb 100644 --- a/app/Http/Controllers/Admin/FlightFieldController.php +++ b/app/Http/Controllers/Admin/FlightFieldController.php @@ -11,7 +11,6 @@ use Response; /** * Class FlightFieldController - * @package App\Http\Controllers\Admin */ class FlightFieldController extends Controller { @@ -19,6 +18,7 @@ class FlightFieldController extends Controller /** * FlightFieldController constructor. + * * @param FlightFieldRepository $flightFieldRepository */ public function __construct( @@ -29,9 +29,12 @@ class FlightFieldController extends Controller /** * Display a listing of the FlightField. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -45,6 +48,7 @@ class FlightFieldController extends Controller /** * Show the form for creating a new FlightField. + * * @return Response */ public function create() @@ -54,9 +58,12 @@ class FlightFieldController extends Controller /** * Store a newly created FlightField in storage. + * * @param Request $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(Request $request) { @@ -71,7 +78,9 @@ class FlightFieldController extends Controller /** * Display the specified FlightField. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -90,7 +99,9 @@ class FlightFieldController extends Controller /** * Show the form for editing the specified FlightField. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -109,10 +120,13 @@ class FlightFieldController extends Controller /** * Update the specified FlightField in storage. + * * @param $id * @param Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update($id, Request $request) { @@ -133,7 +147,9 @@ class FlightFieldController extends Controller /** * Remove the specified FlightField from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) diff --git a/app/Http/Controllers/Admin/PirepController.php b/app/Http/Controllers/Admin/PirepController.php index 3f5188db..e6b5a2e9 100644 --- a/app/Http/Controllers/Admin/PirepController.php +++ b/app/Http/Controllers/Admin/PirepController.php @@ -8,7 +8,6 @@ use App\Http\Requests\UpdatePirepRequest; use App\Interfaces\Controller; use App\Models\Enums\PirepSource; use App\Models\Enums\PirepState; -use App\Models\Enums\PirepStatus; use App\Models\Pirep; use App\Models\PirepComment; use App\Repositories\AircraftRepository; @@ -31,23 +30,23 @@ use Response; /** * Class PirepController - * @package App\Http\Controllers\Admin */ class PirepController extends Controller { - private $airportRepo, - $airlineRepo, - $aircraftRepo, - $fareSvc, - $journalRepo, - $pirepSvc, - $pirepRepo, - $pirepFieldRepo, - $subfleetRepo, - $userSvc; + private $airportRepo; + private $airlineRepo; + private $aircraftRepo; + private $fareSvc; + private $journalRepo; + private $pirepSvc; + private $pirepRepo; + private $pirepFieldRepo; + private $subfleetRepo; + private $userSvc; /** * PirepController constructor. + * * @param AirportRepository $airportRepo * @param AirlineRepository $airlineRepo * @param AircraftRepository $aircraftRepo @@ -85,7 +84,9 @@ class PirepController extends Controller /** * Dropdown with aircraft grouped by subfleet + * * @param null $user + * * @return array */ public function aircraftList($user = null) @@ -112,6 +113,7 @@ class PirepController extends Controller /** * Save any custom fields found + * * @param Pirep $pirep * @param Request $request */ @@ -127,7 +129,7 @@ class PirepController extends Controller $custom_fields[] = [ 'name' => $field->name, 'value' => $request->input($field->slug), - 'source' => PirepSource::MANUAL + 'source' => PirepSource::MANUAL, ]; } @@ -137,8 +139,10 @@ class PirepController extends Controller /** * Save the fares that have been specified/saved + * * @param Pirep $pirep * @param Request $request + * * @throws \Exception */ protected function saveFares(Pirep $pirep, Request $request) @@ -163,7 +167,9 @@ class PirepController extends Controller /** * Return the fares form for a given aircraft + * * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function fares(Request $request) @@ -182,8 +188,10 @@ class PirepController extends Controller /** * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { @@ -194,19 +202,21 @@ class PirepController extends Controller ->whereNotInOrder('state', [ PirepState::CANCELLED, PirepState::DRAFT, - PirepState::IN_PROGRESS + PirepState::IN_PROGRESS, ], 'created_at', 'desc') ->paginate(); return view('admin.pireps.index', [ - 'pireps' => $pireps + 'pireps' => $pireps, ]); } /** * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function pending(Request $request) { @@ -219,12 +229,13 @@ class PirepController extends Controller ->paginate(); return view('admin.pireps.index', [ - 'pireps' => $pireps + 'pireps' => $pireps, ]); } /** * Show the form for creating a new Pirep. + * * @return Response */ public function create() @@ -238,9 +249,11 @@ class PirepController extends Controller /** * @param CreatePirepRequest $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(CreatePirepRequest $request) { @@ -261,7 +274,9 @@ class PirepController extends Controller /** * Display the specified Pirep. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -280,9 +295,12 @@ class PirepController extends Controller /** * Show the form for editing the specified Pirep. - * @param int $id - * @return Response + * + * @param int $id + * * @throws \InvalidArgumentException + * + * @return Response */ public function edit($id) { @@ -296,13 +314,13 @@ class PirepController extends Controller $pirep->hours = $time->hours; $pirep->minutes = $time->minutes; - # set the custom fields + // set the custom fields foreach ($pirep->fields as $field) { $field_name = 'field_'.$field->slug; $pirep->{$field_name} = $field->value; } - # set the fares + // set the fares foreach ($pirep->fares as $fare) { $field_name = 'fare_'.$fare->fare_id; $pirep->{$field_name} = $fare->count; @@ -323,9 +341,11 @@ class PirepController extends Controller /** * @param $id * @param UpdatePirepRequest $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update($id, UpdatePirepRequest $request) { @@ -341,7 +361,7 @@ class PirepController extends Controller $attrs = $request->all(); - # Fix the time + // Fix the time $attrs['flight_time'] = Time::init( $attrs['minutes'], $attrs['hours'])->getMinutes(); @@ -362,7 +382,9 @@ class PirepController extends Controller /** * Remove the specified Pirep from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -382,7 +404,9 @@ class PirepController extends Controller /** * Change or update the PIREP status. Just return the new actionbar + * * @param Request $request + * * @return \Illuminate\View\View */ public function status(Request $request) @@ -402,10 +426,13 @@ class PirepController extends Controller /** * Add a comment to the Pirep + * * @param $id * @param Request $request - * @return mixed + * * @throws \Exception + * + * @return mixed */ public function comments($id, Request $request) { diff --git a/app/Http/Controllers/Admin/PirepFieldController.php b/app/Http/Controllers/Admin/PirepFieldController.php index be1cc7ee..7325b6e5 100644 --- a/app/Http/Controllers/Admin/PirepFieldController.php +++ b/app/Http/Controllers/Admin/PirepFieldController.php @@ -13,7 +13,6 @@ use Response; /** * Class PirepFieldController - * @package App\Http\Controllers\Admin */ class PirepFieldController extends Controller { @@ -21,6 +20,7 @@ class PirepFieldController extends Controller /** * PirepFieldController constructor. + * * @param PirepFieldRepository $pirepFieldRepo */ public function __construct( @@ -31,9 +31,12 @@ class PirepFieldController extends Controller /** * Display a listing of the PirepField. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -47,6 +50,7 @@ class PirepFieldController extends Controller /** * Show the form for creating a new PirepField. + * * @return Response */ public function create() @@ -56,9 +60,12 @@ class PirepFieldController extends Controller /** * Store a newly created PirepField in storage. + * * @param CreatePirepFieldRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreatePirepFieldRequest $request) { @@ -75,7 +82,9 @@ class PirepFieldController extends Controller /** * Display the specified PirepField. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -95,7 +104,9 @@ class PirepFieldController extends Controller /** * Show the form for editing the specified PirepField. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -115,6 +126,9 @@ class PirepFieldController extends Controller /** * Update the specified PirepField in storage. + * + * @param mixed $id + * * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function update($id, UpdatePirepFieldRequest $request) @@ -139,7 +153,9 @@ class PirepFieldController extends Controller /** * Remove the specified PirepField from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) diff --git a/app/Http/Controllers/Admin/RankController.php b/app/Http/Controllers/Admin/RankController.php index 9fa313cd..8aed2b35 100644 --- a/app/Http/Controllers/Admin/RankController.php +++ b/app/Http/Controllers/Admin/RankController.php @@ -16,16 +16,16 @@ use Response; /** * Class RankController - * @package App\Http\Controllers\Admin */ class RankController extends Controller { - private $fleetSvc, - $rankRepository, - $subfleetRepo; + private $fleetSvc; + private $rankRepository; + private $subfleetRepo; /** * RankController constructor. + * * @param FleetService $fleetSvc * @param RankRepository $rankingRepo * @param SubfleetRepository $subfleetRepo @@ -42,7 +42,9 @@ class RankController extends Controller /** * Get the available subfleets for a rank + * * @param $rank + * * @return array */ protected function getAvailSubfleets($rank) @@ -60,9 +62,12 @@ class RankController extends Controller /** * Display a listing of the Ranking. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -86,9 +91,12 @@ class RankController extends Controller /** * Store a newly created Ranking in storage. + * * @param CreateRankRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreateRankRequest $request) { @@ -104,7 +112,9 @@ class RankController extends Controller /** * Display the specified Ranking. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -118,13 +128,15 @@ class RankController extends Controller } return view('admin.ranks.show', [ - 'rank' => $rank + 'rank' => $rank, ]); } /** * Show the form for editing the specified Ranking. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -147,10 +159,13 @@ class RankController extends Controller /** * Update the specified Ranking in storage. - * @param int $id + * + * @param int $id * @param UpdateRankRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateRankRequest $request) { @@ -172,7 +187,9 @@ class RankController extends Controller /** * Remove the specified Ranking from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -194,6 +211,7 @@ class RankController extends Controller /** * @param $rank + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ protected function return_subfleet_view($rank) @@ -208,8 +226,10 @@ class RankController extends Controller /** * Subfleet operations on a rank + * * @param $id * @param Request $request + * * @return mixed */ public function subfleets($id, Request $request) diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index be20ec32..3a560598 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -9,7 +9,6 @@ use Log; /** * Class SettingsController - * @package App\Http\Controllers\Admin */ class SettingsController extends Controller { @@ -28,7 +27,9 @@ class SettingsController extends Controller /** * Update the specified setting in storage. + * * @param Request $request + * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update(Request $request) diff --git a/app/Http/Controllers/Admin/SubfleetController.php b/app/Http/Controllers/Admin/SubfleetController.php index de821046..c0702b36 100644 --- a/app/Http/Controllers/Admin/SubfleetController.php +++ b/app/Http/Controllers/Admin/SubfleetController.php @@ -27,20 +27,20 @@ use Storage; /** * Class SubfleetController - * @package App\Http\Controllers\Admin */ class SubfleetController extends Controller { - private $aircraftRepo, - $fareRepo, - $fareSvc, - $fleetSvc, - $importSvc, - $rankRepo, - $subfleetRepo; + private $aircraftRepo; + private $fareRepo; + private $fareSvc; + private $fleetSvc; + private $importSvc; + private $rankRepo; + private $subfleetRepo; /** * SubfleetController constructor. + * * @param AircraftRepository $aircraftRepo * @param FleetService $fleetSvc * @param FareRepository $fareRepo @@ -69,7 +69,9 @@ class SubfleetController extends Controller /** * Get the ranks that are available to the subfleet + * * @param $subfleet + * * @return array */ protected function getAvailRanks($subfleet) @@ -86,6 +88,8 @@ class SubfleetController extends Controller /** * Get all the fares that haven't been assigned to a given subfleet + * + * @param mixed $subfleet */ protected function getAvailFares($subfleet) { @@ -104,9 +108,12 @@ class SubfleetController extends Controller /** * Display a listing of the Subfleet. + * * @param Request $request - * @return Response + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return Response */ public function index(Request $request) { @@ -120,6 +127,7 @@ class SubfleetController extends Controller /** * Show the form for creating a new Subfleet. + * * @return Response */ public function create() @@ -132,9 +140,12 @@ class SubfleetController extends Controller /** * Store a newly created Subfleet in storage. + * * @param CreateSubfleetRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreateSubfleetRequest $request) { @@ -147,7 +158,9 @@ class SubfleetController extends Controller /** * Display the specified Subfleet. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -168,7 +181,9 @@ class SubfleetController extends Controller /** * Show the form for editing the specified Subfleet. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -194,10 +209,13 @@ class SubfleetController extends Controller /** * Update the specified Subfleet in storage. - * @param int $id + * + * @param int $id * @param UpdateSubfleetRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateSubfleetRequest $request) { @@ -216,7 +234,9 @@ class SubfleetController extends Controller /** * Remove the specified Subfleet from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -228,8 +248,8 @@ class SubfleetController extends Controller return redirect(route('admin.subfleets.index')); } - # Make sure no aircraft are assigned to this subfleet - # before trying to delete it, or else things might go boom + // Make sure no aircraft are assigned to this subfleet + // before trying to delete it, or else things might go boom $aircraft = $this->aircraftRepo->findWhere(['subfleet_id' => $id], ['id']); if ($aircraft->count() > 0) { Flash::error('There are aircraft still assigned to this subfleet, you can\'t delete it!')->important(); @@ -244,7 +264,9 @@ class SubfleetController extends Controller /** * Run the subfleet exporter + * * @param Request $request + * * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function export(Request $request) @@ -261,10 +283,11 @@ class SubfleetController extends Controller } /** - * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Illuminate\Validation\ValidationException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function import(Request $request) { @@ -292,6 +315,7 @@ class SubfleetController extends Controller /** * @param Subfleet $subfleet + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ protected function return_ranks_view(?Subfleet $subfleet) @@ -307,6 +331,7 @@ class SubfleetController extends Controller /** * @param Subfleet $subfleet + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ protected function return_fares_view(?Subfleet $subfleet) @@ -322,8 +347,10 @@ class SubfleetController extends Controller /** * Operations for associating ranks to the subfleet + * * @param $id * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function ranks($id, Request $request) @@ -337,7 +364,7 @@ class SubfleetController extends Controller return $this->return_ranks_view($subfleet); } - /** + /* * update specific rank data */ if ($request->isMethod('post')) { @@ -362,6 +389,7 @@ class SubfleetController extends Controller /** * @param Subfleet $subfleet + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ protected function return_expenses_view(?Subfleet $subfleet) @@ -374,10 +402,13 @@ class SubfleetController extends Controller /** * Operations for associating ranks to the subfleet + * * @param $id * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Exception + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function expenses($id, Request $request) { @@ -390,7 +421,7 @@ class SubfleetController extends Controller return $this->return_expenses_view($subfleet); } - /** + /* * update specific rank data */ if ($request->isMethod('post')) { @@ -413,8 +444,10 @@ class SubfleetController extends Controller /** * Operations on fares to the subfleet + * * @param $id * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function fares($id, Request $request) @@ -428,7 +461,7 @@ class SubfleetController extends Controller return $this->return_fares_view($subfleet); } - /** + /* * update specific fare data */ if ($request->isMethod('post')) { diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 9ad1607b..5419460b 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -25,18 +25,18 @@ use Response; /** * Class UserController - * @package App\Http\Controllers\Admin */ class UserController extends Controller { - private $airlineRepo, - $airportRepo, - $pirepRepo, - $userRepo, - $userSvc; + private $airlineRepo; + private $airportRepo; + private $pirepRepo; + private $userRepo; + private $userSvc; /** * UserController constructor. + * * @param AirlineRepository $airlineRepo * @param AirportRepository $airportRepo * @param PirepRepository $pirepRepo @@ -59,6 +59,7 @@ class UserController extends Controller /** * @param Request $request + * * @return mixed */ public function index(Request $request) @@ -78,6 +79,7 @@ class UserController extends Controller /** * Show the form for creating a new User. + * * @return Response */ public function create() @@ -99,9 +101,12 @@ class UserController extends Controller /** * Store a newly created User in storage. + * * @param CreateUserRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function store(CreateUserRequest $request) { @@ -114,7 +119,9 @@ class UserController extends Controller /** * Display the specified User. - * @param int $id + * + * @param int $id + * * @return Response */ public function show($id) @@ -148,7 +155,9 @@ class UserController extends Controller /** * Show the form for editing the specified User. - * @param int $id + * + * @param int $id + * * @return Response */ public function edit($id) @@ -165,7 +174,7 @@ class UserController extends Controller ->whereOrder(['user_id' => $id], 'created_at', 'desc') ->paginate(); - $countries = collect((new \League\ISO3166\ISO3166)->all()) + $countries = collect((new \League\ISO3166\ISO3166())->all()) ->mapWithKeys(function ($item, $key) { return [strtolower($item['alpha2']) => $item['name']]; }); @@ -187,10 +196,13 @@ class UserController extends Controller /** * Update the specified User in storage. + * * @param int $id * @param UpdateUserRequest $request - * @return Response + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return Response */ public function update($id, UpdateUserRequest $request) { @@ -211,7 +223,7 @@ class UserController extends Controller if ($request->filled('avatar_upload')) { /** - * @var $file \Illuminate\Http\UploadedFile + * @var $file \Illuminate\Http\UploadedFile */ $file = $request->file('avatar_upload'); $file_path = $file->storeAs( @@ -223,7 +235,6 @@ class UserController extends Controller $user->avatar = $file_path; } - $original_user_state = $user->state; $user = $this->userRepo->update($req_data, $id); @@ -232,7 +243,7 @@ class UserController extends Controller $this->userSvc->changeUserState($user, $original_user_state); } - # Delete all of the roles and then re-attach the valid ones + // Delete all of the roles and then re-attach the valid ones DB::table('role_user')->where('user_id', $id)->delete(); foreach ($request->input('roles') as $key => $value) { $user->attachRole($value); @@ -245,7 +256,9 @@ class UserController extends Controller /** * Remove the specified User from storage. - * @param int $id + * + * @param int $id + * * @return Response */ public function destroy($id) @@ -267,8 +280,10 @@ class UserController extends Controller /** * Regenerate the user's API key + * * @param $id * @param Request $request + * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function regen_apikey($id, Request $request) diff --git a/app/Http/Controllers/Api/AcarsController.php b/app/Http/Controllers/Api/AcarsController.php index 5a30c24e..4d42ec80 100644 --- a/app/Http/Controllers/Api/AcarsController.php +++ b/app/Http/Controllers/Api/AcarsController.php @@ -23,17 +23,17 @@ use Log; /** * Class AcarsController - * @package App\Http\Controllers\Api */ class AcarsController extends Controller { - private $acarsRepo, - $geoSvc, - $pirepRepo, - $pirepSvc; + private $acarsRepo; + private $geoSvc; + private $pirepRepo; + private $pirepSvc; /** * AcarsController constructor. + * * @param AcarsRepository $acarsRepo * @param GeoService $geoSvc * @param PirepRepository $pirepRepo @@ -53,7 +53,9 @@ class AcarsController extends Controller /** * Check if a PIREP is cancelled + * * @param $pirep + * * @throws \App\Exceptions\PirepCancelled */ protected function checkCancelled(Pirep $pirep) @@ -65,7 +67,9 @@ class AcarsController extends Controller /** * Return all of the flights (as points) in GeoJSON format + * * @param Request $request + * * @return mixed */ public function index(Request $request) @@ -74,14 +78,16 @@ class AcarsController extends Controller $positions = $this->geoSvc->getFeatureForLiveFlights($pireps); return response(json_encode($positions), 200, [ - 'Content-type' => 'application/json' + 'Content-type' => 'application/json', ]); } /** * Return the GeoJSON for the ACARS line + * * @param $pirep_id * @param Request $request + * * @return \Illuminate\Contracts\Routing\ResponseFactory */ public function acars_geojson($pirep_id, Request $request) @@ -96,8 +102,10 @@ class AcarsController extends Controller /** * Return the routes for the ACARS line + * * @param $id * @param Request $request + * * @return AcarsRouteResource */ public function acars_get($id, Request $request) @@ -106,21 +114,24 @@ class AcarsController extends Controller return new AcarsRouteResource(Acars::where([ 'pirep_id' => $id, - 'type' => AcarsType::FLIGHT_PATH + 'type' => AcarsType::FLIGHT_PATH, ])->orderBy('sim_time', 'asc')->get()); } /** * Post ACARS updates for a PIREP + * * @param $id * @param PositionRequest $request - * @return \Illuminate\Http\JsonResponse + * * @throws \App\Exceptions\PirepCancelled * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + * + * @return \Illuminate\Http\JsonResponse */ public function acars_store($id, PositionRequest $request) { - # Check if the status is cancelled... + // Check if the status is cancelled... $pirep = Pirep::find($id); $this->checkCancelled($pirep); @@ -146,10 +157,10 @@ class AcarsController extends Controller $update = Acars::create($position); $update->save(); - ++$count; + $count++; } - # Change the PIREP status if it's as SCHEDULED before + // Change the PIREP status if it's as SCHEDULED before if ($pirep->status === PirepStatus::INITIATED) { $pirep->status = PirepStatus::AIRBORNE; } @@ -162,15 +173,18 @@ class AcarsController extends Controller /** * Post ACARS LOG update for a PIREP. These updates won't show up on the map * But rather in a log file. + * * @param $id * @param LogRequest $request - * @return \Illuminate\Http\JsonResponse + * * @throws \App\Exceptions\PirepCancelled * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + * + * @return \Illuminate\Http\JsonResponse */ public function acars_logs($id, LogRequest $request) { - # Check if the status is cancelled... + // Check if the status is cancelled... $pirep = Pirep::find($id); $this->checkCancelled($pirep); @@ -192,7 +206,7 @@ class AcarsController extends Controller $acars = Acars::create($log); $acars->save(); - ++$count; + $count++; } return $this->message($count.' logs added', $count); @@ -201,15 +215,18 @@ class AcarsController extends Controller /** * Post ACARS LOG update for a PIREP. These updates won't show up on the map * But rather in a log file. + * * @param $id * @param EventRequest $request - * @return \Illuminate\Http\JsonResponse + * * @throws \App\Exceptions\PirepCancelled * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + * + * @return \Illuminate\Http\JsonResponse */ public function acars_events($id, EventRequest $request) { - # Check if the status is cancelled... + // Check if the status is cancelled... $pirep = Pirep::find($id); $this->checkCancelled($pirep); @@ -232,7 +249,7 @@ class AcarsController extends Controller $acars = Acars::create($log); $acars->save(); - ++$count; + $count++; } return $this->message($count.' logs added', $count); diff --git a/app/Http/Controllers/Api/AirlineController.php b/app/Http/Controllers/Api/AirlineController.php index 73a7a618..293aba68 100644 --- a/app/Http/Controllers/Api/AirlineController.php +++ b/app/Http/Controllers/Api/AirlineController.php @@ -9,7 +9,6 @@ use Illuminate\Http\Request; /** * Class AirlineController - * @package App\Http\Controllers\Api */ class AirlineController extends Controller { @@ -17,6 +16,7 @@ class AirlineController extends Controller /** * AirlineController constructor. + * * @param AirlineRepository $airlineRepo */ public function __construct( @@ -27,12 +27,14 @@ class AirlineController extends Controller /** * Return all the airlines, paginated + * * @param Request $request + * * @return mixed */ public function index(Request $request) { - #$this->airlineRepo->pushCriteria(new RequestCriteria($request)); + //$this->airlineRepo->pushCriteria(new RequestCriteria($request)); $airports = $this->airlineRepo ->whereOrder(['active' => true], 'name', 'asc') ->paginate(); @@ -42,7 +44,9 @@ class AirlineController extends Controller /** * Do a lookup, via vaCentral, for the airport information + * * @param $id + * * @return AirlineResource */ public function get($id) diff --git a/app/Http/Controllers/Api/AirportController.php b/app/Http/Controllers/Api/AirportController.php index 1ea3c499..b450ea32 100644 --- a/app/Http/Controllers/Api/AirportController.php +++ b/app/Http/Controllers/Api/AirportController.php @@ -12,7 +12,6 @@ use VaCentral\Airport as AirportLookup; /** * Class AirportController - * @package App\Http\Controllers\Api */ class AirportController extends Controller { @@ -20,6 +19,7 @@ class AirportController extends Controller /** * AirportController constructor. + * * @param AirportRepository $airportRepo */ public function __construct( @@ -30,7 +30,9 @@ class AirportController extends Controller /** * Return all the airports, paginated + * * @param Request $request + * * @return mixed */ public function index(Request $request) @@ -65,7 +67,9 @@ class AirportController extends Controller /** * Do a lookup, via vaCentral, for the airport information + * * @param $id + * * @return AirportResource */ public function get($id) @@ -77,7 +81,9 @@ class AirportController extends Controller /** * Do a lookup, via vaCentral, for the airport information + * * @param $id + * * @return AirportResource */ public function lookup($id) diff --git a/app/Http/Controllers/Api/FleetController.php b/app/Http/Controllers/Api/FleetController.php index b93d4c2a..81d7c731 100644 --- a/app/Http/Controllers/Api/FleetController.php +++ b/app/Http/Controllers/Api/FleetController.php @@ -11,15 +11,15 @@ use Illuminate\Http\Request; /** * Class FleetController - * @package App\Http\Controllers\Api */ class FleetController extends Controller { - private $aircraftRepo, - $subfleetRepo; + private $aircraftRepo; + private $subfleetRepo; /** * FleetController constructor. + * * @param AircraftRepository $aircraftRepo * @param SubfleetRepository $subfleetRepo */ @@ -47,8 +47,10 @@ class FleetController extends Controller /** * Get a specific aircraft. Query string required to specify the tail * /api/aircraft/XYZ?type=registration + * * @param $id * @param Request $request + * * @return AircraftResource */ public function get_aircraft($id, Request $request) diff --git a/app/Http/Controllers/Api/FlightController.php b/app/Http/Controllers/Api/FlightController.php index 4d156200..a27613cf 100644 --- a/app/Http/Controllers/Api/FlightController.php +++ b/app/Http/Controllers/Api/FlightController.php @@ -15,15 +15,15 @@ use Prettus\Repository\Exceptions\RepositoryException; /** * Class FlightController - * @package App\Http\Controllers\Api */ class FlightController extends Controller { - private $flightRepo, - $flightSvc; + private $flightRepo; + private $flightSvc; /** * FlightController constructor. + * * @param FlightRepository $flightRepo * @param FlightService $flightSvc */ @@ -37,7 +37,9 @@ class FlightController extends Controller /** * Return all the flights, paginated + * * @param Request $request + * * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function index(Request $request) @@ -49,7 +51,7 @@ class FlightController extends Controller 'visible' => true, ]; - if(setting('pilots.restrict_to_company')) { + if (setting('pilots.restrict_to_company')) { $where['airline_id'] = Auth::user()->airline_id; } if (setting('pilots.only_flights_from_current', false)) { @@ -69,6 +71,7 @@ class FlightController extends Controller /** * @param $id + * * @return FlightResource */ public function get($id) @@ -81,6 +84,7 @@ class FlightController extends Controller /** * @param Request $request + * * @return mixed */ public function search(Request $request) @@ -93,7 +97,7 @@ class FlightController extends Controller 'visible' => true, ]; - if(setting('pilots.restrict_to_company')) { + if (setting('pilots.restrict_to_company')) { $where['airline_id'] = Auth::user()->airline_id; } if (setting('pilots.only_flights_from_current')) { @@ -117,8 +121,10 @@ class FlightController extends Controller /** * Get a flight's route + * * @param $id * @param Request $request + * * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function route($id, Request $request) diff --git a/app/Http/Controllers/Api/NewsController.php b/app/Http/Controllers/Api/NewsController.php index 0b8e1c4d..8abe9574 100644 --- a/app/Http/Controllers/Api/NewsController.php +++ b/app/Http/Controllers/Api/NewsController.php @@ -7,24 +7,25 @@ use App\Interfaces\Controller; use App\Repositories\NewsRepository; use Illuminate\Http\Request; -/** - * @package App\Http\Controllers\Api - */ class NewsController extends Controller { private $newsRepo; /** * AirlineController constructor. + * * @param NewsRepository $newsRepo */ - public function __construct(NewsRepository $newsRepo) { + public function __construct(NewsRepository $newsRepo) + { $this->newsRepo = $newsRepo; } /** * Return all the airlines, paginated + * * @param Request $request + * * @return mixed */ public function index(Request $request) diff --git a/app/Http/Controllers/Api/PirepController.php b/app/Http/Controllers/Api/PirepController.php index 77f53c67..d47e7911 100644 --- a/app/Http/Controllers/Api/PirepController.php +++ b/app/Http/Controllers/Api/PirepController.php @@ -40,20 +40,20 @@ use Log; /** * Class PirepController - * @package App\Http\Controllers\Api */ class PirepController extends Controller { - private $acarsRepo, - $fareSvc, - $financeSvc, - $journalRepo, - $pirepRepo, - $pirepSvc, - $userSvc; + private $acarsRepo; + private $fareSvc; + private $financeSvc; + private $journalRepo; + private $pirepRepo; + private $pirepSvc; + private $userSvc; /** * PirepController constructor. + * * @param AcarsRepository $acarsRepo * @param FareService $fareSvc * @param PirepFinanceService $financeSvc @@ -82,7 +82,9 @@ class PirepController extends Controller /** * Parse any PIREP added in + * * @param Request $request + * * @return array|null|string */ protected function parsePirep(Request $request) @@ -98,7 +100,9 @@ class PirepController extends Controller /** * Check if a PIREP is cancelled + * * @param $pirep + * * @throws \App\Exceptions\PirepCancelled */ protected function checkCancelled(Pirep $pirep) @@ -132,8 +136,10 @@ class PirepController extends Controller /** * Save the fares + * * @param $pirep * @param Request $request + * * @throws \Exception */ protected function updateFares($pirep, Request $request) @@ -155,14 +161,15 @@ class PirepController extends Controller /** * Get all the active PIREPs + * * @return mixed */ public function index() { $active = []; $pireps = $this->acarsRepo->getPositions(); - foreach($pireps as $pirep) { - if(!$pirep->position) { + foreach ($pireps as $pirep) { + if (!$pirep->position) { continue; } @@ -174,6 +181,7 @@ class PirepController extends Controller /** * @param $pirep_id + * * @return PirepResource */ public function get($pirep_id) @@ -187,12 +195,14 @@ class PirepController extends Controller * status, and whatever other statuses may be defined * * @param PrefileRequest $request - * @return PirepResource + * * @throws \App\Exceptions\AircraftNotAtAirport * @throws \App\Exceptions\UserNotAtAirport * @throws \App\Exceptions\PirepCancelled * @throws \App\Exceptions\AircraftPermissionDenied * @throws \Exception + * + * @return PirepResource */ public function prefile(PrefileRequest $request) { @@ -211,28 +221,25 @@ class PirepController extends Controller $pirep = new Pirep($attrs); - # See if this user is at the current airport + // See if this user is at the current airport 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(); } - # See if this user is allowed to fly this aircraft + // See if this user is allowed to fly this aircraft if (setting('pireps.restrict_aircraft_to_rank', false) - && !$this->userSvc->aircraftAllowed($user, $pirep->aircraft_id)) - { + && !$this->userSvc->aircraftAllowed($user, $pirep->aircraft_id)) { throw new AircraftPermissionDenied(); } - # See if this aircraft is at the departure airport + // See if this aircraft is at the departure 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(); } - # Find if there's a duplicate, if so, let's work on that + // Find if there's a duplicate, if so, let's work on that $dupe_pirep = $this->pirepSvc->findDuplicate($pirep); if ($dupe_pirep !== false) { $pirep = $dupe_pirep; @@ -240,7 +247,7 @@ class PirepController extends Controller } // Default to a scheduled passenger flight - if(!array_key_exists('flight_type', $attrs)) { + if (!array_key_exists('flight_type', $attrs)) { $attrs['flight_type'] = 'J'; } @@ -262,11 +269,13 @@ class PirepController extends Controller * * @param $pirep_id * @param UpdateRequest $request - * @return PirepResource + * * @throws \App\Exceptions\PirepCancelled * @throws \App\Exceptions\AircraftPermissionDenied * @throws \Prettus\Validator\Exceptions\ValidatorException * @throws \Exception + * + * @return PirepResource */ public function update($pirep_id, UpdateRequest $request) { @@ -280,7 +289,7 @@ class PirepController extends Controller $attrs = $this->parsePirep($request); $attrs['user_id'] = Auth::id(); - # If aircraft is being changed, see if this user is allowed to fly this aircraft + // If aircraft is being changed, see if this user is allowed to fly this aircraft if (array_key_exists('aircraft_id', $attrs) && setting('pireps.restrict_aircraft_to_rank', false) ) { @@ -299,13 +308,16 @@ class PirepController extends Controller /** * File the PIREP + * * @param $pirep_id * @param FileRequest $request - * @return PirepResource + * * @throws \App\Exceptions\PirepCancelled * @throws \App\Exceptions\AircraftPermissionDenied * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * @throws \Exception + * + * @return PirepResource */ public function file($pirep_id, FileRequest $request) { @@ -313,13 +325,13 @@ class PirepController extends Controller $user = Auth::user(); - # Check if the status is cancelled... + // Check if the status is cancelled... $pirep = Pirep::find($pirep_id); $this->checkCancelled($pirep); $attrs = $this->parsePirep($request); - # If aircraft is being changed, see if this user is allowed to fly this aircraft + // If aircraft is being changed, see if this user is allowed to fly this aircraft if (array_key_exists('aircraft_id', $attrs) && setting('pireps.restrict_aircraft_to_rank', false) ) { @@ -343,9 +355,9 @@ class PirepController extends Controller Log::error($e); } - # See if there there is any route data posted - # If there isn't, then just write the route data from the - # route that's been posted from the PIREP + // See if there there is any route data posted + // If there isn't, then just write the route data from the + // route that's been posted from the PIREP $w = ['pirep_id' => $pirep->id, 'type' => AcarsType::ROUTE]; $count = Acars::where($w)->count(['id']); if ($count === 0) { @@ -357,10 +369,13 @@ class PirepController extends Controller /** * Cancel the PIREP + * * @param $pirep_id * @param Request $request - * @return PirepResource + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return PirepResource */ public function cancel($pirep_id, Request $request) { @@ -376,7 +391,9 @@ class PirepController extends Controller /** * Add a new comment - * @param $id + * + * @param $id + * * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function comments_get($id) @@ -387,10 +404,13 @@ class PirepController extends Controller /** * Add a new comment + * * @param $id * @param CommentRequest $request - * @return PirepCommentResource + * * @throws \App\Exceptions\PirepCancelled + * + * @return PirepCommentResource */ public function comments_post($id, CommentRequest $request) { @@ -399,7 +419,7 @@ class PirepController extends Controller Log::debug('Posting comment, PIREP: '.$id, $request->post()); - # Add it + // Add it $comment = new PirepComment($request->post()); $comment->pirep_id = $id; $comment->user_id = Auth::id(); @@ -410,7 +430,9 @@ class PirepController extends Controller /** * Get all of the fields for a PIREP + * * @param $pirep_id + * * @return PirepFieldCollection */ public function fields_get($pirep_id) @@ -421,8 +443,10 @@ class PirepController extends Controller /** * Set any fields for a PIREP + * * @param string $pirep_id * @param FieldsRequest $request + * * @return PirepFieldCollection */ public function fields_post($pirep_id, FieldsRequest $request) @@ -436,10 +460,12 @@ class PirepController extends Controller } /** - * @param $id - * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection + * @param $id + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function finances_get($id) { @@ -451,11 +477,13 @@ class PirepController extends Controller /** * @param $id * @param Request $request - * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Exception * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function finances_recalculate($id, Request $request) { @@ -471,6 +499,7 @@ class PirepController extends Controller /** * @param $id * @param Request $request + * * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function route_get($id, Request $request) @@ -478,22 +507,25 @@ class PirepController extends Controller $pirep = Pirep::find($id); return AcarsRouteResource::collection(Acars::where([ 'pirep_id' => $id, - 'type' => AcarsType::ROUTE + 'type' => AcarsType::ROUTE, ])->orderBy('order', 'asc')->get()); } /** * Post the ROUTE for a PIREP, can be done from the ACARS log + * * @param $id * @param RouteRequest $request - * @return \Illuminate\Http\JsonResponse + * * @throws \App\Exceptions\PirepCancelled * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException * @throws \Exception + * + * @return \Illuminate\Http\JsonResponse */ public function route_post($id, RouteRequest $request) { - # Check if the status is cancelled... + // Check if the status is cancelled... $pirep = Pirep::find($id); $this->checkCancelled($pirep); @@ -502,7 +534,7 @@ class PirepController extends Controller // Delete the route before posting a new one Acars::where([ 'pirep_id' => $id, - 'type' => AcarsType::ROUTE + 'type' => AcarsType::ROUTE, ])->delete(); $count = 0; @@ -518,7 +550,7 @@ class PirepController extends Controller $acars = Acars::create($position); $acars->save(); - ++$count; + $count++; } return $this->message($count.' points added', $count); @@ -527,8 +559,10 @@ class PirepController extends Controller /** * @param $id * @param Request $request - * @return \Illuminate\Http\JsonResponse + * * @throws \Exception + * + * @return \Illuminate\Http\JsonResponse */ public function route_delete($id, Request $request) { @@ -536,7 +570,7 @@ class PirepController extends Controller Acars::where([ 'pirep_id' => $id, - 'type' => AcarsType::ROUTE + 'type' => AcarsType::ROUTE, ])->delete(); return $this->message('Route deleted'); diff --git a/app/Http/Controllers/Api/SettingsController.php b/app/Http/Controllers/Api/SettingsController.php index 3e32caca..a4c66205 100644 --- a/app/Http/Controllers/Api/SettingsController.php +++ b/app/Http/Controllers/Api/SettingsController.php @@ -9,7 +9,6 @@ use Illuminate\Http\Request; /** * Class SettingsController - * @package App\Http\Controllers\Api */ class SettingsController extends Controller { @@ -17,6 +16,7 @@ class SettingsController extends Controller /** * SettingsController constructor. + * * @param SettingRepository $settingRepo */ public function __construct( @@ -27,7 +27,9 @@ class SettingsController extends Controller /** * Return all the airlines, paginated + * * @param Request $request + * * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function index(Request $request) diff --git a/app/Http/Controllers/Api/StatusController.php b/app/Http/Controllers/Api/StatusController.php index a79ed9d0..c8202ae3 100644 --- a/app/Http/Controllers/Api/StatusController.php +++ b/app/Http/Controllers/Api/StatusController.php @@ -7,7 +7,6 @@ use PragmaRX\Version\Package\Facade as Version; /** * Class StatusController - * @package App\Http\Controllers\Api */ class StatusController extends Controller { diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 5ba6bd2a..b86392a6 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -2,7 +2,6 @@ namespace App\Http\Controllers\Api; -use App\Exceptions\BidExists; use App\Http\Resources\Bid as BidResource; use App\Http\Resources\Pirep as PirepResource; use App\Http\Resources\Subfleet as SubfleetResource; @@ -24,19 +23,19 @@ use Prettus\Repository\Exceptions\RepositoryException; /** * Class UserController - * @package App\Http\Controllers\Api */ class UserController extends Controller { - private $flightRepo, - $flightSvc, - $pirepRepo, - $subfleetRepo, - $userRepo, - $userSvc; + private $flightRepo; + private $flightSvc; + private $pirepRepo; + private $subfleetRepo; + private $userRepo; + private $userSvc; /** * UserController constructor. + * * @param FlightRepository $flightRepo * @param FlightService $flightSvc * @param PirepRepository $pirepRepo @@ -62,6 +61,7 @@ class UserController extends Controller /** * @param Request $request + * * @return int|mixed */ protected function getUserId(Request $request) @@ -75,7 +75,9 @@ class UserController extends Controller /** * Return the profile for the currently auth'd user + * * @param Request $request + * * @return UserResource */ public function index(Request $request) @@ -85,7 +87,9 @@ class UserController extends Controller /** * Get the profile for the passed-in user + * * @param $id + * * @return UserResource */ public function get($id) @@ -95,16 +99,19 @@ class UserController extends Controller /** * Return all of the bids for the passed-in user + * * @param Request $request - * @return mixed + * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * @throws \App\Exceptions\BidExists + * + * @return mixed */ public function bids(Request $request) { $user = $this->userRepo->find($this->getUserId($request)); - # Add a bid + // Add a bid if ($request->isMethod('PUT') || $request->isMethod('POST')) { $flight_id = $request->input('flight_id'); $flight = $this->flightRepo->find($flight_id); @@ -125,7 +132,7 @@ class UserController extends Controller $this->flightSvc->removeBid($flight, $user); } - # Return the flights they currently have bids on + // Return the flights they currently have bids on $bids = Bid::where(['user_id' => $user->id])->get(); return BidResource::collection($bids); @@ -133,7 +140,9 @@ class UserController extends Controller /** * Return the fleet that this user is allowed to + * * @param Request $request + * * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function fleet(Request $request) @@ -146,8 +155,10 @@ class UserController extends Controller /** * @param Request $request - * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection + * * @throws RepositoryException + * + * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public function pireps(Request $request) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 01391717..c3f9b98c 100755 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -7,7 +7,6 @@ use Illuminate\Foundation\Auth\SendsPasswordResetEmails; /** * Class ForgotPasswordController - * @package App\Http\Controllers\Auth */ class ForgotPasswordController extends Controller { diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 668bd419..f714c8bf 100755 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -11,7 +11,6 @@ use Illuminate\Support\Facades\Log; /** * Class LoginController - * @package App\Http\Controllers\Auth */ class LoginController extends Controller { @@ -38,6 +37,7 @@ class LoginController extends Controller /** * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View */ protected function sendLoginResponse(Request $request) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 28bc0737..9658b14b 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -19,7 +19,6 @@ use Validator; /** * Class RegisterController - * @package App\Http\Controllers\Auth */ class RegisterController extends Controller { @@ -27,16 +26,18 @@ class RegisterController extends Controller /** * Where to redirect users after login / registration. + * * @var string */ protected $redirectTo = '/'; - private $airlineRepo, - $airportRepo, - $userService; + private $airlineRepo; + private $airportRepo; + private $userService; /** * RegisterController constructor. + * * @param AirlineRepository $airlineRepo * @param AirportRepository $airportRepo * @param UserService $userService @@ -72,7 +73,9 @@ class RegisterController extends Controller /** * Get a validator for an incoming registration request. - * @param array $data + * + * @param array $data + * * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) @@ -94,10 +97,13 @@ class RegisterController extends Controller /** * Get a validator for an incoming registration request. - * @param array $data - * @return User + * + * @param array $data + * * @throws \RuntimeException * @throws \Exception + * + * @return User */ protected function create(array $data) { @@ -119,9 +125,12 @@ class RegisterController extends Controller /** * Handle a registration request for the application. + * * @param Request $request - * @return mixed + * * @throws \Exception + * + * @return mixed */ public function register(Request $request) { diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 87bc20bf..7b758125 100755 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -8,7 +8,6 @@ use Illuminate\Http\Request; /** * Class ResetPasswordController - * @package App\Http\Controllers\Auth */ class ResetPasswordController extends Controller { @@ -19,6 +18,7 @@ class ResetPasswordController extends Controller /** * @param Request $request * @param null $token + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showResetForm(Request $request, $token = null) @@ -30,6 +30,7 @@ class ResetPasswordController extends Controller /** * Create a new controller instance. + * * @return void */ public function __construct() diff --git a/app/Http/Controllers/Frontend/AcarsController.php b/app/Http/Controllers/Frontend/AcarsController.php index 69cbf1b7..d35cc805 100644 --- a/app/Http/Controllers/Frontend/AcarsController.php +++ b/app/Http/Controllers/Frontend/AcarsController.php @@ -9,15 +9,15 @@ use Illuminate\Http\Request; /** * Class AcarsController - * @package App\Http\Controllers\Frontend */ class AcarsController extends Controller { - private $acarsRepo, - $geoSvc; + private $acarsRepo; + private $geoSvc; /** * AcarsController constructor. + * * @param AcarsRepository $acarsRepo * @param GeoService $geoSvc */ @@ -31,6 +31,7 @@ class AcarsController extends Controller /** * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) diff --git a/app/Http/Controllers/Frontend/AirportController.php b/app/Http/Controllers/Frontend/AirportController.php index b8479a6b..cfc34388 100644 --- a/app/Http/Controllers/Frontend/AirportController.php +++ b/app/Http/Controllers/Frontend/AirportController.php @@ -3,21 +3,18 @@ namespace App\Http\Controllers\Frontend; use App\Interfaces\Controller; -use App\Models\User; use App\Repositories\AirportRepository; use App\Repositories\FlightRepository; use Flash; -use Illuminate\Database\QueryException; use Request; /** * Class HomeController - * @package App\Http\Controllers\Frontend */ class AirportController extends Controller { - private $airportRepo, - $flightRepo; + private $airportRepo; + private $flightRepo; public function __construct( AirportRepository $airportRepo, @@ -29,6 +26,8 @@ class AirportController extends Controller /** * Show the airport + * + * @param mixed $id */ public function show($id, Request $request) { @@ -53,8 +52,8 @@ class AirportController extends Controller ])->all(); return view('airports.show', [ - 'airport' => $airport, - 'inbound_flights' => $inbound_flights, + 'airport' => $airport, + 'inbound_flights' => $inbound_flights, 'outbound_flights' => $outbound_flights, ]); } diff --git a/app/Http/Controllers/Frontend/DashboardController.php b/app/Http/Controllers/Frontend/DashboardController.php index 69ce6fbf..74b9525e 100644 --- a/app/Http/Controllers/Frontend/DashboardController.php +++ b/app/Http/Controllers/Frontend/DashboardController.php @@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Auth; /** * Class DashboardController - * @package App\Http\Controllers\Frontend */ class DashboardController extends Controller { @@ -16,6 +15,7 @@ class DashboardController extends Controller /** * DashboardController constructor. + * * @param PirepRepository $pirepRepo */ public function __construct(PirepRepository $pirepRepo) diff --git a/app/Http/Controllers/Frontend/DownloadController.php b/app/Http/Controllers/Frontend/DownloadController.php index aa3056a1..28aa0e38 100644 --- a/app/Http/Controllers/Frontend/DownloadController.php +++ b/app/Http/Controllers/Frontend/DownloadController.php @@ -10,7 +10,6 @@ use Illuminate\Support\Facades\Storage; /** * Class DownloadController - * @package App\Http\Controllers\Frontend */ class DownloadController extends Controller { @@ -25,7 +24,7 @@ class DownloadController extends Controller * Group all the files but compound the model with the ID, * since we can have multiple files for every `ref_model` */ - $grouped_files = $files->groupBy(function($item, $key) { + $grouped_files = $files->groupBy(function ($item, $key) { return $item['ref_model'].'_'.$item['ref_model_id']; }); @@ -35,7 +34,7 @@ class DownloadController extends Controller * name of the group to the object instance "name" */ $regrouped_files = []; - foreach($grouped_files as $group => $files) { + foreach ($grouped_files as $group => $files) { [$class, $id] = explode('_', $group); $klass = new $class(); $obj = $klass->find($id); @@ -54,6 +53,8 @@ class DownloadController extends Controller /** * Show the application dashboard. + * + * @param mixed $id */ public function show($id) { @@ -71,10 +72,10 @@ class DownloadController extends Controller return redirect(config('app.login_redirect')); } - ++$file->download_count; + $file->download_count++; $file->save(); - if($file->disk === 'public') { + if ($file->disk === 'public') { $storage = Storage::disk('public'); return $storage->download($file->path, $file->filename); } diff --git a/app/Http/Controllers/Frontend/FlightController.php b/app/Http/Controllers/Frontend/FlightController.php index 79e16171..d4b54a27 100644 --- a/app/Http/Controllers/Frontend/FlightController.php +++ b/app/Http/Controllers/Frontend/FlightController.php @@ -17,17 +17,17 @@ use Prettus\Repository\Exceptions\RepositoryException; /** * Class FlightController - * @package App\Http\Controllers\Frontend */ class FlightController extends Controller { - private $airlineRepo, - $airportRepo, - $flightRepo, - $geoSvc; + private $airlineRepo; + private $airportRepo; + private $flightRepo; + private $geoSvc; /** * FlightController constructor. + * * @param AirlineRepository $airlineRepo * @param AirportRepository $airportRepo * @param FlightRepository $flightRepo @@ -47,6 +47,7 @@ class FlightController extends Controller /** * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) @@ -56,7 +57,7 @@ class FlightController extends Controller 'visible' => true, ]; - if(setting('pilots.restrict_to_company')) { + if (setting('pilots.restrict_to_company')) { $where['airline_id'] = Auth::user()->airline_id; } @@ -90,7 +91,9 @@ class FlightController extends Controller /** * Find the user's bids and display them + * * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function bids(Request $request) @@ -111,15 +114,18 @@ class FlightController extends Controller /** * Make a search request using the Repository search + * * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function search(Request $request) { - if(setting('pilots.restrict_to_company')) { + if (setting('pilots.restrict_to_company')) { $this->flightRepo - ->pushCriteria(New WhereCriteria($request, ['airline_id' => Auth::user()->airline_id])) + ->pushCriteria(new WhereCriteria($request, ['airline_id' => Auth::user()->airline_id])) ->paginate(); } @@ -141,7 +147,9 @@ class FlightController extends Controller /** * Show the flight information page + * * @param $id + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View */ public function show($id) diff --git a/app/Http/Controllers/Frontend/HomeController.php b/app/Http/Controllers/Frontend/HomeController.php index 2c47e360..aba33070 100644 --- a/app/Http/Controllers/Frontend/HomeController.php +++ b/app/Http/Controllers/Frontend/HomeController.php @@ -8,7 +8,6 @@ use Illuminate\Database\QueryException; /** * Class HomeController - * @package App\Http\Controllers\Frontend */ class HomeController extends Controller { diff --git a/app/Http/Controllers/Frontend/PirepController.php b/app/Http/Controllers/Frontend/PirepController.php index e900ccb1..a494af7b 100644 --- a/app/Http/Controllers/Frontend/PirepController.php +++ b/app/Http/Controllers/Frontend/PirepController.php @@ -2,7 +2,6 @@ namespace App\Http\Controllers\Frontend; -use App\Exceptions\UserNotAtAirport; use App\Facades\Utils; use App\Http\Requests\CreatePirepRequest; use App\Http\Requests\UpdatePirepRequest; @@ -30,22 +29,22 @@ use PirepStatus; /** * Class PirepController - * @package App\Http\Controllers\Frontend */ class PirepController extends Controller { - private $aircraftRepo, - $airlineRepo, - $fareSvc, - $geoSvc, - $pirepRepo, - $airportRepo, - $pirepFieldRepo, - $pirepSvc, - $userSvc; + private $aircraftRepo; + private $airlineRepo; + private $fareSvc; + private $geoSvc; + private $pirepRepo; + private $airportRepo; + private $pirepFieldRepo; + private $pirepSvc; + private $userSvc; /** * PirepController constructor. + * * @param AircraftRepository $aircraftRepo * @param AirlineRepository $airlineRepo * @param AirportRepository $airportRepo @@ -81,7 +80,10 @@ class PirepController extends Controller /** * Dropdown with aircraft grouped by subfleet - * @param null $user + * + * @param null $user + * @param mixed $add_blank + * * @return array */ public function aircraftList($user = null, $add_blank = false) @@ -107,6 +109,7 @@ class PirepController extends Controller /** * Save any custom fields found + * * @param Pirep $pirep * @param Request $request */ @@ -123,7 +126,7 @@ class PirepController extends Controller 'name' => $field->name, 'slug' => $field->slug, 'value' => $request->input($field->slug), - 'source' => PirepSource::MANUAL + 'source' => PirepSource::MANUAL, ]; } @@ -133,8 +136,10 @@ class PirepController extends Controller /** * Save the fares that have been specified/saved + * * @param Pirep $pirep * @param Request $request + * * @throws \Exception */ protected function saveFares(Pirep $pirep, Request $request) @@ -163,8 +168,10 @@ class PirepController extends Controller /** * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { @@ -184,6 +191,7 @@ class PirepController extends Controller /** * @param $id + * * @return mixed */ public function show($id) @@ -204,7 +212,9 @@ class PirepController extends Controller /** * Return the fares form for a given aircraft + * * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function fares(Request $request) @@ -220,6 +230,7 @@ class PirepController extends Controller /** * Create a new flight report + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create() @@ -239,8 +250,10 @@ class PirepController extends Controller /** * @param CreatePirepRequest $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(CreatePirepRequest $request) { @@ -251,8 +264,8 @@ class PirepController extends Controller $attrs = $request->all(); $attrs['submit'] = strtolower($attrs['submit']); - if($attrs['submit'] === 'submit') { - # Are they allowed at this airport? + if ($attrs['submit'] === 'submit') { + // Are they allowed at this airport? if (setting('pilots.only_flights_from_current') && Auth::user()->curr_airport_id !== $pirep->dpt_airport_id) { return $this->flashError( @@ -261,7 +274,7 @@ class PirepController extends Controller ); } - # Can they fly this aircraft? + // Can they fly this aircraft? if (setting('pireps.restrict_aircraft_to_rank', false) && !$this->userSvc->aircraftAllowed(Auth::user(), $pirep->aircraft_id)) { return $this->flashError( @@ -270,7 +283,7 @@ class PirepController extends Controller ); } - # is the aircraft in the right place? + // is the aircraft in the right place? if (setting('pireps.only_aircraft_at_dpt_airport') && $pirep->aircraft_id !== $pirep->dpt_airport_id) { return $this->flashError( @@ -279,7 +292,7 @@ class PirepController extends Controller ); } - # Make sure this isn't a duplicate + // Make sure this isn't a duplicate $dupe_pirep = $this->pirepSvc->findDuplicate($pirep); if ($dupe_pirep !== false) { return $this->flashError( @@ -305,13 +318,13 @@ class PirepController extends Controller // Depending on the button they selected, set an initial state // Can be saved as a draft or just submitted if ($attrs['submit'] === 'save') { - if(!$pirep->read_only) { + if (!$pirep->read_only) { $pirep->state = PirepState::DRAFT; } $pirep->save(); Flash::success('PIREP saved successfully.'); - } else if ($attrs['submit'] === 'submit') { + } elseif ($attrs['submit'] === 'submit') { $this->pirepSvc->submit($pirep); Flash::success('PIREP submitted!'); } @@ -321,7 +334,9 @@ class PirepController extends Controller /** * Show the form for editing the specified Pirep. - * @param int $id + * + * @param int $id + * * @return mixed */ public function edit($id) @@ -332,16 +347,16 @@ class PirepController extends Controller return redirect(route('frontend.pireps.index')); } - # Eager load the subfleet and fares under it + // Eager load the subfleet and fares under it $pirep->aircraft->load('subfleet.fares'); $time = new Time($pirep->flight_time); $pirep->hours = $time->hours; $pirep->minutes = $time->minutes; - # set the custom fields + // set the custom fields foreach ($pirep->fields as $field) { - if($field->slug == null) { + if ($field->slug == null) { $field->slug = str_slug($field->name); } @@ -349,7 +364,7 @@ class PirepController extends Controller $pirep->{$field_name} = $field->value; } - # set the fares + // set the fares foreach ($pirep->fares as $fare) { $field_name = 'fare_'.$fare->fare_id; $pirep->{$field_name} = $fare->count; @@ -368,9 +383,11 @@ class PirepController extends Controller /** * @param $id * @param UpdatePirepRequest $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * * @throws \Prettus\Validator\Exceptions\ValidatorException * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update($id, UpdatePirepRequest $request) { @@ -384,7 +401,7 @@ class PirepController extends Controller $attrs = $request->all(); $attrs['submit'] = strtolower($attrs['submit']); - # Fix the time + // Fix the time $attrs['flight_time'] = Time::init( $attrs['minutes'], $attrs['hours'])->getMinutes(); @@ -399,12 +416,12 @@ class PirepController extends Controller $this->saveCustomFields($pirep, $request); $this->saveFares($pirep, $request); - if($attrs['submit'] === 'save') { + if ($attrs['submit'] === 'save') { Flash::success('PIREP saved successfully.'); - } else if($attrs['submit'] === 'submit') { + } elseif ($attrs['submit'] === 'submit') { $this->pirepSvc->submit($pirep); Flash::success('PIREP submitted!'); - } else if($attrs['submit'] === 'delete' || $attrs['submit'] === 'cancel') { + } elseif ($attrs['submit'] === 'delete' || $attrs['submit'] === 'cancel') { $this->pirepRepo->update([ 'state' => PirepState::CANCELLED, 'status' => PirepStatus::CANCELLED, @@ -419,8 +436,10 @@ class PirepController extends Controller /** * Submit the PIREP + * * @param $id * @param Request $request + * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function submit($id, Request $request) diff --git a/app/Http/Controllers/Frontend/ProfileController.php b/app/Http/Controllers/Frontend/ProfileController.php index 286a7dd7..c4257b52 100644 --- a/app/Http/Controllers/Frontend/ProfileController.php +++ b/app/Http/Controllers/Frontend/ProfileController.php @@ -13,24 +13,24 @@ use Flash; use Hash; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Storage; +use Intervention\Image\Facades\Image; use Jackiedo\Timezonelist\Facades\Timezonelist; use Log; use Validator; -use Intervention\Image\Facades\Image; -use Illuminate\Support\Facades\Storage; /** * Class ProfileController - * @package App\Http\Controllers\Frontend */ class ProfileController extends Controller { - private $airlineRepo, - $airportRepo, - $userRepo; + private $airlineRepo; + private $airportRepo; + private $userRepo; /** * ProfileController constructor. + * * @param AirlineRepository $airlineRepo * @param AirportRepository $airportRepo * @param UserRepository $userRepo @@ -64,6 +64,7 @@ class ProfileController extends Controller /** * @param $id + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View */ public function show($id) @@ -85,7 +86,9 @@ class ProfileController extends Controller /** * Show the edit for form the user's profile + * * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View */ public function edit(Request $request) @@ -111,8 +114,10 @@ class ProfileController extends Controller /** * @param Request $request - * @return $this + * * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return $this */ public function update(Request $request) { @@ -148,7 +153,7 @@ class ProfileController extends Controller } if ($request->hasFile('avatar')) { $avatar = $request->file('avatar'); - $file_name = $user->pilot_id . '.' .$avatar->getClientOriginalExtension(); + $file_name = $user->pilot_id.'.'.$avatar->getClientOriginalExtension(); $path = "avatars/{$file_name}"; Image::make($avatar)->resize(config('phpvms.avatar.width'), config('phpvms.avatar.height'))->save(public_path('uploads/avatars/'.$file_name)); $req_data['avatar'] = $path; @@ -163,7 +168,9 @@ class ProfileController extends Controller /** * Regenerate the user's API key + * * @param Request $request + * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function regen_apikey(Request $request) diff --git a/app/Http/Controllers/Frontend/UserController.php b/app/Http/Controllers/Frontend/UserController.php index e7b43ec6..679bed8a 100644 --- a/app/Http/Controllers/Frontend/UserController.php +++ b/app/Http/Controllers/Frontend/UserController.php @@ -8,7 +8,6 @@ use Illuminate\Http\Request; /** * Class UserController - * @package App\Http\Controllers\Frontend */ class UserController extends Controller { @@ -16,6 +15,7 @@ class UserController extends Controller /** * UserController constructor. + * * @param UserRepository $userRepo */ public function __construct( @@ -26,6 +26,7 @@ class UserController extends Controller /** * @param Request $request + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) diff --git a/app/Http/Middleware/ApiAuth.php b/app/Http/Middleware/ApiAuth.php index 08abc31e..5064e8b8 100644 --- a/app/Http/Middleware/ApiAuth.php +++ b/app/Http/Middleware/ApiAuth.php @@ -15,8 +15,9 @@ class ApiAuth /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) @@ -52,6 +53,9 @@ class ApiAuth /** * Return an unauthorized message + * + * @param mixed $details + * * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ private function unauthorized($details = '') diff --git a/app/Http/Middleware/MeasureExecutionTime.php b/app/Http/Middleware/MeasureExecutionTime.php index 2a6ca73f..b83329d6 100644 --- a/app/Http/Middleware/MeasureExecutionTime.php +++ b/app/Http/Middleware/MeasureExecutionTime.php @@ -12,8 +12,8 @@ class MeasureExecutionTime /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next * * @return mixed */ diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 8b10025e..abb8423b 100755 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -10,9 +10,10 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * * @return mixed */ public function handle($request, Closure $next, $guard = null) diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 1ab3b7f6..0faba9ee 100755 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -8,6 +8,7 @@ class VerifyCsrfToken extends BaseVerifier { /** * The URIs that should be excluded from CSRF verification. + * * @var array */ protected $except = [ diff --git a/app/Http/Requests/Acars/CommentRequest.php b/app/Http/Requests/Acars/CommentRequest.php index a80013d0..83feded9 100644 --- a/app/Http/Requests/Acars/CommentRequest.php +++ b/app/Http/Requests/Acars/CommentRequest.php @@ -6,13 +6,12 @@ use App\Interfaces\FormRequest; /** * Class FileRequest - * @package App\Http\Requests\Acars */ class CommentRequest extends FormRequest { public function authorize() { - return true; # Anyone can comment + return true; // Anyone can comment } public function rules() diff --git a/app/Http/Requests/Acars/EventRequest.php b/app/Http/Requests/Acars/EventRequest.php index a0e8614b..94447e64 100644 --- a/app/Http/Requests/Acars/EventRequest.php +++ b/app/Http/Requests/Acars/EventRequest.php @@ -8,13 +8,13 @@ use Auth; /** * Class EventRequest - * @package App\Http\Requests\Acars */ class EventRequest extends FormRequest { /** - * @return bool * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + * + * @return bool */ public function authorize() { diff --git a/app/Http/Requests/Acars/FieldsRequest.php b/app/Http/Requests/Acars/FieldsRequest.php index fc220e17..683469ae 100644 --- a/app/Http/Requests/Acars/FieldsRequest.php +++ b/app/Http/Requests/Acars/FieldsRequest.php @@ -6,7 +6,6 @@ use App\Interfaces\FormRequest; /** * Class PrefileRequest - * @package App\Http\Requests\Acars */ class FieldsRequest extends FormRequest { diff --git a/app/Http/Requests/Acars/FileRequest.php b/app/Http/Requests/Acars/FileRequest.php index 54055fe5..4e857afc 100644 --- a/app/Http/Requests/Acars/FileRequest.php +++ b/app/Http/Requests/Acars/FileRequest.php @@ -8,7 +8,6 @@ use Auth; /** * Class FileRequest - * @package App\Http\Requests\Acars */ class FileRequest extends FormRequest { @@ -48,10 +47,10 @@ class FileRequest extends FormRequest 'block_on_time' => 'nullable|date', 'created_at' => 'nullable|date', - # See if the fare objects are included and formatted properly - 'fares' => 'nullable|array', - 'fares.*.id' => 'required', - 'fares.*.count' => 'required|numeric', + // See if the fare objects are included and formatted properly + 'fares' => 'nullable|array', + 'fares.*.id' => 'required', + 'fares.*.count' => 'required|numeric', ]; return $rules; diff --git a/app/Http/Requests/Acars/LogRequest.php b/app/Http/Requests/Acars/LogRequest.php index 7adeb309..9964ca82 100644 --- a/app/Http/Requests/Acars/LogRequest.php +++ b/app/Http/Requests/Acars/LogRequest.php @@ -8,7 +8,6 @@ use Auth; /** * Class LogRequest - * @package App\Http\Requests\Acars */ class LogRequest extends FormRequest { diff --git a/app/Http/Requests/Acars/PositionRequest.php b/app/Http/Requests/Acars/PositionRequest.php index d2623a6e..5aef5163 100644 --- a/app/Http/Requests/Acars/PositionRequest.php +++ b/app/Http/Requests/Acars/PositionRequest.php @@ -9,7 +9,6 @@ use Auth; /** * Class PositionRequest - * @package App\Http\Requests\Acars */ class PositionRequest extends FormRequest { diff --git a/app/Http/Requests/Acars/PrefileRequest.php b/app/Http/Requests/Acars/PrefileRequest.php index fdbf2722..14d7c989 100644 --- a/app/Http/Requests/Acars/PrefileRequest.php +++ b/app/Http/Requests/Acars/PrefileRequest.php @@ -7,7 +7,6 @@ use App\Models\Pirep; /** * Class PrefileRequest - * @package App\Http\Requests\Acars */ class PrefileRequest extends FormRequest { @@ -51,10 +50,10 @@ class PrefileRequest extends FormRequest 'block_on_time' => 'nullable|date', 'created_at' => 'nullable|date', - # See if the fare objects are included and formatted properly - 'fares' => 'nullable|array', - 'fares.*.id' => 'required', - 'fares.*.count' => 'required|numeric', + // See if the fare objects are included and formatted properly + 'fares' => 'nullable|array', + 'fares.*.id' => 'required', + 'fares.*.count' => 'required|numeric', ]; return $rules; diff --git a/app/Http/Requests/Acars/RouteRequest.php b/app/Http/Requests/Acars/RouteRequest.php index f50821b2..8d70027e 100644 --- a/app/Http/Requests/Acars/RouteRequest.php +++ b/app/Http/Requests/Acars/RouteRequest.php @@ -8,7 +8,6 @@ use Auth; /** * Class RouteRequest - * @package App\Http\Requests\Acars */ class RouteRequest extends FormRequest { diff --git a/app/Http/Requests/Acars/UpdateRequest.php b/app/Http/Requests/Acars/UpdateRequest.php index 4a1d7985..926b2b20 100644 --- a/app/Http/Requests/Acars/UpdateRequest.php +++ b/app/Http/Requests/Acars/UpdateRequest.php @@ -8,7 +8,6 @@ use Auth; /** * Class UpdateRequest - * @package App\Http\Requests\Acars */ class UpdateRequest extends FormRequest { @@ -48,10 +47,10 @@ class UpdateRequest extends FormRequest 'status' => 'nullable', 'score' => 'nullable|integer', - # See if the fare objects are included and formatted properly - 'fares' => 'nullable|array', - 'fares.*.id' => 'required', - 'fares.*.count' => 'required|numeric', + // See if the fare objects are included and formatted properly + 'fares' => 'nullable|array', + 'fares.*.id' => 'required', + 'fares.*.count' => 'required|numeric', ]; return $rules; diff --git a/app/Http/Requests/CreateAircraftRequest.php b/app/Http/Requests/CreateAircraftRequest.php index 09d7b4cf..6f8fa34d 100644 --- a/app/Http/Requests/CreateAircraftRequest.php +++ b/app/Http/Requests/CreateAircraftRequest.php @@ -9,6 +9,7 @@ class CreateAircraftRequest extends FormRequest { /** * Determine if the user is authorized to make this request. + * * @return bool */ public function authorize(): bool @@ -18,6 +19,7 @@ class CreateAircraftRequest extends FormRequest /** * Get the validation rules that apply to the request. + * * @return array */ public function rules(): array diff --git a/app/Http/Requests/CreateAirportRequest.php b/app/Http/Requests/CreateAirportRequest.php index 869cc11c..5894cc1d 100644 --- a/app/Http/Requests/CreateAirportRequest.php +++ b/app/Http/Requests/CreateAirportRequest.php @@ -7,12 +7,12 @@ use Illuminate\Foundation\Http\FormRequest; /** * Class CreateAirportRequest - * @package App\Http\Requests */ class CreateAirportRequest extends FormRequest { /** * Determine if the user is authorized to make this request. + * * @return bool */ public function authorize(): bool @@ -22,6 +22,7 @@ class CreateAirportRequest extends FormRequest /** * Get the validation rules that apply to the request. + * * @return array */ public function rules(): array diff --git a/app/Http/Requests/CreateFareRequest.php b/app/Http/Requests/CreateFareRequest.php index 8271ffea..7b01a635 100644 --- a/app/Http/Requests/CreateFareRequest.php +++ b/app/Http/Requests/CreateFareRequest.php @@ -9,6 +9,7 @@ class CreateFareRequest extends FormRequest { /** * Determine if the user is authorized to make this request. + * * @return bool */ public function authorize(): bool @@ -18,6 +19,7 @@ class CreateFareRequest extends FormRequest /** * Get the validation rules that apply to the request. + * * @return array */ public function rules(): array diff --git a/app/Http/Requests/CreatePirepRequest.php b/app/Http/Requests/CreatePirepRequest.php index 415ccd3e..5a2b39b2 100644 --- a/app/Http/Requests/CreatePirepRequest.php +++ b/app/Http/Requests/CreatePirepRequest.php @@ -28,7 +28,7 @@ class CreatePirepRequest extends FormRequest { // Don't run validations if it's just being saved $action = strtolower(request('submit', 'submit')); - if($action === 'save') { + if ($action === 'save') { return [ 'airline_id' => 'required|exists:airlines,id', 'flight_number' => 'required', @@ -42,7 +42,7 @@ class CreatePirepRequest extends FormRequest $field_rules['hours'] = 'nullable|integer'; $field_rules['minutes'] = 'nullable|integer'; - # Add the validation rules for the custom fields + // Add the validation rules for the custom fields $pirepFieldRepo = app(PirepFieldRepository::class); $custom_fields = $pirepFieldRepo->all(); diff --git a/app/Http/Requests/CreateSubfleetRequest.php b/app/Http/Requests/CreateSubfleetRequest.php index 92c9094e..073cacf9 100644 --- a/app/Http/Requests/CreateSubfleetRequest.php +++ b/app/Http/Requests/CreateSubfleetRequest.php @@ -9,6 +9,7 @@ class CreateSubfleetRequest extends FormRequest { /** * Determine if the user is authorized to make this request. + * * @return bool */ public function authorize(): bool @@ -18,6 +19,7 @@ class CreateSubfleetRequest extends FormRequest /** * Get the validation rules that apply to the request. + * * @return array */ public function rules(): array diff --git a/app/Http/Requests/CreateUserRequest.php b/app/Http/Requests/CreateUserRequest.php index 4570fdb4..a1ad752c 100644 --- a/app/Http/Requests/CreateUserRequest.php +++ b/app/Http/Requests/CreateUserRequest.php @@ -9,6 +9,7 @@ class CreateUserRequest extends FormRequest { /** * Determine if the user is authorized to make this request. + * * @return bool */ public function authorize(): bool @@ -18,6 +19,7 @@ class CreateUserRequest extends FormRequest /** * Get the validation rules that apply to the request. + * * @return array */ public function rules(): array diff --git a/app/Http/Requests/ImportRequest.php b/app/Http/Requests/ImportRequest.php index a1c45632..fc60f04b 100644 --- a/app/Http/Requests/ImportRequest.php +++ b/app/Http/Requests/ImportRequest.php @@ -7,16 +7,16 @@ use Illuminate\Http\Request; /** * Validate that the files are imported - * @package App\Http\Requests */ class ImportRequest extends FormRequest { public static $rules = [ - 'csv_file' => 'required|file', + 'csv_file' => 'required|file', ]; /** * @param Request $request + * * @throws \Illuminate\Validation\ValidationException */ public static function validate(Request $request) diff --git a/app/Http/Requests/UpdateFilesRequest.php b/app/Http/Requests/UpdateFilesRequest.php index 137c90a2..fa183d3e 100644 --- a/app/Http/Requests/UpdateFilesRequest.php +++ b/app/Http/Requests/UpdateFilesRequest.php @@ -6,12 +6,12 @@ use Illuminate\Foundation\Http\FormRequest; /** * Class CreateFilesRequest - * @package App\Http\Requests */ class UpdateFilesRequest extends FormRequest { /** * Determine if the user is authorized to make this request. + * * @return bool */ public function authorize(): bool @@ -21,6 +21,7 @@ class UpdateFilesRequest extends FormRequest /** * Get the validation rules that apply to the request. + * * @return array */ public function rules(): array @@ -29,7 +30,7 @@ class UpdateFilesRequest extends FormRequest 'name' => 'required', 'file' => 'nullable|file', - #'files.*' => 'required|file', + //'files.*' => 'required|file', ]; } } diff --git a/app/Http/Requests/UpdatePirepRequest.php b/app/Http/Requests/UpdatePirepRequest.php index 0b6b4b89..29fd0ebe 100644 --- a/app/Http/Requests/UpdatePirepRequest.php +++ b/app/Http/Requests/UpdatePirepRequest.php @@ -42,7 +42,7 @@ class UpdatePirepRequest extends FormRequest $field_rules['hours'] = 'nullable|integer'; $field_rules['minutes'] = 'nullable|integer'; - # Add the validation rules for the custom fields + // Add the validation rules for the custom fields $pirepFieldRepo = app(PirepFieldRepository::class); $custom_fields = $pirepFieldRepo->all(); diff --git a/app/Http/Resources/Acars.php b/app/Http/Resources/Acars.php index 12b17ff0..e4602d37 100644 --- a/app/Http/Resources/Acars.php +++ b/app/Http/Resources/Acars.php @@ -11,7 +11,8 @@ class Acars extends Resource /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) diff --git a/app/Http/Resources/AcarsLog.php b/app/Http/Resources/AcarsLog.php index 55eff275..3d86cf23 100644 --- a/app/Http/Resources/AcarsLog.php +++ b/app/Http/Resources/AcarsLog.php @@ -7,7 +7,6 @@ use Illuminate\Http\Resources\Json\Resource; /** * ACARS table but only include the fields for the routes * Class AcarsRoute - * @package App\Http\Resources */ class AcarsLog extends Resource { diff --git a/app/Http/Resources/AcarsRoute.php b/app/Http/Resources/AcarsRoute.php index a1795f16..9e756683 100644 --- a/app/Http/Resources/AcarsRoute.php +++ b/app/Http/Resources/AcarsRoute.php @@ -7,7 +7,6 @@ use Illuminate\Http\Resources\Json\Resource; /** * ACARS table but only include the fields for the routes * Class AcarsRoute - * @package App\Http\Resources */ class AcarsRoute extends Resource { diff --git a/app/Http/Resources/Airline.php b/app/Http/Resources/Airline.php index 2f945c4b..50ad22ae 100644 --- a/app/Http/Resources/Airline.php +++ b/app/Http/Resources/Airline.php @@ -15,9 +15,9 @@ class Airline extends Resource 'name' => $this->name, 'country' => $this->country, 'logo' => $this->logo, - #'active' => $this->active, - #'created_at' => $this->created_at, - #'updated_at' => $this->updated_at, + //'active' => $this->active, + //'created_at' => $this->created_at, + //'updated_at' => $this->updated_at, ]; } } diff --git a/app/Http/Resources/Flight.php b/app/Http/Resources/Flight.php index 1fd9cff7..4d235984 100644 --- a/app/Http/Resources/Flight.php +++ b/app/Http/Resources/Flight.php @@ -9,6 +9,7 @@ class Flight extends Resource { /** * Set the fields on the flight object + * * @return array */ private function setFields() diff --git a/app/Http/Resources/News.php b/app/Http/Resources/News.php index 8262b310..a5f94272 100644 --- a/app/Http/Resources/News.php +++ b/app/Http/Resources/News.php @@ -6,23 +6,22 @@ use Illuminate\Http\Resources\Json\Resource; /** * Class Response - * @package App\Http\Resources - * Generic response resource */ class News extends Resource { /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) { $resp = parent::toArray($request); $resp['user'] = [ - 'id' => $this->user->id, - 'name' => $this->user->name, + 'id' => $this->user->id, + 'name' => $this->user->name, ]; return $resp; diff --git a/app/Http/Resources/Pirep.php b/app/Http/Resources/Pirep.php index 2e00a55a..7930b255 100644 --- a/app/Http/Resources/Pirep.php +++ b/app/Http/Resources/Pirep.php @@ -12,7 +12,8 @@ class Pirep extends Resource /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) @@ -37,11 +38,13 @@ class Pirep extends Resource * Relationship fields */ - if($this->block_on_time) + if ($this->block_on_time) { $pirep['block_on_time'] = $this->block_on_time->toIso8601ZuluString(); + } - if($this->block_off_time) + if ($this->block_off_time) { $pirep['block_off_time'] = $this->block_off_time->toIso8601ZuluString(); + } $pirep['status_text'] = PirepStatus::label($this->status); @@ -58,7 +61,7 @@ class Pirep extends Resource 'curr_airport_id' => $this->user->curr_airport_id, ]; - # format to kvp + // format to kvp $pirep['fields'] = new PirepFieldCollection($this->fields); return $pirep; diff --git a/app/Http/Resources/PirepComment.php b/app/Http/Resources/PirepComment.php index d2464b89..58336a5b 100644 --- a/app/Http/Resources/PirepComment.php +++ b/app/Http/Resources/PirepComment.php @@ -6,15 +6,14 @@ use Illuminate\Http\Resources\Json\Resource; /** * Class Response - * @package App\Http\Resources - * Generic response resource */ class PirepComment extends Resource { /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) diff --git a/app/Http/Resources/PirepFieldCollection.php b/app/Http/Resources/PirepFieldCollection.php index 7456c75b..8186fa45 100644 --- a/app/Http/Resources/PirepFieldCollection.php +++ b/app/Http/Resources/PirepFieldCollection.php @@ -6,14 +6,13 @@ use Illuminate\Http\Resources\Json\ResourceCollection; /** * Class PirepFieldCollection - * @package App\Http\Resources */ class PirepFieldCollection extends ResourceCollection { public function toArray($request) { $obj = []; - foreach($this->collection as $field) { + foreach ($this->collection as $field) { $obj[$field->name] = $field->value; } diff --git a/app/Http/Resources/Rank.php b/app/Http/Resources/Rank.php index 23d91d56..4d3d0777 100644 --- a/app/Http/Resources/Rank.php +++ b/app/Http/Resources/Rank.php @@ -9,7 +9,8 @@ class Rank extends Resource /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) diff --git a/app/Http/Resources/Response.php b/app/Http/Resources/Response.php index b2c89651..bbf0cc65 100644 --- a/app/Http/Resources/Response.php +++ b/app/Http/Resources/Response.php @@ -6,15 +6,14 @@ use Illuminate\Http\Resources\Json\Resource; /** * Class Response - * @package App\Http\Resources - * Generic response resource */ class Response extends Resource { /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) diff --git a/app/Http/Resources/UserBid.php b/app/Http/Resources/UserBid.php index 3c87fdfc..59207823 100644 --- a/app/Http/Resources/UserBid.php +++ b/app/Http/Resources/UserBid.php @@ -12,9 +12,9 @@ class UserBid extends Resource 'id' => $this->id, 'user_id' => $this->user_id, 'flight_id' => $this->flight_id, - 'flights' => Flight::collection($this->whenLoaded('flight')) - #'created_at' => $this->created_at, - #'updated_at' => $this->updated_at, + 'flights' => Flight::collection($this->whenLoaded('flight')), + //'created_at' => $this->created_at, + //'updated_at' => $this->updated_at, ]; } } diff --git a/app/Interfaces/Award.php b/app/Interfaces/Award.php index 5e43e739..389cc4aa 100644 --- a/app/Interfaces/Award.php +++ b/app/Interfaces/Award.php @@ -15,7 +15,6 @@ use Log; * public function check($parameter=null) * * See: http://docs.phpvms.net/customizing/awards - * @package App\Interfaces */ abstract class Award { @@ -25,7 +24,9 @@ abstract class Award /** * Each award class just needs to return true or false if it should actually * be awarded to a user. This is the only method that needs to be implemented + * * @param null $parameter Optional parameters that are passed in from the UI + * * @return bool */ abstract public function check($parameter = null): bool; @@ -34,11 +35,12 @@ abstract class Award * You don't really need to mess with anything below here */ - protected $award, - $user; + protected $award; + protected $user; /** * AwardInterface constructor. + * * @param AwardModel $award * @param User $user */ @@ -55,7 +57,7 @@ abstract class Award */ final public function handle(): void { - # Check if the params are a JSON object or array + // Check if the params are a JSON object or array $param = $this->award->ref_model_params; if (Utils::isObject($this->award->ref_model_params)) { $param = json_decode($this->award->ref_model_params); @@ -68,6 +70,7 @@ abstract class Award /** * Add the award to this user, if they don't already have it + * * @return bool|UserAward */ final protected function addAward() @@ -87,13 +90,13 @@ abstract class Award try { $award->save(); - } catch(\Exception $e) { + } catch (\Exception $e) { Log::error( 'Error saving award: '.$e->getMessage(), $e->getTrace() ); - return null; + return; } return $award; diff --git a/app/Interfaces/Controller.php b/app/Interfaces/Controller.php index 76d66942..4cd35885 100755 --- a/app/Interfaces/Controller.php +++ b/app/Interfaces/Controller.php @@ -9,7 +9,6 @@ use Illuminate\Http\Request; /** * Class Controller - * @package App\Http\Controllers */ abstract class Controller extends \Illuminate\Routing\Controller { @@ -17,8 +16,10 @@ abstract class Controller extends \Illuminate\Routing\Controller /** * Write a error to the flash and redirect the user to a route + * * @param $message * @param $route + * * @return mixed */ public function flashError($message, $route) @@ -29,15 +30,18 @@ abstract class Controller extends \Illuminate\Routing\Controller /** * Shortcut function to get the attributes from a request while running the validations + * * @param Request $request * @param array $attrs_or_validations * @param array $addtl_fields - * @return array + * * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + * + * @return array */ public function getFromReq($request, $attrs_or_validations, $addtl_fields = null) { - # See if a list of values is passed in, or if a validation list is passed in + // See if a list of values is passed in, or if a validation list is passed in $is_validation = false; if (\count(array_filter(array_keys($attrs_or_validations), '\is_string')) > 0) { $is_validation = true; @@ -73,13 +77,16 @@ abstract class Controller extends \Illuminate\Routing\Controller /** * Simple normalized method for forming the JSON responses + * * @param $message + * @param null|mixed $count + * * @return \Illuminate\Http\JsonResponse */ public function message($message, $count = null) { $attrs = [ - 'message' => $message + 'message' => $message, ]; if ($count !== null) { diff --git a/app/Interfaces/Enum.php b/app/Interfaces/Enum.php index fc82547e..72778b30 100644 --- a/app/Interfaces/Enum.php +++ b/app/Interfaces/Enum.php @@ -4,7 +4,6 @@ namespace App\Interfaces; /** * Borrowed some ideas from myclabs/php-enum after this was created - * @package App\Models\Enums */ abstract class Enum { @@ -13,12 +12,13 @@ abstract class Enum protected static $labels = []; /** - * @var integer + * @var int */ protected $value; /** * Create an instance of this Enum + * * @param $val */ public function __construct($val) @@ -28,6 +28,7 @@ abstract class Enum /** * Return the value that's been set if this is an instance + * * @return mixed */ final public function getValue() @@ -37,7 +38,9 @@ abstract class Enum /** * Return the label, try to return the translated version as well + * * @param $value + * * @return mixed */ final public static function label($value) @@ -62,7 +65,9 @@ abstract class Enum /** * Get the numeric value from a string code + * * @param $code + * * @return mixed|null */ public static function getFromCode($code) @@ -72,14 +77,16 @@ abstract class Enum /** * Convert the integer value into one of the codes + * * @param $value + * * @return false|int|string */ public static function convertToCode($value) { $value = (int) $value; if (!array_key_exists($value, static::$codes)) { - return null; + return; } return static::$codes[$value]; @@ -87,7 +94,9 @@ abstract class Enum /** * Select box entry items - * @param bool $add_blank + * + * @param bool $add_blank + * * @return array */ public static function select($add_blank = false): array @@ -106,8 +115,10 @@ abstract class Enum /** * Returns all possible values as an array - * @return array Constant name in key, constant value in value + * * @throws \ReflectionException + * + * @return array Constant name in key, constant value in value */ public static function toArray(): array { @@ -122,9 +133,10 @@ abstract class Enum /** * @param Enum $enum + * * @return bool */ - final public function equals(Enum $enum): bool + final public function equals(self $enum): bool { return $this->getValue() === $enum->getValue() && get_called_class() == get_class($enum); } @@ -132,11 +144,14 @@ abstract class Enum /** * Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a * class constant + * * @param string $name * @param array $arguments - * @return static + * * @throws \BadMethodCallException * @throws \ReflectionException + * + * @return static */ public static function __callStatic($name, $arguments) { @@ -144,6 +159,7 @@ abstract class Enum if (isset($array[$name])) { return new static($array[$name]); } + throw new \BadMethodCallException( "No static method or enum constant '$name' in class ".get_called_class() ); diff --git a/app/Interfaces/FormRequest.php b/app/Interfaces/FormRequest.php index 4402e905..d1f75d5c 100644 --- a/app/Interfaces/FormRequest.php +++ b/app/Interfaces/FormRequest.php @@ -4,7 +4,6 @@ namespace App\Interfaces; /** * Class FormRequest - * @package App\Interfaces */ class FormRequest extends \Illuminate\Foundation\Http\FormRequest { diff --git a/app/Interfaces/ImportExport.php b/app/Interfaces/ImportExport.php index 80f2f33d..0b25a15b 100644 --- a/app/Interfaces/ImportExport.php +++ b/app/Interfaces/ImportExport.php @@ -9,14 +9,13 @@ use Validator; /** * Common functionality used across all of the importers - * @package App\Interfaces */ class ImportExport { public $assetType; public $status = [ 'success' => [], - 'errors' => [], + 'errors' => [], ]; /** @@ -26,6 +25,7 @@ class ImportExport /** * @param mixed $row + * * @return array */ public function export($row): array @@ -36,8 +36,10 @@ class ImportExport /** * @param array $row * @param mixed $index - * @return bool + * * @throws \RuntimeException + * + * @return bool */ public function import(array $row, $index): bool { @@ -46,7 +48,9 @@ class ImportExport /** * Get the airline from the ICAO. Create it if it doesn't exist + * * @param $code + * * @return Airline */ public function getAirline($code) @@ -68,7 +72,9 @@ class ImportExport /** * Do a basic check that the number of columns match + * * @param $row + * * @return bool */ public function checkColumns($row): bool @@ -78,8 +84,10 @@ class ImportExport /** * Bubble up an error to the interface that we need to stop + * * @param $error * @param $e + * * @throws ValidationException */ protected function throwError($error, \Exception $e = null): void @@ -91,11 +99,13 @@ class ImportExport $validator = Validator::make([], []); $validator->errors()->add('csv_file', $error); + throw new ValidationException($validator); } /** * Add to the log messages for this importer + * * @param $msg */ public function log($msg): void @@ -106,6 +116,7 @@ class ImportExport /** * Add to the error log for this import + * * @param $msg */ public function errorLog($msg): void @@ -116,15 +127,16 @@ class ImportExport /** * Set a key-value pair to an array + * * @param $kvp_str * @param array $arr */ protected function kvpToArray($kvp_str, array &$arr) { $item = explode('=', $kvp_str); - if (\count($item) === 1) { # just a list? + if (\count($item) === 1) { // just a list? $arr[] = trim($item[0]); - } else { # actually a key-value pair + } else { // actually a key-value pair $k = trim($item[0]); $v = trim($item[1]); $arr[$k] = $v; @@ -140,6 +152,7 @@ class ImportExport * Converted into a multi-dimensional array * * @param $field + * * @return array|string */ public function parseMultiColumnValues($field) @@ -147,9 +160,9 @@ class ImportExport $ret = []; $split_values = explode(';', $field); - # No multiple values in here, just a straight value + // No multiple values in here, just a straight value if (\count($split_values) === 1) { - if(trim($split_values[0]) === '') { + if (trim($split_values[0]) === '') { return []; } @@ -157,15 +170,15 @@ class ImportExport } foreach ($split_values as $value) { - # This isn't in the query string format, so it's - # just a straight key-value pair set + // This isn't in the query string format, so it's + // just a straight key-value pair set if (strpos($value, '?') === false) { $this->kvpToArray($value, $ret); continue; } - # This contains the query string, which turns it - # into the multi-level array + // This contains the query string, which turns it + // into the multi-level array $query_str = explode('?', $value); $parent = trim($query_str[0]); @@ -173,7 +186,7 @@ class ImportExport $children = []; $kvp = explode('&', trim($query_str[1])); foreach ($kvp as $items) { - if(!$items) { + if (!$items) { continue; } @@ -188,30 +201,31 @@ class ImportExport /** * @param $obj + * * @return mixed */ public function objectToMultiString($obj) { - if(!\is_array($obj)) { + if (!\is_array($obj)) { return $obj; } $ret_list = []; foreach ($obj as $key => $val) { - if(is_numeric($key) && !\is_array($val)) { + if (is_numeric($key) && !\is_array($val)) { $ret_list[] = $val; continue; } $key = trim($key); - if(!\is_array($val)) { + if (!\is_array($val)) { $val = trim($val); $ret_list[] = "{$key}={$val}"; } else { $q = []; - foreach($val as $subkey => $subval) { - if(is_numeric($subkey)) { + foreach ($val as $subkey => $subval) { + if (is_numeric($subkey)) { $q[] = $subval; } else { $q[] = "{$subkey}={$subval}"; @@ -219,7 +233,7 @@ class ImportExport } $q = implode('&', $q); - if(!empty($q)) { + if (!empty($q)) { $ret_list[] = "{$key}?{$q}"; } else { $ret_list[] = $key; diff --git a/app/Interfaces/Listener.php b/app/Interfaces/Listener.php index 555640aa..e732aac6 100644 --- a/app/Interfaces/Listener.php +++ b/app/Interfaces/Listener.php @@ -4,9 +4,7 @@ namespace App\Interfaces; /** * Class Listener - * @package App\Interfaces */ abstract class Listener { - } diff --git a/app/Interfaces/Metar.php b/app/Interfaces/Metar.php index dc2ec109..1a8fbe6e 100644 --- a/app/Interfaces/Metar.php +++ b/app/Interfaces/Metar.php @@ -7,7 +7,6 @@ use Log; /** * Base class for implementing retrieving METARs - * @package App\Interfaces */ abstract class Metar { @@ -15,20 +14,25 @@ abstract class Metar * Implement retrieving the METAR- Return the string * Needs to be protected, since this shouldn't be * directly called. Call `get_metar($icao)` instead + * * @param $icao + * * @return mixed */ abstract protected function metar($icao): string; /** * @param $icao + * * @return string */ //abstract protected function taf($icao): string; /** * Download the METAR, wrap in caching + * * @param $icao + * * @return string */ public function get_metar($icao): string @@ -43,7 +47,7 @@ abstract class Metar Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace()); return ''; } catch (\Exception $e) { - Log::error('Error getting METAR: '. $e->getMessage(), $e->getTrace()); + Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace()); return ''; } }); diff --git a/app/Interfaces/Migration.php b/app/Interfaces/Migration.php index 1e2336f8..d61298d5 100644 --- a/app/Interfaces/Migration.php +++ b/app/Interfaces/Migration.php @@ -7,7 +7,6 @@ use DB; /** * Class Migration - * @package App\Interfaces */ abstract class Migration extends \Illuminate\Database\Migrations\Migration { @@ -16,6 +15,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration /** * At a minimum, this function needs to be implemented + * * @return mixed */ abstract public function up(); @@ -25,13 +25,13 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration */ public function down() { - } /** * Dynamically figure out the offset and the start number for a group. * This way we don't need to mess with how to order things * When calling getNextOrderNumber(users) 31, will be returned, then 32, and so on + * * @param $name * @param null $offset * @param int $start_offset @@ -53,12 +53,12 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration $start_offset = $offset + 1; } } else { - # Now find the number to start from + // Now find the number to start from $start_offset = (int) DB::table('settings')->where('group', $name)->max('order'); if ($start_offset === null) { $start_offset = $offset + 1; } else { - ++$start_offset; + $start_offset++; } $offset = $group->offset; @@ -71,7 +71,9 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration /** * Get the next increment number from a group + * * @param $group + * * @return int */ public function getNextOrderNumber($group): int @@ -81,7 +83,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration } $idx = $this->counters[$group]; - ++$this->counters[$group]; + $this->counters[$group]++; return $idx; } @@ -114,6 +116,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration /** * Update a setting + * * @param $key * @param $value * @param array $attrs @@ -128,6 +131,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration /** * Add rows to a table + * * @param $table * @param $rows */ @@ -137,7 +141,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration try { DB::table($table)->insert($row); } catch (\Exception $e) { - # setting already exists, just ignore it + // setting already exists, just ignore it if ($e->getCode() === 23000) { continue; } diff --git a/app/Interfaces/Model.php b/app/Interfaces/Model.php index b01b929d..feb48918 100644 --- a/app/Interfaces/Model.php +++ b/app/Interfaces/Model.php @@ -4,9 +4,9 @@ namespace App\Interfaces; /** * Class Model + * * @property mixed $id * @property bool $skip_mutator - * @package App\Interfaces */ abstract class Model extends \Illuminate\Database\Eloquent\Model { @@ -14,6 +14,7 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model /** * For the factories, skip the mutators. Only apply to one instance + * * @var bool */ public $skip_mutator = false; diff --git a/app/Interfaces/Repository.php b/app/Interfaces/Repository.php index c1d265e4..89e5cabf 100644 --- a/app/Interfaces/Repository.php +++ b/app/Interfaces/Repository.php @@ -6,13 +6,13 @@ use Illuminate\Validation\Validator; /** * Class Repository - * @package App\Interfaces */ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository { /** * @param $id * @param array $columns + * * @return mixed|null */ public function findWithoutFail($id, $columns = ['*']) @@ -20,12 +20,13 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository try { return $this->find($id, $columns); } catch (\Exception $e) { - return null; + return; } } /** * @param $values + * * @return bool */ public function validate($values) @@ -44,8 +45,10 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository /** * Return N most recent items, sorted by created_at + * * @param int $count * @param string $sort_by created_at (default) or updated_at + * * @return mixed */ public function recent($count = null, $sort_by = 'created_at') @@ -55,16 +58,18 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository /** * Find records with a WHERE clause but also sort them + * * @param $where * @param $sort_by * @param $order_by + * * @return $this */ public function whereOrder($where, $sort_by, $order_by = 'asc') { return $this->scopeQuery(function ($query) use ($where, $sort_by, $order_by) { $q = $query->where($where); - # See if there are multi-column sorts + // See if there are multi-column sorts if (\is_array($sort_by)) { foreach ($sort_by as $key => $sort) { $q = $q->orderBy($key, $sort); @@ -79,17 +84,19 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository /** * Find records where values don't match a list but sort the rest + * * @param string $col * @param array $values * @param string $sort_by * @param string $order_by + * * @return $this */ public function whereNotInOrder($col, $values, $sort_by, $order_by = 'asc') { return $this->scopeQuery(function ($query) use ($col, $values, $sort_by, $order_by) { $q = $query->whereNotIn($col, $values); - # See if there are multi-column sorts + // See if there are multi-column sorts if (\is_array($sort_by)) { foreach ($sort_by as $key => $sort) { $q = $q->orderBy($key, $sort); diff --git a/app/Interfaces/Service.php b/app/Interfaces/Service.php index 2d3a6e76..1e404e76 100644 --- a/app/Interfaces/Service.php +++ b/app/Interfaces/Service.php @@ -4,9 +4,7 @@ namespace App\Interfaces; /** * Class Service - * @package App\Interfaces */ abstract class Service { - } diff --git a/app/Interfaces/Unit.php b/app/Interfaces/Unit.php index 3334643b..3c3da7bf 100644 --- a/app/Interfaces/Unit.php +++ b/app/Interfaces/Unit.php @@ -6,7 +6,7 @@ use ArrayAccess; /** * Class Unit - * @package App\Interfaces + * * @property mixed $instance * @property string $unit * @property array $units @@ -20,12 +20,14 @@ class Unit implements ArrayAccess /** * All of the units of this class + * * @var array */ public $units; /** * Holds an instance of the PhpUnit type + * * @var */ protected $instance; @@ -40,7 +42,9 @@ class Unit implements ArrayAccess /** * Implements ArrayAccess + * * @param $offset + * * @return bool */ public function offsetExists($offset) @@ -50,7 +54,9 @@ class Unit implements ArrayAccess /** * Implements ArrayAccess + * * @param $offset + * * @return mixed */ public function offsetGet($offset) @@ -60,6 +66,7 @@ class Unit implements ArrayAccess /** * Implements ArrayAccess + * * @param $offset * @param $value */ @@ -70,6 +77,7 @@ class Unit implements ArrayAccess /** * Implements ArrayAccess + * * @param $offset */ public function offsetUnset($offset) diff --git a/app/Interfaces/Widget.php b/app/Interfaces/Widget.php index 4d9fe830..58b42570 100644 --- a/app/Interfaces/Widget.php +++ b/app/Interfaces/Widget.php @@ -6,7 +6,6 @@ use Arrilot\Widgets\AbstractWidget; /** * Class Widget - * @package App\Widgets */ abstract class Widget extends AbstractWidget { @@ -14,8 +13,10 @@ abstract class Widget extends AbstractWidget /** * Render the template + * * @param string $template * @param array $vars + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function view(string $template, array $vars = []) diff --git a/app/Listeners/AwardListener.php b/app/Listeners/AwardListener.php index 3052310d..3efc4ae4 100644 --- a/app/Listeners/AwardListener.php +++ b/app/Listeners/AwardListener.php @@ -9,13 +9,14 @@ use App\Models\Award; /** * Look for and run any of the award classes. Don't modify this. * See the documentation on creating awards: + * * @url http://docs.phpvms.net/customizing/awards - * @package App\Listeners */ class AwardListener extends Listener { /** * Call all of the awards + * * @param UserStatsChanged $event */ public function handle(UserStatsChanged $event): void diff --git a/app/Listeners/ExpenseListener.php b/app/Listeners/ExpenseListener.php index 72432a0f..544f83d5 100644 --- a/app/Listeners/ExpenseListener.php +++ b/app/Listeners/ExpenseListener.php @@ -7,22 +7,23 @@ use App\Interfaces\Listener; /** * Class ExpenseListener - * @package App\Listeners */ class ExpenseListener extends Listener { /** * Return a list of additional expenses + * * @param Expenses $event + * * @return mixed */ public function handle(Expenses $event) { $expenses = []; - # This is an example of an expense to return - # You have the pirep on $event->pirep, and any associated data - # The transaction group is how it will show as a line item + // This is an example of an expense to return + // You have the pirep on $event->pirep, and any associated data + // The transaction group is how it will show as a line item /*$expenses[] = new Expense([ 'type' => ExpenseType::FLIGHT, 'amount' => 15000, # $150 diff --git a/app/Listeners/FinanceEvents.php b/app/Listeners/FinanceEvents.php index c357205e..49d24015 100644 --- a/app/Listeners/FinanceEvents.php +++ b/app/Listeners/FinanceEvents.php @@ -11,7 +11,6 @@ use Illuminate\Contracts\Events\Dispatcher; /** * Subscribe for events that we do some financial processing for * This includes when a PIREP is accepted, or rejected - * @package App\Listeners */ class FinanceEvents extends Listener { @@ -19,6 +18,7 @@ class FinanceEvents extends Listener /** * FinanceEvents constructor. + * * @param PirepFinanceService $financeSvc */ public function __construct( @@ -45,7 +45,9 @@ class FinanceEvents extends Listener /** * Kick off the finance events when a PIREP is accepted + * * @param PirepAccepted $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Exception @@ -58,7 +60,9 @@ class FinanceEvents extends Listener /** * Delete all finances in the journal for a given PIREP + * * @param PirepRejected $event + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Exception diff --git a/app/Listeners/NotificationEvents.php b/app/Listeners/NotificationEvents.php index 96f910b7..5d2282cc 100644 --- a/app/Listeners/NotificationEvents.php +++ b/app/Listeners/NotificationEvents.php @@ -12,7 +12,6 @@ use Log; /** * Handle sending emails on different events - * @package App\Listeners */ class NotificationEvents extends Listener { @@ -48,6 +47,7 @@ class NotificationEvents extends Listener /** * @param $to * @param $email + * * @return mixed */ protected function sendEmail($to, $email) @@ -62,6 +62,7 @@ class NotificationEvents extends Listener /** * Send an email when the user registered + * * @param UserRegistered $event */ public function onUserRegister(UserRegistered $event): void @@ -75,7 +76,7 @@ class NotificationEvents extends Listener return; } - # First send the admin a notification + // First send the admin a notification $admin_email = setting('general.admin_email'); Log::info('Sending admin notification email to "'.$admin_email.'"'); @@ -84,10 +85,10 @@ class NotificationEvents extends Listener $this->sendEmail($admin_email, $email); } - # Then notify the user + // Then notify the user if ($event->user->state === UserState::ACTIVE) { $email = new \App\Mail\UserRegistered($event->user); - } else if ($event->user->state === UserState::PENDING) { + } elseif ($event->user->state === UserState::PENDING) { $email = new \App\Mail\UserPending($event->user); } @@ -96,6 +97,7 @@ class NotificationEvents extends Listener /** * When a user's state changes, send an email out + * * @param UserStateChanged $event */ public function onUserStateChange(UserStateChanged $event): void @@ -108,11 +110,11 @@ class NotificationEvents extends Listener if ($event->user->state === UserState::ACTIVE) { $email = new \App\Mail\UserRegistered($event->user, 'Your registration has been accepted!'); - } else if ($event->user->state === UserState::REJECTED) { + } elseif ($event->user->state === UserState::REJECTED) { $email = new \App\Mail\UserRejected($event->user); } $this->sendEmail($event->user->email, $email); - } # TODO: Other state transitions + } // TODO: Other state transitions elseif ($event->old_state === UserState::ACTIVE) { Log::info('User state change from active to ??'); } diff --git a/app/Mail/Admin/UserRegistered.php b/app/Mail/Admin/UserRegistered.php index 1a81d8e3..8a5b0cc6 100644 --- a/app/Mail/Admin/UserRegistered.php +++ b/app/Mail/Admin/UserRegistered.php @@ -10,7 +10,8 @@ use Illuminate\Queue\SerializesModels; class UserRegistered extends Mailable { use Queueable, SerializesModels; - public $subject, $user; + public $subject; + public $user; public function __construct(User $user, $subject = null) { diff --git a/app/Mail/NewLoginDetails.php b/app/Mail/NewLoginDetails.php index f0821467..42f4fedb 100644 --- a/app/Mail/NewLoginDetails.php +++ b/app/Mail/NewLoginDetails.php @@ -10,7 +10,9 @@ use Illuminate\Queue\SerializesModels; class NewLoginDetails extends Mailable { use Queueable, SerializesModels; - public $subject, $user, $newpw; + public $subject; + public $user; + public $newpw; public function __construct(User $user, $newpw = null, $subject = null) { diff --git a/app/Mail/UserPending.php b/app/Mail/UserPending.php index 541409be..c0cf765a 100644 --- a/app/Mail/UserPending.php +++ b/app/Mail/UserPending.php @@ -10,7 +10,8 @@ use Illuminate\Queue\SerializesModels; class UserPending extends Mailable { use Queueable, SerializesModels; - public $subject, $user; + public $subject; + public $user; public function __construct(User $user, $subject = null) { diff --git a/app/Mail/UserRegistered.php b/app/Mail/UserRegistered.php index 995e00da..013042ab 100644 --- a/app/Mail/UserRegistered.php +++ b/app/Mail/UserRegistered.php @@ -10,7 +10,8 @@ use Illuminate\Queue\SerializesModels; class UserRegistered extends Mailable { use Queueable, SerializesModels; - public $subject, $user; + public $subject; + public $user; public function __construct(User $user, $subject = null) { diff --git a/app/Mail/UserRejected.php b/app/Mail/UserRejected.php index 6c8a2021..40dc991a 100644 --- a/app/Mail/UserRejected.php +++ b/app/Mail/UserRejected.php @@ -10,7 +10,8 @@ use Illuminate\Queue\SerializesModels; class UserRejected extends Mailable { use Queueable, SerializesModels; - public $subject, $user; + public $subject; + public $user; public function __construct(User $user, $subject = null) { diff --git a/app/Models/Acars.php b/app/Models/Acars.php index 2e53883c..dffba7b7 100644 --- a/app/Models/Acars.php +++ b/app/Models/Acars.php @@ -11,18 +11,19 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; /** * Class Acars + * * @param string id + * * @property string pirep_id * @property int type * @property string name - * @property double lat - * @property double lon - * @property double altitude + * @property float lat + * @property float lon + * @property float altitude * @property int gs * @property int heading * @property int order * @property int nav_type - * @package App\Models */ class Acars extends Model { @@ -78,15 +79,15 @@ class Acars extends Model 'pirep_id' => 'required', ]; - /** * Return a new Length unit so conversions can be made + * * @return int|Distance */ public function getDistanceAttribute() { if (!array_key_exists('distance', $this->attributes)) { - return null; + return; } try { @@ -105,6 +106,7 @@ class Acars extends Model /** * Set the distance unit, convert to our internal default unit + * * @param $value */ public function setDistanceAttribute($value): void @@ -119,12 +121,13 @@ class Acars extends Model /** * Return a new Fuel unit so conversions can be made + * * @return int|Fuel */ public function getFuelAttribute() { if (!array_key_exists('fuel', $this->attributes)) { - return null; + return; } try { @@ -139,6 +142,7 @@ class Acars extends Model /** * Set the amount of fuel + * * @param $value */ public function setFuelAttribute($value) @@ -155,7 +159,6 @@ class Acars extends Model /** * FKs */ - public function pirep() { return $this->belongsTo(Pirep::class, 'pirep_id'); diff --git a/app/Models/Aircraft.php b/app/Models/Aircraft.php index d00103b8..24071969 100644 --- a/app/Models/Aircraft.php +++ b/app/Models/Aircraft.php @@ -18,7 +18,6 @@ use App\Models\Traits\FilesTrait; * @property Subfleet subfleet * @property int status * @property int state - * @package App\Models */ class Aircraft extends Model { @@ -60,6 +59,7 @@ class Aircraft extends Model /** * See if this aircraft is active + * * @return bool */ public function getActiveAttribute(): bool @@ -69,6 +69,7 @@ class Aircraft extends Model /** * Capitalize the ICAO when set + * * @param $icao */ public function setIcaoAttribute($icao): void @@ -79,7 +80,6 @@ class Aircraft extends Model /** * foreign keys */ - public function airport() { return $this->belongsTo(Airport::class, 'airport_id'); diff --git a/app/Models/Airline.php b/app/Models/Airline.php index 8f0c81c1..47cc0e9e 100644 --- a/app/Models/Airline.php +++ b/app/Models/Airline.php @@ -9,6 +9,7 @@ use App\Models\Traits\JournalTrait; /** * Class Airline + * * @property mixed id * @property string code * @property string icao @@ -17,7 +18,6 @@ use App\Models\Traits\JournalTrait; * @property string logo * @property string country * @property Journal journal - * @package App\Models */ class Airline extends Model { @@ -44,6 +44,7 @@ class Airline extends Model /** * The attributes that should be casted to native types. + * * @var array */ protected $casts = [ @@ -54,6 +55,7 @@ class Airline extends Model /** * Validation rules + * * @var array */ public static $rules = [ @@ -69,14 +71,15 @@ class Airline extends Model */ public function getCodeAttribute() { - if ($this->iata && $this->iata !== '') - return $this->iata; - else - return $this->icao; + if ($this->iata && $this->iata !== '') { + return $this->iata; + } + return $this->icao; } /** * Capitalize the IATA code when set + * * @param $iata */ public function setIataAttribute($iata) @@ -86,6 +89,7 @@ class Airline extends Model /** * Capitalize the ICAO when set + * * @param $icao */ public function setIcaoAttribute($icao): void diff --git a/app/Models/Airport.php b/app/Models/Airport.php index f8b01284..7054a7c7 100644 --- a/app/Models/Airport.php +++ b/app/Models/Airport.php @@ -8,6 +8,7 @@ use App\Models\Traits\FilesTrait; /** * Class Airport + * * @property string id * @property string iata * @property string icao @@ -18,7 +19,6 @@ use App\Models\Traits\FilesTrait; * @property float ground_handling_cost * @property float lat * @property float lon - * @package App\Models */ class Airport extends Model { @@ -91,6 +91,7 @@ class Airport extends Model /** * Return full name like: * KJFK - John F Kennedy + * * @return string */ public function getFullNameAttribute(): string @@ -100,6 +101,7 @@ class Airport extends Model /** * Shorthand for getting the timezone + * * @return string */ public function getTzAttribute(): string @@ -109,6 +111,7 @@ class Airport extends Model /** * Shorthand for setting the timezone + * * @param $value */ public function setTzAttribute($value): void diff --git a/app/Models/Award.php b/app/Models/Award.php index 49600724..4a3dce33 100755 --- a/app/Models/Award.php +++ b/app/Models/Award.php @@ -6,10 +6,10 @@ use App\Interfaces\Model; /** * The Award model + * * @property mixed id * @property mixed ref_model * @property mixed|null ref_model_params - * @package Award\Models */ class Award extends Model { @@ -28,25 +28,27 @@ class Award extends Model 'description' => 'nullable', 'image_url' => 'nullable', 'ref_model' => 'required', - 'ref_model_params' => 'nullable' + 'ref_model_params' => 'nullable', ]; /** * Get the referring object + * * @param Award|null $award * @param User|null $user + * * @return null */ - public function getReference(Award $award = null, User $user = null) + public function getReference(self $award = null, User $user = null) { if (!$this->ref_model) { - return null; + return; } try { return new $this->ref_model($award, $user); } catch (\Exception $e) { - return null; + return; } } } diff --git a/app/Models/Bid.php b/app/Models/Bid.php index 543f7568..3d559d00 100644 --- a/app/Models/Bid.php +++ b/app/Models/Bid.php @@ -4,9 +4,6 @@ namespace App\Models; use App\Interfaces\Model; -/** - * @package App\Models - */ class Bid extends Model { public $table = 'bids'; diff --git a/app/Models/Enums/AcarsType.php b/app/Models/Enums/AcarsType.php index d62375f1..a6e1a4f0 100644 --- a/app/Models/Enums/AcarsType.php +++ b/app/Models/Enums/AcarsType.php @@ -6,11 +6,10 @@ use App\Interfaces\Enum; /** * Class AcarsType - * @package App\Models\Enums */ class AcarsType extends Enum { public const FLIGHT_PATH = 0; - public const ROUTE = 1; - public const LOG = 2; + public const ROUTE = 1; + public const LOG = 2; } diff --git a/app/Models/Enums/ActiveState.php b/app/Models/Enums/ActiveState.php index ac09b249..5af5daf8 100644 --- a/app/Models/Enums/ActiveState.php +++ b/app/Models/Enums/ActiveState.php @@ -6,15 +6,14 @@ use App\Interfaces\Enum; /** * Class ActiveState - * @package App\Models\Enums */ class ActiveState extends Enum { public const INACTIVE = 0; - public const ACTIVE = 1; + public const ACTIVE = 1; public static $labels = [ - ActiveState::ACTIVE => 'common.active', - ActiveState::INACTIVE => 'common.inactive', + self::ACTIVE => 'common.active', + self::INACTIVE => 'common.inactive', ]; } diff --git a/app/Models/Enums/AircraftState.php b/app/Models/Enums/AircraftState.php index 82ec2cc2..f81cfe81 100644 --- a/app/Models/Enums/AircraftState.php +++ b/app/Models/Enums/AircraftState.php @@ -6,7 +6,6 @@ use App\Interfaces\Enum; /** * Class AircraftState - * @package App\Models\Enums */ class AircraftState extends Enum { @@ -15,8 +14,8 @@ class AircraftState extends Enum public const IN_AIR = 2; public static $labels = [ - AircraftState::PARKED => 'On Ground', - AircraftState::IN_USE => 'In Use', - AircraftState::IN_AIR => 'In Air', + self::PARKED => 'On Ground', + self::IN_USE => 'In Use', + self::IN_AIR => 'In Air', ]; } diff --git a/app/Models/Enums/AircraftStatus.php b/app/Models/Enums/AircraftStatus.php index 82f05afe..18de63e2 100644 --- a/app/Models/Enums/AircraftStatus.php +++ b/app/Models/Enums/AircraftStatus.php @@ -6,21 +6,20 @@ use App\Interfaces\Enum; /** * Class AircraftState - * @package App\Models\Enums */ class AircraftStatus extends Enum { - public const ACTIVE = 'A'; - public const STORED = 'S'; - public const RETIRED = 'R'; - public const SCRAPPED = 'C'; + public const ACTIVE = 'A'; + public const STORED = 'S'; + public const RETIRED = 'R'; + public const SCRAPPED = 'C'; public const WRITTEN_OFF = 'W'; public static $labels = [ - AircraftStatus::ACTIVE => 'aircraft.status.active', - AircraftStatus::STORED => 'aircraft.status.stored', - AircraftStatus::RETIRED => 'aircraft.status.retired', - AircraftStatus::SCRAPPED => 'aircraft.status.scrapped', - AircraftStatus::WRITTEN_OFF => 'aircraft.status.written', + self::ACTIVE => 'aircraft.status.active', + self::STORED => 'aircraft.status.stored', + self::RETIRED => 'aircraft.status.retired', + self::SCRAPPED => 'aircraft.status.scrapped', + self::WRITTEN_OFF => 'aircraft.status.written', ]; } diff --git a/app/Models/Enums/AnalyticsDimensions.php b/app/Models/Enums/AnalyticsDimensions.php index fa262943..d654d59a 100644 --- a/app/Models/Enums/AnalyticsDimensions.php +++ b/app/Models/Enums/AnalyticsDimensions.php @@ -6,11 +6,10 @@ use App\Interfaces\Enum; /** * Class AnalyticsDimensions - * @package App\Models\Enums */ class AnalyticsDimensions extends Enum { - public const PHP_VERSION = 1; + public const PHP_VERSION = 1; public const DATABASE_VERSION = 2; - public const PHPVMS_VERSION = 3; + public const PHPVMS_VERSION = 3; } diff --git a/app/Models/Enums/AnalyticsMetrics.php b/app/Models/Enums/AnalyticsMetrics.php index 7a8fc864..d5963e2a 100644 --- a/app/Models/Enums/AnalyticsMetrics.php +++ b/app/Models/Enums/AnalyticsMetrics.php @@ -7,10 +7,9 @@ use App\Interfaces\Enum; /** * Class AnalyticsMetrics * Metrics IDs used in Google Analytics - * @package App\Models\Enums */ class AnalyticsMetrics extends Enum { - # Track the lookup time for airports from vaCentral + // Track the lookup time for airports from vaCentral public const AIRPORT_LOOKUP_TIME = 1; } diff --git a/app/Models/Enums/Days.php b/app/Models/Enums/Days.php index feddc424..5733aaec 100644 --- a/app/Models/Enums/Days.php +++ b/app/Models/Enums/Days.php @@ -7,60 +7,61 @@ use App\Interfaces\Enum; /** * Class Days * Start on Monday - ISO8601 - * @package App\Models\Enums */ class Days extends Enum { - public const MONDAY = 1 << 0; - public const TUESDAY = 1 << 1; + public const MONDAY = 1 << 0; + public const TUESDAY = 1 << 1; public const WEDNESDAY = 1 << 2; - public const THURSDAY = 1 << 3; - public const FRIDAY = 1 << 4; - public const SATURDAY = 1 << 5; - public const SUNDAY = 1 << 6; + public const THURSDAY = 1 << 3; + public const FRIDAY = 1 << 4; + public const SATURDAY = 1 << 5; + public const SUNDAY = 1 << 6; public static $labels = [ - Days::MONDAY => 'common.days.mon', - Days::TUESDAY => 'common.days.tues', - Days::WEDNESDAY => 'common.days.wed', - Days::THURSDAY => 'common.days.thurs', - Days::FRIDAY => 'common.days.fri', - Days::SATURDAY => 'common.days.sat', - Days::SUNDAY => 'common.days.sun', + self::MONDAY => 'common.days.mon', + self::TUESDAY => 'common.days.tues', + self::WEDNESDAY => 'common.days.wed', + self::THURSDAY => 'common.days.thurs', + self::FRIDAY => 'common.days.fri', + self::SATURDAY => 'common.days.sat', + self::SUNDAY => 'common.days.sun', ]; public static $codes = [ - 'M' => Days::MONDAY, - 'T' => Days::TUESDAY, - 'W' => Days::WEDNESDAY, - 'Th' => Days::THURSDAY, - 'F' => Days::FRIDAY, - 'S' => Days::SATURDAY, - 'Su' => Days::SUNDAY, + 'M' => self::MONDAY, + 'T' => self::TUESDAY, + 'W' => self::WEDNESDAY, + 'Th' => self::THURSDAY, + 'F' => self::FRIDAY, + 'S' => self::SATURDAY, + 'Su' => self::SUNDAY, ]; /** * Map the ISO8601 numeric today to day */ public static $isoDayMap = [ - 1 => Days::MONDAY, - 2 => Days::TUESDAY, - 3 => Days::WEDNESDAY, - 4 => Days::THURSDAY, - 5 => Days::FRIDAY, - 6 => Days::SATURDAY, - 7 => Days::SUNDAY, + 1 => self::MONDAY, + 2 => self::TUESDAY, + 3 => self::WEDNESDAY, + 4 => self::THURSDAY, + 5 => self::FRIDAY, + 6 => self::SATURDAY, + 7 => self::SUNDAY, ]; /** * Create the masked value for the days of week + * * @param array $days + * * @return int|mixed */ public static function getDaysMask(array $days) { $mask = 0; - foreach($days as $day) { + foreach ($days as $day) { $mask |= $day; } @@ -69,8 +70,10 @@ class Days extends Enum /** * See if the given mask has a day + * * @param $mask * @param $day + * * @return bool */ public static function in($mask, $day): bool @@ -80,7 +83,9 @@ class Days extends Enum /** * Does the mask contain today? + * * @param $val + * * @return bool */ public static function isToday($val): bool diff --git a/app/Models/Enums/ExpenseType.php b/app/Models/Enums/ExpenseType.php index 6d119d49..396ffcaa 100644 --- a/app/Models/Enums/ExpenseType.php +++ b/app/Models/Enums/ExpenseType.php @@ -6,23 +6,22 @@ use App\Interfaces\Enum; /** * Class ExpenseType - * @package App\Models\Enums */ class ExpenseType extends Enum { - public const FLIGHT = 'F'; - public const DAILY = 'D'; + public const FLIGHT = 'F'; + public const DAILY = 'D'; public const MONTHLY = 'M'; protected static $labels = [ - ExpenseType::FLIGHT => 'expenses.type.flight', - ExpenseType::DAILY => 'expenses.type.daily', - ExpenseType::MONTHLY => 'expenses.type.monthly', + self::FLIGHT => 'expenses.type.flight', + self::DAILY => 'expenses.type.daily', + self::MONTHLY => 'expenses.type.monthly', ]; protected static $codes = [ - ExpenseType::FLIGHT => 'F', - ExpenseType::DAILY =>'D', - ExpenseType::MONTHLY => 'M', + self::FLIGHT => 'F', + self::DAILY => 'D', + self::MONTHLY => 'M', ]; } diff --git a/app/Models/Enums/FlightType.php b/app/Models/Enums/FlightType.php index fe24815f..47681232 100644 --- a/app/Models/Enums/FlightType.php +++ b/app/Models/Enums/FlightType.php @@ -6,41 +6,40 @@ use App\Interfaces\Enum; /** * Class FlightType - * @package App\Models\Enums */ class FlightType extends Enum { - public const SCHED_PAX = 'J'; - public const SCHED_CARGO = 'F'; - public const CHARTER_PAX_ONLY = 'C'; - public const ADDITIONAL_CARGO = 'A'; - public const VIP = 'E'; - public const ADDTL_PAX = 'G'; + public const SCHED_PAX = 'J'; + public const SCHED_CARGO = 'F'; + public const CHARTER_PAX_ONLY = 'C'; + public const ADDITIONAL_CARGO = 'A'; + public const VIP = 'E'; + public const ADDTL_PAX = 'G'; public const CHARTER_CARGO_MAIL = 'H'; - public const AMBULANCE = 'I'; - public const TRAINING = 'K'; - public const MAIL_SERVICE = 'M'; - public const CHARTER_SPECIAL = 'O'; - public const POSITIONING = 'P'; - public const TECHNICAL_TEST = 'T'; - public const MILITARY = 'W'; - public const TECHNICAL_STOP = 'X'; + public const AMBULANCE = 'I'; + public const TRAINING = 'K'; + public const MAIL_SERVICE = 'M'; + public const CHARTER_SPECIAL = 'O'; + public const POSITIONING = 'P'; + public const TECHNICAL_TEST = 'T'; + public const MILITARY = 'W'; + public const TECHNICAL_STOP = 'X'; protected static $labels = [ - FlightType::SCHED_PAX => 'flights.type.pass_scheduled', - FlightType::SCHED_CARGO => 'flights.type.cargo_scheduled', - FlightType::CHARTER_PAX_ONLY => 'flights.type.charter_pass_only', - FlightType::ADDITIONAL_CARGO => 'flights.type.addtl_cargo_mail', - FlightType::VIP => 'flights.type.special_vip', - FlightType::ADDTL_PAX => 'flights.type.pass_addtl', - FlightType::CHARTER_CARGO_MAIL => 'flights.type.charter_cargo', - FlightType::AMBULANCE => 'flights.type.ambulance', - FlightType::TRAINING => 'flights.type.training_flight', - FlightType::MAIL_SERVICE => 'flights.type.mail_service', - FlightType::CHARTER_SPECIAL => 'flights.type.charter_special', - FlightType::POSITIONING => 'flights.type.positioning', - FlightType::TECHNICAL_TEST => 'flights.type.technical_test', - FlightType::MILITARY => 'flights.type.military', - FlightType::TECHNICAL_STOP => 'flights.type.technical_stop', + self::SCHED_PAX => 'flights.type.pass_scheduled', + self::SCHED_CARGO => 'flights.type.cargo_scheduled', + self::CHARTER_PAX_ONLY => 'flights.type.charter_pass_only', + self::ADDITIONAL_CARGO => 'flights.type.addtl_cargo_mail', + self::VIP => 'flights.type.special_vip', + self::ADDTL_PAX => 'flights.type.pass_addtl', + self::CHARTER_CARGO_MAIL => 'flights.type.charter_cargo', + self::AMBULANCE => 'flights.type.ambulance', + self::TRAINING => 'flights.type.training_flight', + self::MAIL_SERVICE => 'flights.type.mail_service', + self::CHARTER_SPECIAL => 'flights.type.charter_special', + self::POSITIONING => 'flights.type.positioning', + self::TECHNICAL_TEST => 'flights.type.technical_test', + self::MILITARY => 'flights.type.military', + self::TECHNICAL_STOP => 'flights.type.technical_stop', ]; } diff --git a/app/Models/Enums/FuelType.php b/app/Models/Enums/FuelType.php index 5a8ac332..bbaf6bba 100644 --- a/app/Models/Enums/FuelType.php +++ b/app/Models/Enums/FuelType.php @@ -6,17 +6,16 @@ use App\Interfaces\Enum; /** * Class FuelType - * @package App\Models\Enums */ class FuelType extends Enum { public const LOW_LEAD = 0; - public const JET_A = 1; - public const MOGAS = 2; + public const JET_A = 1; + public const MOGAS = 2; public static $labels = [ - FuelType::LOW_LEAD => '100LL', - FuelType::JET_A => 'JET A', - FuelType::MOGAS => 'MOGAS', + self::LOW_LEAD => '100LL', + self::JET_A => 'JET A', + self::MOGAS => 'MOGAS', ]; } diff --git a/app/Models/Enums/JournalType.php b/app/Models/Enums/JournalType.php index 71f943eb..61d2151f 100644 --- a/app/Models/Enums/JournalType.php +++ b/app/Models/Enums/JournalType.php @@ -6,10 +6,9 @@ use App\Interfaces\Enum; /** * Class JournalType - * @package App\Models\Enums */ class JournalType extends Enum { public const AIRLINE = 0; - public const USER = 1; + public const USER = 1; } diff --git a/app/Models/Enums/NavaidType.php b/app/Models/Enums/NavaidType.php index b17a3bdd..4cda1c52 100644 --- a/app/Models/Enums/NavaidType.php +++ b/app/Models/Enums/NavaidType.php @@ -8,49 +8,49 @@ use App\Interfaces\Enum; * Class NavaidType * Types based on/compatible with OpenFMC * https://github.com/skiselkov/openfmc/blob/master/airac.h - * @package App\Models\Enums */ class NavaidType extends Enum { - public const VOR = 1 << 0; - public const VOR_DME = 1 << 1; - public const LOC = 1 << 4; - public const LOC_DME = 1 << 5; - public const NDB = 1 << 6; - public const TACAN = 1 << 7; - public const UNKNOWN = 1 << 8; + public const VOR = 1 << 0; + public const VOR_DME = 1 << 1; + public const LOC = 1 << 4; + public const LOC_DME = 1 << 5; + public const NDB = 1 << 6; + public const TACAN = 1 << 7; + public const UNKNOWN = 1 << 8; public const INNER_MARKER = 1 << 9; public const OUTER_MARKER = 1 << 10; - public const FIX = 1 << 11; - public const ANY_VOR = NavaidType::VOR | NavaidType::VOR_DME; - public const ANY_LOC = NavaidType::LOC | NavaidType::LOC_DME; - public const ANY = (NavaidType::UNKNOWN << 1) - 1; + public const FIX = 1 << 11; + public const ANY_VOR = self::VOR | self::VOR_DME; + public const ANY_LOC = self::LOC | self::LOC_DME; + public const ANY = (self::UNKNOWN << 1) - 1; /** * Names and titles + * * @var array */ public static $labels = [ - NavaidType::VOR => 'VOR', - NavaidType::VOR_DME => 'VOR DME', - NavaidType::LOC => 'Localizer', - NavaidType::LOC_DME => 'Localizer DME', - NavaidType::NDB => 'Non-directional Beacon', - NavaidType::TACAN => 'TACAN', - NavaidType::UNKNOWN => 'Unknown', - NavaidType::ANY_VOR => 'VOR', - NavaidType::ANY_LOC => 'Localizer', + self::VOR => 'VOR', + self::VOR_DME => 'VOR DME', + self::LOC => 'Localizer', + self::LOC_DME => 'Localizer DME', + self::NDB => 'Non-directional Beacon', + self::TACAN => 'TACAN', + self::UNKNOWN => 'Unknown', + self::ANY_VOR => 'VOR', + self::ANY_LOC => 'Localizer', ]; public static $icons = [ - NavaidType::VOR => 'VOR', - NavaidType::VOR_DME => 'VOR DME', - NavaidType::LOC => 'Localizer', - NavaidType::LOC_DME => 'Localizer DME', - NavaidType::NDB => 'Non-directional Beacon', - NavaidType::TACAN => 'TACAN', - NavaidType::UNKNOWN => 'Unknown', - NavaidType::ANY_VOR => 'VOR', - NavaidType::ANY_LOC => 'Localizer', + self::VOR => 'VOR', + self::VOR_DME => 'VOR DME', + self::LOC => 'Localizer', + self::LOC_DME => 'Localizer DME', + self::NDB => 'Non-directional Beacon', + self::TACAN => 'TACAN', + self::UNKNOWN => 'Unknown', + self::ANY_VOR => 'VOR', + self::ANY_LOC => 'Localizer', ]; } diff --git a/app/Models/Enums/PirepFieldSource.php b/app/Models/Enums/PirepFieldSource.php index cc7784f8..aec5809a 100644 --- a/app/Models/Enums/PirepFieldSource.php +++ b/app/Models/Enums/PirepFieldSource.php @@ -6,10 +6,9 @@ use App\Interfaces\Enum; /** * Class AcarsType - * @package App\Models\Enums */ class PirepFieldSource extends Enum { public const MANUAL = 0; - public const ACARS = 1; + public const ACARS = 1; } diff --git a/app/Models/Enums/PirepSource.php b/app/Models/Enums/PirepSource.php index 47c61428..eba5835e 100644 --- a/app/Models/Enums/PirepSource.php +++ b/app/Models/Enums/PirepSource.php @@ -6,15 +6,14 @@ use App\Interfaces\Enum; /** * Class PirepSource - * @package App\Models\Enums */ class PirepSource extends Enum { public const MANUAL = 0; - public const ACARS = 1; + public const ACARS = 1; protected static $labels = [ - PirepSource::MANUAL => 'pireps.source_types.manual', - PirepSource::ACARS => 'pireps.source_types.acars', + self::MANUAL => 'pireps.source_types.manual', + self::ACARS => 'pireps.source_types.acars', ]; } diff --git a/app/Models/Enums/PirepState.php b/app/Models/Enums/PirepState.php index 0c89e940..8938da35 100644 --- a/app/Models/Enums/PirepState.php +++ b/app/Models/Enums/PirepState.php @@ -6,25 +6,24 @@ use App\Interfaces\Enum; /** * Class PirepState - * @package App\Models\Enums */ class PirepState extends Enum { - public const REJECTED = -1; + public const REJECTED = -1; public const IN_PROGRESS = 0; // flight is ongoing - public const PENDING = 1; // waiting admin approval - public const ACCEPTED = 2; - public const CANCELLED = 3; - public const DELETED = 4; - public const DRAFT = 5; + public const PENDING = 1; // waiting admin approval + public const ACCEPTED = 2; + public const CANCELLED = 3; + public const DELETED = 4; + public const DRAFT = 5; protected static $labels = [ - PirepState::REJECTED => 'pireps.state.rejected', - PirepState::IN_PROGRESS => 'pireps.state.in_progress', - PirepState::PENDING => 'pireps.state.pending', - PirepState::ACCEPTED => 'pireps.state.accepted', - PirepState::CANCELLED => 'pireps.state.cancelled', - PirepState::DELETED => 'pireps.state.deleted', - PirepState::DRAFT => 'pireps.state.draft', + self::REJECTED => 'pireps.state.rejected', + self::IN_PROGRESS => 'pireps.state.in_progress', + self::PENDING => 'pireps.state.pending', + self::ACCEPTED => 'pireps.state.accepted', + self::CANCELLED => 'pireps.state.cancelled', + self::DELETED => 'pireps.state.deleted', + self::DRAFT => 'pireps.state.draft', ]; } diff --git a/app/Models/Enums/PirepStatus.php b/app/Models/Enums/PirepStatus.php index 290984bd..c9afc1af 100644 --- a/app/Models/Enums/PirepStatus.php +++ b/app/Models/Enums/PirepStatus.php @@ -8,57 +8,56 @@ use App\Interfaces\Enum; * Tied to the ACARS statuses/states. * Corresponds to values from AIDX and ICAO ADREP * https://www.skybrary.aero/index.php/Flight_Phase_Taxonomy - * @package App\Models\Enums */ class PirepStatus extends Enum { - public const INITIATED = 'INI'; - public const SCHEDULED = 'SCH'; - public const BOARDING = 'BST'; - public const RDY_START = 'RDT'; - public const PUSHBACK_TOW = 'PBT'; - public const DEPARTED = 'OFB'; // Off block - public const RDY_DEICE = 'DIR'; - public const STRT_DEICE = 'DIC'; - public const GRND_RTRN = 'GRT'; // Ground return - public const TAXI = 'TXI'; // Taxi - public const TAKEOFF = 'TOF'; - public const INIT_CLIM = 'ICL'; - public const AIRBORNE = 'TKO'; - public const ENROUTE = 'ENR'; - public const DIVERTED = 'DV'; - public const APPROACH = 'TEN'; + public const INITIATED = 'INI'; + public const SCHEDULED = 'SCH'; + public const BOARDING = 'BST'; + public const RDY_START = 'RDT'; + public const PUSHBACK_TOW = 'PBT'; + public const DEPARTED = 'OFB'; // Off block + public const RDY_DEICE = 'DIR'; + public const STRT_DEICE = 'DIC'; + public const GRND_RTRN = 'GRT'; // Ground return + public const TAXI = 'TXI'; // Taxi + public const TAKEOFF = 'TOF'; + public const INIT_CLIM = 'ICL'; + public const AIRBORNE = 'TKO'; + public const ENROUTE = 'ENR'; + public const DIVERTED = 'DV'; + public const APPROACH = 'TEN'; public const APPROACH_ICAO = 'APR'; - public const ON_FINAL = 'FIN'; - public const LANDING = 'LDG'; - public const LANDED = 'LAN'; - public const ARRIVED = 'ONB'; // On block - public const CANCELLED = 'DX'; - public const EMERG_DECENT = 'EMG'; + public const ON_FINAL = 'FIN'; + public const LANDING = 'LDG'; + public const LANDED = 'LAN'; + public const ARRIVED = 'ONB'; // On block + public const CANCELLED = 'DX'; + public const EMERG_DECENT = 'EMG'; protected static $labels = [ - PirepStatus::INITIATED => 'pireps.status.initialized', - PirepStatus::SCHEDULED => 'pireps.status.scheduled', - PirepStatus::BOARDING => 'pireps.status.boarding', - PirepStatus::RDY_START => 'pireps.status.ready_start', - PirepStatus::PUSHBACK_TOW => 'pireps.status.push_tow', - PirepStatus::DEPARTED => 'pireps.status.departed', - PirepStatus::RDY_DEICE => 'pireps.status.ready_deice', - PirepStatus::STRT_DEICE => 'pireps.status.deicing', - PirepStatus::GRND_RTRN => 'pireps.status.ground_ret', - PirepStatus::TAXI => 'pireps.status.taxi', - PirepStatus::TAKEOFF => 'pireps.status.takeoff', - PirepStatus::INIT_CLIM => 'pireps.status.initial_clb', - PirepStatus::AIRBORNE => 'pireps.status.enroute', - PirepStatus::ENROUTE => 'pireps.status.enroute', - PirepStatus::DIVERTED => 'pireps.status.diverted', - PirepStatus::APPROACH => 'pireps.status.approach', - PirepStatus::APPROACH_ICAO => 'pireps.status.approach', - PirepStatus::ON_FINAL => 'pireps.status.final_appr', - PirepStatus::LANDING => 'pireps.status.landing', - PirepStatus::LANDED => 'pireps.status.landed', - PirepStatus::ARRIVED => 'pireps.status.arrived', - PirepStatus::CANCELLED => 'pireps.status.cancelled', - PirepStatus::EMERG_DECENT => 'pireps.status.emerg_decent', + self::INITIATED => 'pireps.status.initialized', + self::SCHEDULED => 'pireps.status.scheduled', + self::BOARDING => 'pireps.status.boarding', + self::RDY_START => 'pireps.status.ready_start', + self::PUSHBACK_TOW => 'pireps.status.push_tow', + self::DEPARTED => 'pireps.status.departed', + self::RDY_DEICE => 'pireps.status.ready_deice', + self::STRT_DEICE => 'pireps.status.deicing', + self::GRND_RTRN => 'pireps.status.ground_ret', + self::TAXI => 'pireps.status.taxi', + self::TAKEOFF => 'pireps.status.takeoff', + self::INIT_CLIM => 'pireps.status.initial_clb', + self::AIRBORNE => 'pireps.status.enroute', + self::ENROUTE => 'pireps.status.enroute', + self::DIVERTED => 'pireps.status.diverted', + self::APPROACH => 'pireps.status.approach', + self::APPROACH_ICAO => 'pireps.status.approach', + self::ON_FINAL => 'pireps.status.final_appr', + self::LANDING => 'pireps.status.landing', + self::LANDED => 'pireps.status.landed', + self::ARRIVED => 'pireps.status.arrived', + self::CANCELLED => 'pireps.status.cancelled', + self::EMERG_DECENT => 'pireps.status.emerg_decent', ]; } diff --git a/app/Models/Enums/UserState.php b/app/Models/Enums/UserState.php index 220191de..104689b7 100644 --- a/app/Models/Enums/UserState.php +++ b/app/Models/Enums/UserState.php @@ -6,21 +6,20 @@ use App\Interfaces\Enum; /** * Class UserState - * @package App\Models\Enums */ class UserState extends Enum { - public const PENDING = 0; - public const ACTIVE = 1; - public const REJECTED = 2; - public const ON_LEAVE = 3; + public const PENDING = 0; + public const ACTIVE = 1; + public const REJECTED = 2; + public const ON_LEAVE = 3; public const SUSPENDED = 4; protected static $labels = [ - UserState::PENDING => 'user.state.pending', - UserState::ACTIVE => 'user.state.active', - UserState::REJECTED => 'user.state.rejected', - UserState::ON_LEAVE => 'user.state.on_leave', - UserState::SUSPENDED => 'user.state.suspended', + self::PENDING => 'user.state.pending', + self::ACTIVE => 'user.state.active', + self::REJECTED => 'user.state.rejected', + self::ON_LEAVE => 'user.state.on_leave', + self::SUSPENDED => 'user.state.suspended', ]; } diff --git a/app/Models/Expense.php b/app/Models/Expense.php index e282a42e..501c9388 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -1,17 +1,18 @@ belongsTo(Airline::class, 'airline_id'); diff --git a/app/Models/Fare.php b/app/Models/Fare.php index ae9baf03..1e2c90c8 100644 --- a/app/Models/Fare.php +++ b/app/Models/Fare.php @@ -1,16 +1,17 @@ belongsToMany(Subfleet::class, 'subfleet_fare') diff --git a/app/Models/File.php b/app/Models/File.php index 210d2e11..dcdd5f38 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -2,7 +2,6 @@ namespace App\Models; - use App\Interfaces\Model; use App\Models\Traits\HashIdTrait; use App\Models\Traits\ReferenceTrait; @@ -13,11 +12,10 @@ use Illuminate\Support\Facades\Storage; * @property string $description * @property string $disk * @property string $path - * @property boolean $public + * @property bool $public * @property int $download_count * @property string $url * @property string $filename - * @package App\Models */ class File extends Model { @@ -42,13 +40,14 @@ class File extends Model ]; public static $rules = [ - 'name' => 'required', + 'name' => 'required', ]; private $pathinfo; /** * Return the file extension + * * @return string */ public function getExtensionAttribute(): string @@ -62,6 +61,7 @@ class File extends Model /** * Get just the filename + * * @return string */ public function getFilenameAttribute() :string @@ -75,6 +75,7 @@ class File extends Model /** * Get the full URL to this attribute + * * @return string */ public function getUrlAttribute(): string diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 00eb92a5..f5e65d34 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -15,7 +15,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; * @property string id * @property mixed ident * @property Airline airline - * @property integer airline_id + * @property int airline_id * @property mixed flight_number * @property mixed route_code * @property int route_leg @@ -23,7 +23,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; * @property Collection field_values * @property Collection fares * @property Collection subfleets - * @property integer days + * @property int days * @property Airport dep_airport * @property Airport arr_airport * @property Airport alt_airport @@ -42,7 +42,8 @@ class Flight extends Model public $incrementing = false; /** The form wants this */ - public $hours, $minutes; + public $hours; + public $minutes; protected $fillable = [ 'id', @@ -96,13 +97,15 @@ class Flight extends Model /** * Return all of the flights on any given day(s) of the week * Search using bitmasks + * * @param Days[] $days List of the enumerated values + * * @return Flight */ public static function findByDays(array $days) { - $flights = Flight::where('active', true); - foreach($days as $day) { + $flights = self::where('active', true); + foreach ($days as $day) { $flights = $flights->where('days', '&', $day); } @@ -130,12 +133,13 @@ class Flight extends Model /** * Return a new Length unit so conversions can be made + * * @return int|Distance */ public function getDistanceAttribute() { if (!array_key_exists('distance', $this->attributes)) { - return null; + return; } try { @@ -151,6 +155,7 @@ class Flight extends Model /** * Set the distance unit, convert to our internal default unit + * * @param $value */ public function setDistanceAttribute($value): void @@ -166,6 +171,7 @@ class Flight extends Model /** * @param $day + * * @return bool */ public function on_day($day): bool @@ -175,13 +181,15 @@ class Flight extends Model /** * Return a custom field value + * * @param $field_name + * * @return string */ public function field($field_name): string { $field = $this->field_values->where('name', $field_name)->first(); - if($field) { + if ($field) { return $field['value']; } @@ -191,6 +199,7 @@ class Flight extends Model /** * Set the days parameter. If an array is passed, it's * AND'd together to create the mask value + * * @param array|int $val */ public function setDaysAttribute($val): void @@ -205,7 +214,6 @@ class Flight extends Model /** * Relationship */ - public function airline() { return $this->belongsTo(Airline::class, 'airline_id'); diff --git a/app/Models/FlightField.php b/app/Models/FlightField.php index daea8cfc..92af3d0e 100644 --- a/app/Models/FlightField.php +++ b/app/Models/FlightField.php @@ -6,9 +6,9 @@ use App\Interfaces\Model; /** * Class FlightField + * * @property string name * @property string slug - * @package App\Models */ class FlightField extends Model { @@ -31,6 +31,7 @@ class FlightField extends Model /** * When setting the name attribute, also set the slug + * * @param $name */ public function setNameAttribute($name): void diff --git a/app/Models/FlightFieldValue.php b/app/Models/FlightFieldValue.php index 48c38d17..13a0ad78 100644 --- a/app/Models/FlightFieldValue.php +++ b/app/Models/FlightFieldValue.php @@ -6,10 +6,10 @@ use App\Interfaces\Model; /** * Class FlightFieldValue + * * @property string flight_id * @property string name * @property string value - * @package App\Models */ class FlightFieldValue extends Model { @@ -36,7 +36,6 @@ class FlightFieldValue extends Model /** * Relationships */ - public function flight() { return $this->belongsTo(Flight::class, 'flight_id'); diff --git a/app/Models/GeoJson.php b/app/Models/GeoJson.php index 3ca051df..2747567b 100644 --- a/app/Models/GeoJson.php +++ b/app/Models/GeoJson.php @@ -10,7 +10,6 @@ use GeoJson\Geometry\Point; /** * Return different points/features in GeoJSON format * https://tools.ietf.org/html/rfc7946 - * @package App\Models */ class GeoJson { @@ -37,16 +36,17 @@ class GeoJson $point = [$lon, $lat]; $this->line_coords[] = [$lon, $lat]; - if(array_key_exists('alt', $attrs)) { + if (array_key_exists('alt', $attrs)) { $point[] = $attrs['alt']; } $this->point_coords[] = new Feature(new Point($point), $attrs); - ++$this->counter; + $this->counter++; } /** * Get the FeatureCollection for the line + * * @return FeatureCollection */ public function getLine(): FeatureCollection @@ -56,12 +56,13 @@ class GeoJson } return new FeatureCollection([ - new Feature(new LineString($this->line_coords)) + new Feature(new LineString($this->line_coords)), ]); } /** * Get the feature collection of all the points + * * @return FeatureCollection */ public function getPoints(): FeatureCollection diff --git a/app/Models/Journal.php b/app/Models/Journal.php index 238e8867..8672dcc9 100644 --- a/app/Models/Journal.php +++ b/app/Models/Journal.php @@ -12,6 +12,7 @@ use Carbon\Carbon; /** * Class Journal + * * @property mixed id * @property Money $balance * @property string $currency @@ -38,7 +39,7 @@ class Journal extends Model protected $dates = [ 'created_at', 'deleted_at', - 'updated_at' + 'updated_at', ]; /** @@ -51,6 +52,7 @@ class Journal extends Model /** * Relationship + * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function ledger() @@ -60,6 +62,7 @@ class Journal extends Model /** * Relationship + * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function transactions() @@ -77,6 +80,7 @@ class Journal extends Model /** * @param Ledger $ledger + * * @return Journal */ public function assignToLedger(Ledger $ledger) @@ -87,7 +91,6 @@ class Journal extends Model } /** - * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ @@ -99,9 +102,11 @@ class Journal extends Model /** * @param $value - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getBalanceAttribute($value): Money { @@ -110,6 +115,7 @@ class Journal extends Model /** * @param $value + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ @@ -124,6 +130,7 @@ class Journal extends Model /** * @param Journal $object + * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function transactionsReferencingObjectQuery($object) @@ -136,10 +143,13 @@ class Journal extends Model /** * Get the credit only balance of the journal based on a given date. + * * @param Carbon $date - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getCreditBalanceOn(Carbon $date) { @@ -152,10 +162,13 @@ class Journal extends Model /** * Get the balance of the journal based on a given date. + * * @param Carbon $date - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getBalanceOn(Carbon $date) { @@ -165,9 +178,11 @@ class Journal extends Model /** * Get the balance of the journal as of right now, excluding future transactions. - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getCurrentBalance() { @@ -176,9 +191,11 @@ class Journal extends Model /** * Get the balance of the journal. This "could" include future dates. - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getBalance() { diff --git a/app/Models/JournalTransaction.php b/app/Models/JournalTransaction.php index 4d4105ab..21aa51e0 100644 --- a/app/Models/JournalTransaction.php +++ b/app/Models/JournalTransaction.php @@ -15,10 +15,10 @@ use App\Models\Traits\ReferenceTrait; * @property string memo * @property string transaction_group * @property string post_date - * @property integer credit - * @property integer debit + * @property int credit + * @property int debit * @property string ref_model - * @property integer ref_model_id + * @property int ref_model_id * @property Journal journal */ class JournalTransaction extends Model @@ -39,7 +39,7 @@ class JournalTransaction extends Model 'tags', 'ref_model', 'ref_model_id', - 'post_date' + 'post_date', ]; protected $casts = [ diff --git a/app/Models/Ledger.php b/app/Models/Ledger.php index 843dcd7d..cf175a0b 100644 --- a/app/Models/Ledger.php +++ b/app/Models/Ledger.php @@ -12,7 +12,7 @@ use Carbon\Carbon; /** * Class Journal - * @package Scottlaurent\Accounting + * * @property Money $balance * @property string $currency * @property Carbon $updated_at @@ -23,9 +23,6 @@ class Ledger extends Model { public $table = 'ledgers'; - /** - * - */ public function journals() { return $this->hasMany(Journal::class); @@ -40,7 +37,6 @@ class Ledger extends Model } /** - * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ @@ -56,7 +52,6 @@ class Ledger extends Model } /** - * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ diff --git a/app/Models/Navdata.php b/app/Models/Navdata.php index a2dff0d0..92a0dc52 100644 --- a/app/Models/Navdata.php +++ b/app/Models/Navdata.php @@ -6,7 +6,6 @@ use App\Interfaces\Model; /** * Class Navdata - * @package App\Models */ class Navdata extends Model { @@ -33,6 +32,7 @@ class Navdata extends Model /** * Make sure the ID is in all caps + * * @param $id */ public function setIdAttribute($id): void diff --git a/app/Models/News.php b/app/Models/News.php index 75a25c6e..6c0957a4 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -6,7 +6,6 @@ use App\Interfaces\Model; /** * Class News - * @package App\Models */ class News extends Model { @@ -26,7 +25,6 @@ class News extends Model /** * FOREIGN KEYS */ - public function user() { return $this->belongsTo(User::class, 'user_id'); diff --git a/app/Models/Observers/AircraftObserver.php b/app/Models/Observers/AircraftObserver.php index 2d6b7ee6..05b3138e 100644 --- a/app/Models/Observers/AircraftObserver.php +++ b/app/Models/Observers/AircraftObserver.php @@ -7,7 +7,6 @@ use App\Support\ICAO; /** * Class AircraftObserver - * @package App\Models\Observers */ class AircraftObserver { diff --git a/app/Models/Observers/AirportObserver.php b/app/Models/Observers/AirportObserver.php index 14fc789e..3dd3af3b 100644 --- a/app/Models/Observers/AirportObserver.php +++ b/app/Models/Observers/AirportObserver.php @@ -6,7 +6,6 @@ use App\Models\Airport; /** * Make sure that the fields are properly capitalized - * @package App\Models\Observers */ class AirportObserver { diff --git a/app/Models/Observers/JournalObserver.php b/app/Models/Observers/JournalObserver.php index 56364820..f65d76cb 100644 --- a/app/Models/Observers/JournalObserver.php +++ b/app/Models/Observers/JournalObserver.php @@ -6,12 +6,12 @@ use App\Models\Journal; /** * Class JournalObserver - * @package App\Models\Observers */ class JournalObserver { /** * @param Journal $journal + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ diff --git a/app/Models/Observers/JournalTransactionObserver.php b/app/Models/Observers/JournalTransactionObserver.php index f7fe785e..9806ae5c 100644 --- a/app/Models/Observers/JournalTransactionObserver.php +++ b/app/Models/Observers/JournalTransactionObserver.php @@ -6,12 +6,12 @@ use App\Models\JournalTransaction; /** * Class JournalTransactionObserver - * @package App\Models\Observers */ class JournalTransactionObserver { /** * Set the ID to a UUID + * * @param JournalTransaction $transaction */ public function creating(JournalTransaction $transaction): void @@ -23,6 +23,7 @@ class JournalTransactionObserver /** * After transaction is saved, adjust the journal balance + * * @param JournalTransaction $transaction */ public function saved(JournalTransaction $transaction): void @@ -43,6 +44,7 @@ class JournalTransactionObserver /** * After transaction is deleted, adjust the balance on the journal + * * @param JournalTransaction $transaction */ public function deleted(JournalTransaction $transaction): void diff --git a/app/Models/Observers/SettingObserver.php b/app/Models/Observers/SettingObserver.php index e1eb293e..015a405a 100644 --- a/app/Models/Observers/SettingObserver.php +++ b/app/Models/Observers/SettingObserver.php @@ -6,7 +6,6 @@ use App\Models\Setting; /** * Class SettingObserver - * @package App\Models\Observers */ class SettingObserver { diff --git a/app/Models/Observers/Sluggable.php b/app/Models/Observers/Sluggable.php index 079a0f7d..e0415c7d 100644 --- a/app/Models/Observers/Sluggable.php +++ b/app/Models/Observers/Sluggable.php @@ -4,7 +4,6 @@ namespace App\Models\Observers; /** * Create a slug from a name - * @package App\Models\Observers */ class Sluggable { diff --git a/app/Models/Observers/SubfleetObserver.php b/app/Models/Observers/SubfleetObserver.php index 1d92bb3b..3f17de45 100644 --- a/app/Models/Observers/SubfleetObserver.php +++ b/app/Models/Observers/SubfleetObserver.php @@ -6,7 +6,6 @@ use App\Models\Subfleet; /** * Class SubfleetObserver - * @package App\Models\Observers */ class SubfleetObserver { diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index 83663e7c..e908169b 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -16,13 +16,14 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; /** * Class Pirep + * * @property string id * @property string flight_number * @property string route_code * @property string route_leg - * @property integer airline_id - * @property integer user_id - * @property integer aircraft_id + * @property int airline_id + * @property int user_id + * @property int aircraft_id * @property Aircraft aircraft * @property Airline airline * @property Airport arr_airport @@ -31,13 +32,13 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; * @property string dpt_airport_id * @property Carbon block_off_time * @property Carbon block_on_time - * @property integer block_time - * @property integer flight_time In minutes - * @property integer planned_flight_time - * @property double distance - * @property double planned_distance + * @property int block_time + * @property int flight_time In minutes + * @property int planned_flight_time + * @property float distance + * @property float planned_distance * @property string route - * @property integer score + * @property int score * @property User user * @property Flight|null flight * @property Collection fields @@ -49,7 +50,6 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; * @property bool read_only * @property Acars position * @property Acars[] acars - * @package App\Models */ class Pirep extends Model { @@ -59,7 +59,8 @@ class Pirep extends Model public $incrementing = false; /** The form wants this */ - public $hours, $minutes; + public $hours; + public $minutes; protected $fillable = [ 'id', @@ -137,11 +138,12 @@ class Pirep extends Model /** * Get the flight ident, e.,g JBU1900 + * * @return string */ public function getIdentAttribute(): string { - #$flight_id = $this->airline->code; + //$flight_id = $this->airline->code; $flight_id = $this->flight_number; if (filled($this->route_code)) { @@ -157,6 +159,7 @@ class Pirep extends Model /** * Return the block off time in carbon format + * * @return Carbon */ public function getBlockOffTimeAttribute() @@ -164,12 +167,11 @@ class Pirep extends Model if (array_key_exists('block_off_time', $this->attributes)) { return new Carbon($this->attributes['block_off_time']); } - - return null; } /** * Return the block on time + * * @return Carbon */ public function getBlockOnTimeAttribute() @@ -177,12 +179,11 @@ class Pirep extends Model if (array_key_exists('block_on_time', $this->attributes)) { return new Carbon($this->attributes['block_on_time']); } - - return null; } /** * Return the block on time + * * @return Carbon */ public function getSubmittedAtAttribute() @@ -190,18 +191,17 @@ class Pirep extends Model if (array_key_exists('submitted_at', $this->attributes)) { return new Carbon($this->attributes['submitted_at']); } - - return null; } /** * Return a new Length unit so conversions can be made + * * @return int|Distance */ public function getDistanceAttribute() { if (!array_key_exists('distance', $this->attributes)) { - return null; + return; } try { @@ -220,6 +220,7 @@ class Pirep extends Model /** * Set the distance unit, convert to our internal default unit + * * @param $value */ public function setDistanceAttribute($value): void @@ -242,12 +243,13 @@ class Pirep extends Model /** * Return a new Fuel unit so conversions can be made + * * @return int|Fuel */ public function getFuelUsedAttribute() { if (!array_key_exists('fuel_used', $this->attributes)) { - return null; + return; } try { @@ -263,12 +265,13 @@ class Pirep extends Model /** * Return the planned_distance in a converter class + * * @return int|Distance */ public function getPlannedDistanceAttribute() { if (!array_key_exists('planned_distance', $this->attributes)) { - return null; + return; } try { @@ -291,11 +294,11 @@ class Pirep extends Model public function getProgressPercentAttribute() { $upper_bound = $this->distance['nmi']; - if($this->planned_distance) { + if ($this->planned_distance) { $upper_bound = $this->planned_distance['nmi']; } - if(!$upper_bound) { + if (!$upper_bound) { $upper_bound = 1; } @@ -311,16 +314,16 @@ class Pirep extends Model $custom_fields = PirepField::all(); $field_values = PirepFieldValue::where('pirep_id', $this->id)->get(); - # Merge the field values into $fields - foreach($custom_fields as $field) { + // Merge the field values into $fields + foreach ($custom_fields as $field) { $has_value = $field_values->firstWhere('slug', $field->slug); - if(!$has_value) { + if (!$has_value) { $field_values->push(new PirepFieldValue([ 'pirep_id' => $this->id, - 'name' => $field->name, - 'slug' => $field->slug, - 'value' => '', - 'source' => PirepFieldSource::MANUAL + 'name' => $field->name, + 'slug' => $field->slug, + 'value' => '', + 'source' => PirepFieldSource::MANUAL, ])); } } @@ -330,6 +333,7 @@ class Pirep extends Model /** * Look up the flight, based on the PIREP flight info + * * @return Flight|null */ public function getFlightAttribute(): ?Flight @@ -353,6 +357,7 @@ class Pirep extends Model /** * Set the amount of fuel used + * * @param $value */ public function setFuelUsedAttribute($value) @@ -368,6 +373,7 @@ class Pirep extends Model /** * Set the distance unit, convert to our internal default unit + * * @param $value */ public function setPlannedDistanceAttribute($value) @@ -383,6 +389,7 @@ class Pirep extends Model /** * Do some cleanup on the route + * * @param $route */ public function setRouteAttribute($route): void @@ -401,16 +408,19 @@ class Pirep extends Model /** * Check if this PIREP is allowed to be updated + * * @return bool */ public function allowedUpdates(): bool { - return ! $this->getReadOnlyAttribute(); + return !$this->getReadOnlyAttribute(); } /** * Return a custom field value + * * @param $field_name + * * @return string */ public function field($field_name): string @@ -426,7 +436,6 @@ class Pirep extends Model /** * Foreign Keys */ - public function acars() { return $this->hasMany(Acars::class, 'pirep_id') diff --git a/app/Models/PirepComment.php b/app/Models/PirepComment.php index 224bfd54..16e890fc 100644 --- a/app/Models/PirepComment.php +++ b/app/Models/PirepComment.php @@ -9,7 +9,6 @@ use App\Interfaces\Model; * * @property string pirep_id * @property int user_id - * @package App\Models */ class PirepComment extends Model { diff --git a/app/Models/PirepFare.php b/app/Models/PirepFare.php index 808e807e..7ada428f 100644 --- a/app/Models/PirepFare.php +++ b/app/Models/PirepFare.php @@ -6,7 +6,6 @@ use App\Interfaces\Model; /** * Class PirepFare - * @package App\Models */ class PirepFare extends Model { @@ -30,7 +29,6 @@ class PirepFare extends Model /** * Relationships */ - public function fare() { return $this->belongsTo(Fare::class, 'fare_id'); diff --git a/app/Models/PirepField.php b/app/Models/PirepField.php index e0d5a9c1..957447b3 100644 --- a/app/Models/PirepField.php +++ b/app/Models/PirepField.php @@ -6,9 +6,9 @@ use App\Interfaces\Model; /** * Class PirepField + * * @property string name * @property string slug - * @package App\Models */ class PirepField extends Model { @@ -31,6 +31,7 @@ class PirepField extends Model /** * When setting the name attribute, also set the slug + * * @param $name */ public function setNameAttribute($name): void diff --git a/app/Models/PirepFieldValue.php b/app/Models/PirepFieldValue.php index 02552058..4ebcb2f1 100644 --- a/app/Models/PirepFieldValue.php +++ b/app/Models/PirepFieldValue.php @@ -7,7 +7,6 @@ use App\Models\Enums\PirepFieldSource; /** * Class PirepFieldValue - * @package App\Models */ class PirepFieldValue extends Model { @@ -31,6 +30,7 @@ class PirepFieldValue extends Model /** * If it was filled in from ACARS, then it's read only + * * @return bool */ public function getReadOnlyAttribute() @@ -50,7 +50,6 @@ class PirepFieldValue extends Model /** * Foreign Keys */ - public function pirep() { return $this->belongsTo(Pirep::class, 'pirep_id'); diff --git a/app/Models/Rank.php b/app/Models/Rank.php index 28718c80..7be73c94 100644 --- a/app/Models/Rank.php +++ b/app/Models/Rank.php @@ -6,10 +6,10 @@ use App\Interfaces\Model; /** * Class Rank + * * @property int hours * @property float manual_base_pay_rate * @property float acars_base_pay_rate - * @package App\Models */ class Rank extends Model { diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 98259ece..87cc1273 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -6,6 +6,7 @@ use App\Interfaces\Model; /** * Class Setting + * * @property string id * @property string name * @property string key @@ -14,7 +15,6 @@ use App\Interfaces\Model; * @property string type * @property string options * @property string description - * @package App\Models */ class Setting extends Model { @@ -39,6 +39,7 @@ class Setting extends Model /** * @param $key + * * @return mixed */ public static function formatKey($key) @@ -48,6 +49,7 @@ class Setting extends Model /** * Force formatting the key + * * @param $id */ public function setIdAttribute($id): void @@ -58,6 +60,7 @@ class Setting extends Model /** * Set the key to lowercase + * * @param $key */ public function setKeyAttribute($key): void diff --git a/app/Models/Subfleet.php b/app/Models/Subfleet.php index 3f0b280f..6e743ea2 100644 --- a/app/Models/Subfleet.php +++ b/app/Models/Subfleet.php @@ -8,6 +8,7 @@ use App\Models\Traits\ExpensableTrait; /** * Class Subfleet + * * @property int id * @property string type * @property string name @@ -16,7 +17,6 @@ use App\Models\Traits\ExpensableTrait; * @property float cost_block_hour * @property float cost_delay_minute * @property Airline airline - * @package App\Models */ class Subfleet extends Model { @@ -59,14 +59,13 @@ class Subfleet extends Model */ public function setTypeAttribute($type) { - $type = str_replace([' ', ','], array('-', ''), $type); + $type = str_replace([' ', ','], ['-', ''], $type); $this->attributes['type'] = $type; } /** * Relationships */ - public function aircraft() { return $this->hasMany(Aircraft::class, 'subfleet_id') diff --git a/app/Models/Traits/ExpensableTrait.php b/app/Models/Traits/ExpensableTrait.php index 2abee8e7..c27d0740 100644 --- a/app/Models/Traits/ExpensableTrait.php +++ b/app/Models/Traits/ExpensableTrait.php @@ -12,13 +12,14 @@ trait ExpensableTrait /** * Morph to Expenses. + * * @return mixed */ public function expenses() { return $this->morphMany( Expense::class, - 'expenses', # overridden by the next two anyway + 'expenses', // overridden by the next two anyway 'ref_model', 'ref_model_id' ); diff --git a/app/Models/Traits/FilesTrait.php b/app/Models/Traits/FilesTrait.php index 8154d831..a7db1712 100644 --- a/app/Models/Traits/FilesTrait.php +++ b/app/Models/Traits/FilesTrait.php @@ -8,13 +8,14 @@ trait FilesTrait { /** * Morph to type of File + * * @return mixed */ public function files() { return $this->morphMany( File::class, - 'files', # overridden by the next two anyway + 'files', // overridden by the next two anyway 'ref_model', 'ref_model_id' ); diff --git a/app/Models/Traits/HashIdTrait.php b/app/Models/Traits/HashIdTrait.php index 5e898289..c90022d5 100644 --- a/app/Models/Traits/HashIdTrait.php +++ b/app/Models/Traits/HashIdTrait.php @@ -8,8 +8,9 @@ use Hashids\Hashids; trait HashIdTrait { /** - * @return string * @throws \Hashids\HashidsException + * + * @return string */ final protected static function createNewHashId(): string { @@ -20,6 +21,7 @@ trait HashIdTrait /** * Register callbacks + * * @throws \Hashids\HashidsException */ final protected static function bootHashIdTrait(): void diff --git a/app/Models/Traits/JournalTrait.php b/app/Models/Traits/JournalTrait.php index 5fbf7b7d..46aedad6 100644 --- a/app/Models/Traits/JournalTrait.php +++ b/app/Models/Traits/JournalTrait.php @@ -30,8 +30,10 @@ trait JournalTrait * Initialize a journal for a given model object * * @param string $currency_code - * @return Journal + * * @throws \Exception + * + * @return Journal */ public function initJournal($currency_code = 'USD') { diff --git a/app/Models/Traits/ReferenceTrait.php b/app/Models/Traits/ReferenceTrait.php index f36349d7..5867d0be 100644 --- a/app/Models/Traits/ReferenceTrait.php +++ b/app/Models/Traits/ReferenceTrait.php @@ -4,14 +4,15 @@ namespace App\Models\Traits; /** * Trait ReferenceTrait + * * @property \App\Interfaces\Model $ref_model * @property mixed $ref_model_id - * @package App\Models\Traits */ trait ReferenceTrait { /** * @param \App\Interfaces\Model $object + * * @return self */ public function referencesObject($object) @@ -25,12 +26,13 @@ trait ReferenceTrait /** * Return an instance of the object or null + * * @return \App\Interfaces\Model|null */ public function getReferencedObject() { if (!$this->ref_model || !$this->ref_model_id) { - return null; + return; } if ($this->ref_model === __CLASS__) { @@ -38,11 +40,11 @@ trait ReferenceTrait } try { - $klass = new $this->ref_model; + $klass = new $this->ref_model(); $obj = $klass->find($this->ref_model_id); return $obj; } catch (\Exception $e) { - return null; + return; } } } diff --git a/app/Models/User.php b/app/Models/User.php index 4db60fa2..fcace333 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -10,7 +10,7 @@ use Illuminate\Notifications\Notifiable; use Laratrust\Traits\LaratrustUserTrait; /** - * @property integer id + * @property int id * @property string name * @property string email * @property string password @@ -111,6 +111,7 @@ class User extends Authenticatable /** * Shorthand for getting the timezone + * * @return string */ public function getTzAttribute(): string @@ -120,6 +121,7 @@ class User extends Authenticatable /** * Shorthand for setting the timezone + * * @param $value */ public function setTzAttribute($value) @@ -128,21 +130,22 @@ class User extends Authenticatable } /** - * Return a File model - */ + * Return a File model + */ public function getAvatarAttribute() { if (!$this->attributes['avatar']) { - return null; + return; } return new File([ - 'path' => $this->attributes['avatar'] + 'path' => $this->attributes['avatar'], ]); } /** * @param mixed $size Size of the gravatar, in pixels + * * @return string */ public function gravatar($size = null) @@ -162,7 +165,6 @@ class User extends Authenticatable /** * Foreign Keys */ - public function airline() { return $this->belongsTo(Airline::class, 'airline_id'); @@ -198,6 +200,7 @@ class User extends Authenticatable /** * The bid rows + * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function bids() diff --git a/app/Models/UserAward.php b/app/Models/UserAward.php index 61c367ac..f9d75bf6 100644 --- a/app/Models/UserAward.php +++ b/app/Models/UserAward.php @@ -6,7 +6,6 @@ use App\Interfaces\Model; /** * Class UserAward - * @package App\Models */ class UserAward extends Model { @@ -14,7 +13,7 @@ class UserAward extends Model protected $fillable = [ 'user_id', - 'award_id' + 'award_id', ]; /** diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 7bbe4a22..165f6ad3 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -12,8 +12,8 @@ use App\Models\Observers\AircraftObserver; use App\Models\Observers\AirportObserver; use App\Models\Observers\JournalObserver; use App\Models\Observers\JournalTransactionObserver; -use App\Models\Observers\Sluggable; use App\Models\Observers\SettingObserver; +use App\Models\Observers\Sluggable; use App\Models\Observers\SubfleetObserver; use App\Models\PirepField; use App\Models\PirepFieldValue; @@ -60,10 +60,10 @@ class AppServiceProvider extends ServiceProvider */ public function register(): void { - # Only dev environment stuff + // Only dev environment stuff if ($this->app->environment() === 'dev') { - # Only load the IDE helper if it's included. This lets use distribute the - # package without any dev dependencies + // Only load the IDE helper if it's included. This lets use distribute the + // package without any dev dependencies if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) { $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); } diff --git a/app/Providers/CronServiceProvider.php b/app/Providers/CronServiceProvider.php index 5e0ac041..984a7afb 100644 --- a/app/Providers/CronServiceProvider.php +++ b/app/Providers/CronServiceProvider.php @@ -2,20 +2,19 @@ namespace App\Providers; +use App\Cron\Nightly\ApplyExpenses; +use App\Cron\Nightly\PilotLeave; +use App\Cron\Nightly\RecalculateBalances; use App\Cron\Nightly\RecalculateStats; use App\Cron\Nightly\SetActiveFlights; use App\Events\CronHourly; use App\Events\CronMonthly; use App\Events\CronNightly; use App\Events\CronWeekly; -use App\Cron\Nightly\ApplyExpenses; -use App\Cron\Nightly\PilotLeave; -use App\Cron\Nightly\RecalculateBalances; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; /** * All of the hooks for the cron jobs - * @package App\Providers */ class CronServiceProvider extends ServiceProvider { @@ -32,11 +31,11 @@ class CronServiceProvider extends ServiceProvider ], CronMonthly::class => [ - \App\Cron\Monthly\ApplyExpenses::class + \App\Cron\Monthly\ApplyExpenses::class, ], CronHourly::class => [ - \App\Cron\Hourly\RemoveExpiredBids::class + \App\Cron\Hourly\RemoveExpiredBids::class, ], ]; } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 7f6f5750..f9874799 100755 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -14,7 +14,7 @@ class EventServiceProvider extends ServiceProvider { protected $listen = [ Expenses::class => [ - ExpenseListener::class + ExpenseListener::class, ], UserStatsChanged::class => [ diff --git a/app/Providers/ExtendedTimezonelistProvider.php b/app/Providers/ExtendedTimezonelistProvider.php index 3c5a8912..13c83d9d 100644 --- a/app/Providers/ExtendedTimezonelistProvider.php +++ b/app/Providers/ExtendedTimezonelistProvider.php @@ -24,7 +24,7 @@ class ExtendedTimezonelistProvider extends ServiceProvider public function register() { $this->app->singleton('timezonelist', function ($app) { - return new TimezonelistExtended; + return new TimezonelistExtended(); }); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 07079a18..12e9f337 100755 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -67,7 +67,7 @@ class RouteServiceProvider extends ServiceProvider { Route::group([ 'middleware' => ['api'], - 'namespace' => $this->namespace."\\Api", + 'namespace' => $this->namespace.'\\Api', 'prefix' => 'api', 'as' => 'api.', ], function ($router) { diff --git a/app/Providers/vaCentralServiceProvider.php b/app/Providers/vaCentralServiceProvider.php index 361baeaf..d9a3dc79 100755 --- a/app/Providers/vaCentralServiceProvider.php +++ b/app/Providers/vaCentralServiceProvider.php @@ -7,7 +7,6 @@ use VaCentral\VaCentral; /** * Bootstrap the vaCentral library - * @package App\Providers */ class vaCentralServiceProvider extends ServiceProvider { diff --git a/app/Repositories/AcarsRepository.php b/app/Repositories/AcarsRepository.php index 3e1311e1..65abfe09 100644 --- a/app/Repositories/AcarsRepository.php +++ b/app/Repositories/AcarsRepository.php @@ -11,7 +11,6 @@ use Carbon\Carbon; /** * Class AcarsRepository - * @package App\Repositories */ class AcarsRepository extends Repository { @@ -26,6 +25,7 @@ class AcarsRepository extends Repository /** * @param $pirep_id * @param $type + * * @return mixed */ public function forPirep($pirep_id, $type) @@ -52,7 +52,9 @@ class AcarsRepository extends Repository /** * Get all of the PIREPS that are in-progress, and then * get the latest update for those flights + * * @param int $live_time Age in hours of the oldest flights to show + * * @return Pirep */ public function getPositions($live_time = 0) @@ -60,7 +62,7 @@ class AcarsRepository extends Repository $q = Pirep::with(['airline', 'position', 'aircraft']) ->where(['state' => PirepState::IN_PROGRESS]); - if($live_time !== null && $live_time > 0) { + if ($live_time !== null && $live_time > 0) { $st = Carbon::now('UTC')->subHours($live_time); $q = $q->whereDate('created_at', '>=', $st); } @@ -75,7 +77,7 @@ class AcarsRepository extends Repository public function getAllAcarsPoints() { return Pirep::with('acars')->where([ - 'state' => PirepState::IN_PROGRESS + 'state' => PirepState::IN_PROGRESS, ]); } } diff --git a/app/Repositories/AircraftRepository.php b/app/Repositories/AircraftRepository.php index 2c2bfcb8..a273aeee 100644 --- a/app/Repositories/AircraftRepository.php +++ b/app/Repositories/AircraftRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class AircraftRepository - * @package App\Repositories */ class AircraftRepository extends Repository implements CacheableInterface { @@ -28,6 +27,7 @@ class AircraftRepository extends Repository implements CacheableInterface /** * Return the list of aircraft formatted for a select box + * * @return array */ public function selectBoxList(): array diff --git a/app/Repositories/AirlineRepository.php b/app/Repositories/AirlineRepository.php index abb7d8f9..6f98c042 100644 --- a/app/Repositories/AirlineRepository.php +++ b/app/Repositories/AirlineRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class AirlineRepository - * @package App\Repositories */ class AirlineRepository extends Repository implements CacheableInterface { @@ -27,6 +26,9 @@ class AirlineRepository extends Repository implements CacheableInterface /** * Return the list of airline formatted for a select box + * + * @param mixed $add_blank + * * @return array */ public function selectBoxList($add_blank = false): array diff --git a/app/Repositories/AirportRepository.php b/app/Repositories/AirportRepository.php index fabb96bf..9c707ef0 100644 --- a/app/Repositories/AirportRepository.php +++ b/app/Repositories/AirportRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class AirportRepository - * @package App\Repositories */ class AirportRepository extends Repository implements CacheableInterface { @@ -27,6 +26,10 @@ class AirportRepository extends Repository implements CacheableInterface /** * Return the list of airports formatted for a select box + * + * @param mixed $add_blank + * @param mixed $only_hubs + * * @return array */ public function selectBoxList($add_blank = false, $only_hubs = false): array diff --git a/app/Repositories/AwardRepository.php b/app/Repositories/AwardRepository.php index 6b731bfc..5511ecba 100755 --- a/app/Repositories/AwardRepository.php +++ b/app/Repositories/AwardRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class AwardRepository - * @package App\Repositories */ class AwardRepository extends Repository implements CacheableInterface { diff --git a/app/Repositories/Criteria/WhereCriteria.php b/app/Repositories/Criteria/WhereCriteria.php index 2a32a4cb..97fb2caf 100644 --- a/app/Repositories/Criteria/WhereCriteria.php +++ b/app/Repositories/Criteria/WhereCriteria.php @@ -9,14 +9,14 @@ use Prettus\Repository\Contracts\RepositoryInterface; /** * Class RequestCriteria - * @package Prettus\Repository\Criteria */ class WhereCriteria implements CriteriaInterface { /** * @var \Illuminate\Http\Request */ - protected $request, $where; + protected $request; + protected $where; public function __construct($request, $where) { @@ -27,11 +27,12 @@ class WhereCriteria implements CriteriaInterface /** * Apply criteria in query repository * - * @param Builder|Model $model - * @param RepositoryInterface $repository + * @param Builder|Model $model + * @param RepositoryInterface $repository + * + * @throws \Exception * * @return mixed - * @throws \Exception */ public function apply($model, RepositoryInterface $repository) { diff --git a/app/Repositories/ExpenseRepository.php b/app/Repositories/ExpenseRepository.php index dfb842b9..5b1e8018 100644 --- a/app/Repositories/ExpenseRepository.php +++ b/app/Repositories/ExpenseRepository.php @@ -10,7 +10,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class ExpenseRepository - * @package App\Repositories */ class ExpenseRepository extends Repository implements CacheableInterface { @@ -24,16 +23,18 @@ class ExpenseRepository extends Repository implements CacheableInterface /** * Get all of the expenses for a given type, and also * include expenses for a given airline ID + * * @param $type * @param null $airline_id * @param null $ref_model + * * @return Collection */ public function getAllForType($type, $airline_id = null, $ref_model = null) { $where = [ 'type' => $type, - ['airline_id', '=', null] + ['airline_id', '=', null], ]; if ($ref_model) { @@ -53,7 +54,7 @@ class ExpenseRepository extends Repository implements CacheableInterface if ($airline_id) { $where = [ 'type' => $type, - 'airline_id' => $airline_id + 'airline_id' => $airline_id, ]; if ($ref_model) { diff --git a/app/Repositories/FareRepository.php b/app/Repositories/FareRepository.php index c5833ca2..4ca6159e 100644 --- a/app/Repositories/FareRepository.php +++ b/app/Repositories/FareRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class FareRepository - * @package App\Repositories */ class FareRepository extends Repository implements CacheableInterface { diff --git a/app/Repositories/FlightFieldRepository.php b/app/Repositories/FlightFieldRepository.php index df2cbe9b..4e5db697 100644 --- a/app/Repositories/FlightFieldRepository.php +++ b/app/Repositories/FlightFieldRepository.php @@ -7,7 +7,6 @@ use App\Models\FlightField; /** * Class FlightFieldRepository - * @package App\Repositories */ class FlightFieldRepository extends Repository { diff --git a/app/Repositories/FlightRepository.php b/app/Repositories/FlightRepository.php index c9762514..ee789744 100644 --- a/app/Repositories/FlightRepository.php +++ b/app/Repositories/FlightRepository.php @@ -11,7 +11,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class FlightRepository - * @package App\Repositories */ class FlightRepository extends Repository implements CacheableInterface { @@ -34,10 +33,12 @@ class FlightRepository extends Repository implements CacheableInterface /** * Find a flight based on the given criterea + * * @param $airline_id * @param $flight_num * @param null $route_code * @param null $route_leg + * * @return mixed */ public function findFlight($airline_id, $flight_num, $route_code = null, $route_leg = null) @@ -61,17 +62,20 @@ class FlightRepository extends Repository implements CacheableInterface /** * Create the search criteria and return this with the stuff pushed + * * @param Request $request * @param bool $only_active - * @return $this + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return $this */ public function searchCriteria(Request $request, bool $only_active = true) { $where = []; if ($only_active === true) { - $where['active'] = $only_active; + $where['active'] = $only_active; $where['visible'] = $only_active; } diff --git a/app/Repositories/JournalRepository.php b/app/Repositories/JournalRepository.php index 02513697..ba650495 100644 --- a/app/Repositories/JournalRepository.php +++ b/app/Repositories/JournalRepository.php @@ -14,7 +14,6 @@ use Prettus\Validator\Exceptions\ValidatorException; /** * Class JournalRepository - * @package App\Repositories */ class JournalRepository extends Repository implements CacheableInterface { @@ -30,13 +29,15 @@ class JournalRepository extends Repository implements CacheableInterface /** * Return a Y-m-d string for the post date + * * @param Carbon $date + * * @return string */ public function formatPostDate(Carbon $date = null) { if (!$date) { - return null; + return; } return $date->setTimezone('UTC')->toDateString(); @@ -44,15 +45,18 @@ class JournalRepository extends Repository implements CacheableInterface /** * Recalculate the balance of the given journal + * * @param Journal $journal - * @return Journal + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Journal */ public function recalculateBalance(Journal $journal) { $where = [ - 'journal_id' => $journal->id + 'journal_id' => $journal->id, ]; $credits = Money::create($this->findWhere($where)->sum('credit') ?: 0); @@ -71,15 +75,17 @@ class JournalRepository extends Repository implements CacheableInterface * balance nightly, since they're not atomic operations * * @param Journal $journal - * @param Money|null $credit Amount to credit - * @param Money|null $debit Amount to debit - * @param Model|null $reference The object this is a reference to - * @param string|null $memo Memo for this transaction - * @param string|null $post_date Date of the posting + * @param Money|null $credit Amount to credit + * @param Money|null $debit Amount to debit + * @param Model|null $reference The object this is a reference to + * @param string|null $memo Memo for this transaction + * @param string|null $post_date Date of the posting * @param string|null $transaction_group * @param array|string|null $tags - * @return mixed + * * @throws ValidatorException + * + * @return mixed */ public function post( Journal &$journal, @@ -90,9 +96,8 @@ class JournalRepository extends Repository implements CacheableInterface $post_date = null, $transaction_group = null, $tags = null - ) - { - # tags can be passed in a list + ) { + // tags can be passed in a list if ($tags && \is_array($tags)) { $tags = implode(',', $tags); } @@ -109,7 +114,7 @@ class JournalRepository extends Repository implements CacheableInterface 'memo' => $memo, 'post_date' => $post_date, 'transaction_group' => $transaction_group, - 'tags' => $tags + 'tags' => $tags, ]; if ($reference !== null) { @@ -131,9 +136,11 @@ class JournalRepository extends Repository implements CacheableInterface /** * @param Journal $journal * @param Carbon|null $date - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getBalance(Journal $journal = null, Carbon $date = null) { @@ -151,21 +158,23 @@ class JournalRepository extends Repository implements CacheableInterface /** * Get the credit only balance of the journal based on a given date. + * * @param Carbon $date * @param Journal $journal * @param Carbon|null $start_date * @param null $transaction_group - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getCreditBalanceBetween( Carbon $date, Journal $journal = null, Carbon $start_date = null, $transaction_group = null - ): Money - { + ): Money { $where = []; if ($journal) { @@ -193,17 +202,18 @@ class JournalRepository extends Repository implements CacheableInterface * @param Journal $journal * @param Carbon|null $start_date * @param null $transaction_group - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getDebitBalanceBetween( Carbon $date, Journal $journal = null, Carbon $start_date = null, $transaction_group = null - ): Money - { + ): Money { $where = []; if ($journal) { @@ -228,12 +238,15 @@ class JournalRepository extends Repository implements CacheableInterface /** * Return all transactions for a given object + * * @param $object * @param null $journal * @param Carbon|null $date - * @return array + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return array */ public function getAllForObject($object, $journal = null, Carbon $date = null) { @@ -253,7 +266,7 @@ class JournalRepository extends Repository implements CacheableInterface $transactions = $this->whereOrder($where, [ 'credit' => 'desc', - 'debit' => 'desc' + 'debit' => 'desc', ])->get(); return [ @@ -265,8 +278,10 @@ class JournalRepository extends Repository implements CacheableInterface /** * Delete all transactions for a given object + * * @param $object * @param null $journal + * * @return void */ public function deleteAllForObject($object, $journal = null) diff --git a/app/Repositories/NavdataRepository.php b/app/Repositories/NavdataRepository.php index 9ed69a80..b7ef3316 100644 --- a/app/Repositories/NavdataRepository.php +++ b/app/Repositories/NavdataRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class NavdataRepository - * @package App\Repositories */ class NavdataRepository extends Repository implements CacheableInterface { diff --git a/app/Repositories/NewsRepository.php b/app/Repositories/NewsRepository.php index 819e42b4..cada9239 100644 --- a/app/Repositories/NewsRepository.php +++ b/app/Repositories/NewsRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class NewsRepository - * @package App\Repositories */ class NewsRepository extends Repository implements CacheableInterface { @@ -22,7 +21,9 @@ class NewsRepository extends Repository implements CacheableInterface /** * Latest news items + * * @param int $count + * * @return mixed */ public function getLatest($count = 5) diff --git a/app/Repositories/PirepFieldRepository.php b/app/Repositories/PirepFieldRepository.php index b17b1c99..861f65bf 100644 --- a/app/Repositories/PirepFieldRepository.php +++ b/app/Repositories/PirepFieldRepository.php @@ -7,7 +7,6 @@ use App\Models\PirepField; /** * Class PirepFieldRepository - * @package App\Repositories */ class PirepFieldRepository extends Repository { diff --git a/app/Repositories/PirepRepository.php b/app/Repositories/PirepRepository.php index f7f74960..774efd9e 100644 --- a/app/Repositories/PirepRepository.php +++ b/app/Repositories/PirepRepository.php @@ -9,7 +9,6 @@ use App\Models\User; /** * Class PirepRepository - * @package App\Repositories */ class PirepRepository extends Repository { @@ -30,7 +29,9 @@ class PirepRepository extends Repository /** * Get all the pending reports in order. Returns the Pirep * model but you still need to call ->all() or ->paginate() + * * @param User|null $user + * * @return Pirep */ public function getPending(User $user = null) @@ -47,7 +48,9 @@ class PirepRepository extends Repository /** * Number of PIREPs that are pending + * * @param User|null $user + * * @return mixed */ public function getPendingCount(User $user = null) diff --git a/app/Repositories/RankRepository.php b/app/Repositories/RankRepository.php index 9b466983..659b6e3b 100644 --- a/app/Repositories/RankRepository.php +++ b/app/Repositories/RankRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class RankRepository - * @package App\Repositories */ class RankRepository extends Repository implements CacheableInterface { diff --git a/app/Repositories/SettingRepository.php b/app/Repositories/SettingRepository.php index d5541e8f..bfa60142 100644 --- a/app/Repositories/SettingRepository.php +++ b/app/Repositories/SettingRepository.php @@ -13,7 +13,6 @@ use Prettus\Validator\Exceptions\ValidatorException; /** * Class SettingRepository - * @package App\Repositories */ class SettingRepository extends Repository implements CacheableInterface { @@ -31,9 +30,12 @@ class SettingRepository extends Repository implements CacheableInterface /** * Get a setting, reading it from the cache possibly + * * @param string $key - * @return mixed + * * @throws SettingNotFound + * + * @return mixed */ public function retrieve($key) { @@ -44,7 +46,7 @@ class SettingRepository extends Repository implements CacheableInterface throw new SettingNotFound($key.' not found'); } - # cast some types + // cast some types switch ($setting->type) { case 'bool': case 'boolean': @@ -75,6 +77,9 @@ class SettingRepository extends Repository implements CacheableInterface /** * @alias store($key,$value) + * + * @param mixed $key + * @param mixed $value */ public function save($key, $value) { @@ -84,8 +89,10 @@ class SettingRepository extends Repository implements CacheableInterface /** * Update an existing setting with a new value. Doesn't create * a new setting + * * @param $key * @param $value + * * @return null */ public function store($key, $value) @@ -93,11 +100,11 @@ class SettingRepository extends Repository implements CacheableInterface $key = Setting::formatKey($key); $setting = $this->findWhere( ['id' => $key], - ['id', 'value'] # only get these columns + ['id', 'value'] // only get these columns )->first(); if (!$setting) { - return null; + return; } try { diff --git a/app/Repositories/SubfleetRepository.php b/app/Repositories/SubfleetRepository.php index 9e0c9467..ccd6caa0 100644 --- a/app/Repositories/SubfleetRepository.php +++ b/app/Repositories/SubfleetRepository.php @@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository; /** * Class SubfleetRepository - * @package App\Repositories */ class SubfleetRepository extends Repository implements CacheableInterface { diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index a9e4c6a9..e3f614a9 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -10,7 +10,6 @@ use Illuminate\Http\Request; /** * Class UserRepository - * @package App\Repositories */ class UserRepository extends Repository { @@ -19,7 +18,7 @@ class UserRepository extends Repository 'email' => 'like', 'home_airport_id', 'curr_airport_id', - 'state' + 'state', ]; /** @@ -32,6 +31,7 @@ class UserRepository extends Repository /** * Number of PIREPs that are pending + * * @return mixed */ public function getPendingCount() @@ -49,10 +49,13 @@ class UserRepository extends Repository /** * Create the search criteria and return this with the stuff pushed + * * @param Request $request * @param bool $only_active - * @return $this + * * @throws \Prettus\Repository\Exceptions\RepositoryException + * + * @return $this */ public function searchCriteria(Request $request, bool $only_active = true) { diff --git a/app/Routes/admin.php b/app/Routes/admin.php index 0375a71a..359cea3c 100644 --- a/app/Routes/admin.php +++ b/app/Routes/admin.php @@ -2,7 +2,6 @@ /** * Admin Routes */ - Route::group([ 'namespace' => 'Admin', 'prefix' => 'admin', 'as' => 'admin.', 'middleware' => ['role:admin'], @@ -15,33 +14,33 @@ Route::group([ Route::match(['get', 'post', 'put', 'delete'], 'airports/{id}/expenses', 'AirportController@expenses'); Route::resource('airports', 'AirportController'); - # Awards + // Awards Route::resource('awards', 'AwardController'); - # aircraft and fare associations + // aircraft and fare associations Route::get('aircraft/export', 'AircraftController@export')->name('aircraft.export'); Route::match(['get', 'post'], 'aircraft/import', 'AircraftController@import')->name('aircraft.import'); Route::match(['get', 'post', 'put', 'delete'], 'aircraft/{id}/expenses', 'AircraftController@expenses'); Route::resource('aircraft', 'AircraftController'); - # expenses + // expenses Route::get('expenses/export', 'ExpenseController@export')->name('expenses.export'); Route::match(['get', 'post'], 'expenses/import', 'ExpenseController@import')->name('expenses.import'); Route::resource('expenses', 'ExpenseController'); - # fares + // fares Route::get('fares/export', 'FareController@export')->name('fares.export'); Route::match(['get', 'post'], 'fares/import', 'FareController@import')->name('fares.import'); Route::resource('fares', 'FareController'); - # files + // files Route::post('files', 'FileController@store')->name('files.store'); Route::delete('files/{id}', 'FileController@destroy')->name('files.delete'); - # finances + // finances Route::resource('finances', 'FinanceController'); - # flights and aircraft associations + // flights and aircraft associations Route::get('flights/export', 'FlightController@export')->name('flights.export'); Route::match(['get', 'post'], 'flights/import', 'FlightController@import')->name('flights.import'); Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/fares', 'FlightController@fares'); @@ -51,7 +50,7 @@ Route::group([ Route::resource('flightfields', 'FlightFieldController'); - # pirep related routes + // pirep related routes Route::get('pireps/fares', 'PirepController@fares'); Route::get('pireps/pending', 'PirepController@pending'); Route::resource('pireps', 'PirepController'); @@ -60,15 +59,15 @@ Route::group([ Route::resource('pirepfields', 'PirepFieldController'); - # rankings + // rankings Route::resource('ranks', 'RankController'); Route::match(['get', 'post', 'put', 'delete'], 'ranks/{id}/subfleets', 'RankController@subfleets'); - # settings + // settings Route::match(['get'], 'settings', 'SettingsController@index'); Route::match(['post', 'put'], 'settings', 'SettingsController@update')->name('settings.update'); - # subfleet + // subfleet Route::get('subfleets/export', 'SubfleetController@export')->name('subfleets.export'); Route::match(['get', 'post'], 'subfleets/import', 'SubfleetController@import')->name('subfleets.import'); Route::match(['get', 'post', 'put', 'delete'], 'subfleets/{id}/expenses', 'SubfleetController@expenses'); @@ -80,7 +79,7 @@ Route::group([ Route::get('users/{id}/regen_apikey', 'UserController@regen_apikey')->name('users.regen_apikey'); - # defaults + // defaults Route::get('', ['uses' => 'DashboardController@index']); Route::get('/', ['uses' => 'DashboardController@index']); diff --git a/app/Routes/api.php b/app/Routes/api.php index 0d76f2e7..b9ba7515 100755 --- a/app/Routes/api.php +++ b/app/Routes/api.php @@ -14,7 +14,7 @@ Route::group([], function () { Route::get('version', 'StatusController@status'); }); -/** +/* * these need to be authenticated with a user's API key */ Route::group(['middleware' => ['api.auth']], function () { @@ -48,7 +48,6 @@ Route::group(['middleware' => ['api.auth']], function () { Route::get('pireps/{pirep_id}/fields', 'PirepController@fields_get'); Route::post('pireps/{pirep_id}/fields', 'PirepController@fields_post'); - Route::get('pireps/{pirep_id}/finances', 'PirepController@finances_get'); Route::post('pireps/{pirep_id}/finances/recalculate', 'PirepController@finances_recalculate'); @@ -67,7 +66,7 @@ Route::group(['middleware' => ['api.auth']], function () { Route::get('settings', 'SettingsController@index'); - # This is the info of the user whose token is in use + // This is the info of the user whose token is in use Route::get('user', 'UserController@index'); Route::get('user/fleet', 'UserController@fleet'); Route::get('user/pireps', 'UserController@pireps'); diff --git a/app/Routes/web.php b/app/Routes/web.php index 72fd4729..343c88c4 100755 --- a/app/Routes/web.php +++ b/app/Routes/web.php @@ -4,7 +4,7 @@ * User doesn't need to be logged in for these */ Route::group([ - 'namespace' => 'Frontend', 'prefix' => '', 'as' => 'frontend.' + 'namespace' => 'Frontend', 'prefix' => '', 'as' => 'frontend.', ], function () { Route::get('/', 'HomeController@index')->name('home'); Route::get('r/{id}', 'PirepController@show')->name('pirep.show.public'); @@ -16,7 +16,7 @@ Route::group([ Route::get('livemap', 'AcarsController@index')->name('livemap.index'); }); -/** +/* * These are only visible to a logged in user */ Route::group([ diff --git a/app/Services/AnalyticsService.php b/app/Services/AnalyticsService.php index 62a639fb..03704cf1 100644 --- a/app/Services/AnalyticsService.php +++ b/app/Services/AnalyticsService.php @@ -11,7 +11,6 @@ use PDO; /** * Class AnalyticsService - * @package App\Services */ class AnalyticsService extends Service { @@ -24,13 +23,13 @@ class AnalyticsService extends Service return; } - # some analytics + // some analytics $gamp = GAMP::setClientId(uniqid('', true)); $gamp->setDocumentPath('/install'); $gamp->setCustomDimension(PHP_VERSION, AnalyticsDimensions::PHP_VERSION); - # figure out database version + // figure out database version $pdo = DB::connection()->getPdo(); $gamp->setCustomDimension( strtolower($pdo->getAttribute(PDO::ATTR_SERVER_VERSION)), diff --git a/app/Services/AwardService.php b/app/Services/AwardService.php index 01462116..9c4657e6 100644 --- a/app/Services/AwardService.php +++ b/app/Services/AwardService.php @@ -8,12 +8,12 @@ use Module; /** * Class AwardService - * @package App\Services */ class AwardService extends Service { /** * Find any of the award classes + * * @return \App\Interfaces\Award[] */ public function findAllAwardClasses(): array @@ -21,11 +21,11 @@ class AwardService extends Service $awards = []; $formatted_awards = []; - # Find the awards in the app/Awards directory + // Find the awards in the app/Awards directory $classes = ClassLoader::getClassesInPath(app_path('/Awards')); $awards = array_merge($awards, $classes); - # Look throughout all the other modules, in the module/{MODULE}/Awards directory + // Look throughout all the other modules, in the module/{MODULE}/Awards directory foreach (Module::all() as $module) { $path = $module->getExtraPath('Awards'); $classes = ClassLoader::getClassesInPath($path); diff --git a/app/Services/DatabaseService.php b/app/Services/DatabaseService.php index bbd0020a..f3f43104 100644 --- a/app/Services/DatabaseService.php +++ b/app/Services/DatabaseService.php @@ -9,13 +9,12 @@ use Webpatser\Uuid\Uuid; /** * Class DatabaseService - * @package App\Services */ class DatabaseService extends Service { protected $time_fields = [ 'created_at', - 'updated_at' + 'updated_at', ]; protected $uuid_tables = [ @@ -35,8 +34,10 @@ class DatabaseService extends Service /** * @param $yaml_file * @param bool $ignore_errors - * @return array + * * @throws \Exception + * + * @return array */ public function seed_from_yaml_file($yaml_file, $ignore_errors = false): array { @@ -46,8 +47,10 @@ class DatabaseService extends Service /** * @param $yml * @param bool $ignore_errors - * @return array + * * @throws \Exception + * + * @return array */ public function seed_from_yaml($yml, $ignore_errors = false): array { @@ -55,14 +58,17 @@ class DatabaseService extends Service } /** - * @param $table - * @param $row - * @return mixed + * @param $table + * @param $row + * * @throws \Exception + * + * @return mixed */ - public function insert_row($table, $row) { - # see if this table uses a UUID as the PK - # if no ID is specified + public function insert_row($table, $row) + { + // see if this table uses a UUID as the PK + // if no ID is specified if (\in_array($table, $this->uuid_tables, true)) { if (!array_key_exists('id', $row)) { $row['id'] = Uuid::generate()->string; diff --git a/app/Services/ExportService.php b/app/Services/ExportService.php index bfe5d9bc..0298187a 100644 --- a/app/Services/ExportService.php +++ b/app/Services/ExportService.php @@ -11,19 +11,19 @@ use App\Services\ImportExport\FareExporter; use App\Services\ImportExport\FlightExporter; use App\Services\ImportExport\SubfleetExporter; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Storage; use League\Csv\CharsetConverter; use League\Csv\Writer; -use Illuminate\Support\Facades\Storage; use Log; /** * Class ExportService - * @package App\Services */ class ExportService extends Service { /** - * @param string $path + * @param string $path + * * @return Writer */ public function openCsv($path): Writer @@ -35,20 +35,23 @@ class ExportService extends Service /** * Run the actual importer + * * @param Collection $collection * @param ImportExport $exporter - * @return string + * * @throws \League\Csv\CannotInsertRecord + * + * @return string */ protected function runExport(Collection $collection, ImportExport $exporter): string { - $filename = 'export_' . $exporter->assetType . '.csv'; + $filename = 'export_'.$exporter->assetType.'.csv'; // Create the directory - makes it inside of storage/app Storage::makeDirectory('import'); $path = storage_path('/app/import/export_'.$filename.'.csv'); - Log::info('Exporting "'.$exporter->assetType.'" to ' . $path); + Log::info('Exporting "'.$exporter->assetType.'" to '.$path); $writer = $this->openCsv($path); @@ -65,9 +68,12 @@ class ExportService extends Service /** * Export all of the aircraft + * * @param Collection $aircraft - * @return mixed + * * @throws \League\Csv\CannotInsertRecord + * + * @return mixed */ public function exportAircraft($aircraft) { @@ -77,9 +83,12 @@ class ExportService extends Service /** * Export all of the airports + * * @param Collection $airports - * @return mixed + * * @throws \League\Csv\CannotInsertRecord + * + * @return mixed */ public function exportAirports($airports) { @@ -89,9 +98,12 @@ class ExportService extends Service /** * Export all of the airports + * * @param Collection $expenses - * @return mixed + * * @throws \League\Csv\CannotInsertRecord + * + * @return mixed */ public function exportExpenses($expenses) { @@ -101,9 +113,12 @@ class ExportService extends Service /** * Export all of the fares + * * @param Collection $fares - * @return mixed + * * @throws \League\Csv\CannotInsertRecord + * + * @return mixed */ public function exportFares($fares) { @@ -113,9 +128,12 @@ class ExportService extends Service /** * Export all of the flights + * * @param Collection $flights - * @return mixed + * * @throws \League\Csv\CannotInsertRecord + * + * @return mixed */ public function exportFlights($flights) { @@ -125,9 +143,12 @@ class ExportService extends Service /** * Export all of the flights + * * @param Collection $subfleets - * @return mixed + * * @throws \League\Csv\CannotInsertRecord + * + * @return mixed */ public function exportSubfleets($subfleets) { diff --git a/app/Services/FareService.php b/app/Services/FareService.php index 3bb51020..5bdc1cd7 100644 --- a/app/Services/FareService.php +++ b/app/Services/FareService.php @@ -13,7 +13,6 @@ use Illuminate\Support\Collection; /** * Class FareService - * @package App\Services */ class FareService extends Service { @@ -24,8 +23,10 @@ class FareService extends Service * final "authoritative" list of the fares for a flight. * * If a subfleet is passed in, + * * @param Flight|null $flight * @param Subfleet|null $subfleet + * * @return Collection */ public function getAllFares($flight, $subfleet) @@ -38,8 +39,8 @@ class FareService extends Service $subfleet_fares = $this->getForSubfleet($subfleet); - # Go through all of the fares assigned by the subfleet - # See if any of the same fares are assigned to the flight + // Go through all of the fares assigned by the subfleet + // See if any of the same fares are assigned to the flight $fares = $subfleet_fares->map(function ($fare, $idx) use ($flight_fares) { $flight_fare = $flight_fares->whereStrict('id', $fare->id)->first(); if (!$flight_fare) { @@ -54,7 +55,9 @@ class FareService extends Service /** * Get fares + * * @param $fare + * * @return mixed */ protected function getFares($fare) @@ -92,19 +95,20 @@ class FareService extends Service * @param Flight $flight * @param Fare $fare * @param array set the price/cost/capacity + * * @return Flight */ public function setForFlight(Flight $flight, Fare $fare, array $override = []): Flight { $flight->fares()->syncWithoutDetaching([$fare->id]); - foreach($override as $key => $item) { - if(!$item) { + foreach ($override as $key => $item) { + if (!$item) { unset($override[$key]); } } - # modify any pivot values? + // modify any pivot values? if (\count($override) > 0) { $flight->fares()->updateExistingPivot($fare->id, $override); } @@ -119,7 +123,9 @@ class FareService extends Service * return all the fares for a flight. check the pivot * table to see if the price/cost/capacity has been overridden * and return the correct amounts. + * * @param Flight $flight + * * @return Collection */ public function getForFlight(Flight $flight) @@ -134,6 +140,7 @@ class FareService extends Service /** * @param Flight $flight * @param Fare $fare + * * @return Flight */ public function delFareFromFlight(Flight $flight, Fare $fare) @@ -150,13 +157,14 @@ class FareService extends Service * @param Subfleet $subfleet * @param Fare $fare * @param array set the price/cost/capacity + * * @return Subfleet */ public function setForSubfleet(Subfleet $subfleet, Fare $fare, array $override = []): Subfleet { $subfleet->fares()->syncWithoutDetaching([$fare->id]); - # modify any pivot values? + // modify any pivot values? if (count($override) > 0) { $subfleet->fares()->updateExistingPivot($fare->id, $override); } @@ -171,7 +179,9 @@ class FareService extends Service * return all the fares for an aircraft. check the pivot * table to see if the price/cost/capacity has been overridden * and return the correct amounts. + * * @param Subfleet $subfleet + * * @return Collection */ public function getForSubfleet(Subfleet $subfleet) @@ -185,8 +195,10 @@ class FareService extends Service /** * Delete the fare from a subfleet + * * @param Subfleet $subfleet * @param Fare $fare + * * @return Subfleet|null|static */ public function delFareFromSubfleet(Subfleet &$subfleet, Fare &$fare) @@ -200,7 +212,9 @@ class FareService extends Service /** * Get the fares for a PIREP, this just returns the PirepFare * model which includes the counts for that particular fare + * * @param Pirep $pirep + * * @return Collection */ public function getForPirep(Pirep $pirep) @@ -213,8 +227,10 @@ class FareService extends Service /** * Save the list of fares + * * @param Pirep $pirep * @param array $fares ['fare_id', 'count'] + * * @throws \Exception */ public function saveForPirep(Pirep $pirep, array $fares) @@ -223,13 +239,13 @@ class FareService extends Service return; } - # Remove all the previous fares + // Remove all the previous fares PirepFare::where('pirep_id', $pirep->id)->delete(); - # Add them in + // Add them in foreach ($fares as $fare) { $fare['pirep_id'] = $pirep->id; - # other fields: ['fare_id', 'count'] + // other fields: ['fare_id', 'count'] $field = new PirepFare($fare); $field->save(); diff --git a/app/Services/FileService.php b/app/Services/FileService.php index 02f7322d..46a8730e 100644 --- a/app/Services/FileService.php +++ b/app/Services/FileService.php @@ -7,17 +7,19 @@ use App\Models\File; /** * Class FileService - * @package App\Services */ class FileService extends Service { /** * Save a file to disk and return a File asset + * * @param \Illuminate\Http\UploadedFile $file * @param string $folder * @param array $attrs - * @return File + * * @throws \Hashids\HashidsException + * + * @return File */ public function saveFile($file, $folder, array $attrs) { @@ -33,12 +35,12 @@ class FileService extends Service $id = File::createNewHashId(); $path_info = pathinfo($file->getClientOriginalName()); - # Create the file, add the ID to the front of the file to account - # for any duplicate filenames, but still can be found in an `ls` + // Create the file, add the ID to the front of the file to account + // for any duplicate filenames, but still can be found in an `ls` - $filename = $id . '_' - . str_slug(trim($path_info['filename'])) - . '.' . $path_info['extension']; + $filename = $id.'_' + .str_slug(trim($path_info['filename'])) + .'.'.$path_info['extension']; $file_path = $file->storeAs($folder, $filename, $attrs['disk']); diff --git a/app/Services/Finance/PirepFinanceService.php b/app/Services/Finance/PirepFinanceService.php index 66b20531..e4169e92 100644 --- a/app/Services/Finance/PirepFinanceService.php +++ b/app/Services/Finance/PirepFinanceService.php @@ -18,18 +18,17 @@ use Log; /** * Class FinanceService - * @package App\Services - * */ class PirepFinanceService extends Service { - private $expenseRepo, - $fareSvc, - $journalRepo, - $pirepSvc; + private $expenseRepo; + private $fareSvc; + private $journalRepo; + private $pirepSvc; /** * FinanceService constructor. + * * @param ExpenseRepository $expenseRepo * @param FareService $fareSvc * @param JournalRepository $journalRepo @@ -40,8 +39,7 @@ class PirepFinanceService extends Service FareService $fareSvc, JournalRepository $journalRepo, PirepService $pirepSvc - ) - { + ) { $this->expenseRepo = $expenseRepo; $this->fareSvc = $fareSvc; $this->journalRepo = $journalRepo; @@ -51,12 +49,15 @@ class PirepFinanceService extends Service /** * Process all of the finances for a pilot report. This is called * from a listener (FinanceEvents) + * * @param Pirep $pirep - * @return mixed + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException * @throws \Exception + * + * @return mixed */ public function processFinancesForPirep(Pirep $pirep) { @@ -68,12 +69,12 @@ class PirepFinanceService extends Service $pirep->user->journal = $pirep->user->initJournal(config('phpvms.currency')); } - # Clean out the expenses first + // Clean out the expenses first $this->deleteFinancesForPirep($pirep); Log::info('Finance: Starting PIREP pay for '.$pirep->id); - # Now start and pay from scratch + // Now start and pay from scratch $this->payFaresForPirep($pirep); $this->payExpensesForSubfleet($pirep); $this->payExpensesForPirep($pirep); @@ -102,7 +103,9 @@ class PirepFinanceService extends Service /** * Collect all of the fares and then post each fare class's profit and * the costs for each seat and post it to the journal + * * @param $pirep + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException @@ -137,7 +140,9 @@ class PirepFinanceService extends Service /** * Calculate what the cost is for the operating an aircraft * in this subfleet, as-per the block time + * * @param Pirep $pirep + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException @@ -146,18 +151,18 @@ class PirepFinanceService extends Service { $sf = $pirep->aircraft->subfleet; - # Haven't entered a cost + // Haven't entered a cost if (!filled($sf->cost_block_hour)) { return; } - # Convert to cost per-minute + // Convert to cost per-minute $cost_per_min = round($sf->cost_block_hour / 60, 2); - # Time to use - use the block time if it's there, actual - # flight time if that hasn't been used + // Time to use - use the block time if it's there, actual + // flight time if that hasn't been used $block_time = $pirep->block_time; - if(!filled($block_time)) { + if (!filled($block_time)) { Log::info('Finance: No block time, using PIREP flight time'); $block_time = $pirep->flight_time; } @@ -179,7 +184,9 @@ class PirepFinanceService extends Service /** * Collect all of the expenses and apply those to the journal + * * @param Pirep $pirep + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException */ @@ -190,7 +197,7 @@ class PirepFinanceService extends Service $pirep->airline_id ); - /** + /* * Go through the expenses and apply a mulitplier if present */ $expenses->map(function ($expense, $i) use ($pirep) { @@ -200,16 +207,16 @@ class PirepFinanceService extends Service Log::info('Finance: PIREP: '.$pirep->id.', expense:', $expense->toArray()); - # Get the transaction group name from the ref_model name - # This way it can be more dynamic and don't have to add special - # tables or specific expense calls to accomodate all of these + // Get the transaction group name from the ref_model name + // This way it can be more dynamic and don't have to add special + // tables or specific expense calls to accomodate all of these $klass = 'Expense'; if ($expense->ref_model) { $ref = explode('\\', $expense->ref_model); $klass = end($ref); } - # Form the memo, with some specific ones depending on the group + // Form the memo, with some specific ones depending on the group if ($klass === 'Airport') { $memo = "Airport Expense: {$expense->name} ({$expense->ref_model_id})"; $transaction_group = "Airport: {$expense->ref_model_id}"; @@ -227,8 +234,8 @@ class PirepFinanceService extends Service $debit = Money::createFromAmount($expense->amount); - # If the expense is marked to charge it to a user (only applicable to Flight) - # then change the journal to the user's to debit there + // If the expense is marked to charge it to a user (only applicable to Flight) + // then change the journal to the user's to debit there $journal = $pirep->airline->journal; if ($expense->charge_to_user) { $journal = $pirep->user->journal; @@ -249,7 +256,9 @@ class PirepFinanceService extends Service /** * Collect all of the expenses from the listeners and apply those to the journal + * * @param Pirep $pirep + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException @@ -270,7 +279,7 @@ class PirepFinanceService extends Service } foreach ($event_expense as $expense) { - # Make sure it's of type expense Model + // Make sure it's of type expense Model if (!($expense instanceof Expense)) { continue; } @@ -278,8 +287,8 @@ class PirepFinanceService extends Service Log::info('Finance: Expense from listener, N="' .$expense->name.'", A='.$expense->amount); - # If an airline_id is filled, then see if it matches - if(filled($expense->airline_id) && $expense->airline_id !== $pirep->airline_id) { + // If an airline_id is filled, then see if it matches + 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'); continue; } @@ -302,7 +311,9 @@ class PirepFinanceService extends Service /** * Collect and apply the ground handling cost + * * @param Pirep $pirep + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException @@ -326,7 +337,9 @@ class PirepFinanceService extends Service /** * Figure out what the pilot pay is. Debit it from the airline journal * But also reference the PIREP + * * @param Pirep $pirep + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException @@ -373,12 +386,14 @@ class PirepFinanceService extends Service * capacity = max number of pax units * * If count > capacity, count will be adjusted to capacity + * * @param $pirep + * * @return \Illuminate\Support\Collection */ public function getReconciledFaresForPirep($pirep) { - # Collect all of the fares and prices + // Collect all of the fares and prices $flight_fares = $this->fareSvc->getForPirep($pirep); Log::info('Finance: PIREP: '.$pirep->id.', flight fares: ', $flight_fares->toArray()); @@ -392,8 +407,8 @@ class PirepFinanceService extends Service if ($fare_count) { Log::info('Finance: PIREP: '.$pirep->id.', fare count: '.$fare_count); - # If the count is greater than capacity, then just set it - # to the maximum amount + // If the count is greater than capacity, then just set it + // to the maximum amount if ($fare_count->count > $fare->capacity) { $fare->count = $fare->capacity; } else { @@ -412,7 +427,9 @@ class PirepFinanceService extends Service /** * Return the costs for the ground handling, with the multiplier * being applied from the subfleet + * * @param Pirep $pirep + * * @return float|null */ public function getGroundHandlingCost(Pirep $pirep) @@ -432,17 +449,20 @@ class PirepFinanceService extends Service /** * Return the pilot's hourly pay for the given PIREP + * * @param Pirep $pirep - * @return float + * * @throws \InvalidArgumentException + * + * @return float */ public function getPilotPayRateForPirep(Pirep $pirep) { - # Get the base rate for the rank + // Get the base rate for the rank $rank = $pirep->user->rank; $subfleet_id = $pirep->aircraft->subfleet_id; - # find the right subfleet + // find the right subfleet $override_rate = $rank->subfleets() ->where('subfleet_id', $subfleet_id) ->first(); @@ -477,10 +497,13 @@ class PirepFinanceService extends Service /** * Get the user's payment amount for a PIREP + * * @param Pirep $pirep - * @return Money + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException + * + * @return Money */ public function getPilotPay(Pirep $pirep) { diff --git a/app/Services/Finance/RecurringFinanceService.php b/app/Services/Finance/RecurringFinanceService.php index 9da71f37..894a0b40 100644 --- a/app/Services/Finance/RecurringFinanceService.php +++ b/app/Services/Finance/RecurringFinanceService.php @@ -13,7 +13,6 @@ use Log; /** * Process all of the daily expenses and charge them - * @package App\Services\Finance */ class RecurringFinanceService extends Service { @@ -21,6 +20,7 @@ class RecurringFinanceService extends Service /** * RecurringFinanceService constructor. + * * @param JournalRepository $journalRepo */ public function __construct(JournalRepository $journalRepo) @@ -31,7 +31,9 @@ class RecurringFinanceService extends Service /** * Determine the journal to charge to, otherwise, it's charged * to every airline journal + * * @param Expense $expense + * * @return \Generator */ protected function findJournals(Expense $expense) @@ -51,7 +53,9 @@ class RecurringFinanceService extends Service /** * Get the name of the transaction group from the expense + * * @param Expense $expense + * * @return array */ protected function getMemoAndGroup(Expense $expense): array @@ -82,7 +86,9 @@ class RecurringFinanceService extends Service /** * Run all of the daily expense/financials + * * @param int $type + * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException @@ -102,13 +108,13 @@ class RecurringFinanceService extends Service * @var $expenses Expense[] */ foreach ($expenses as $expense) { - # Apply the expenses to the appropriate journals + // Apply the expenses to the appropriate journals $journals = $this->findJournals($expense); foreach ($journals as $journal) { $amount = $expense->amount; - # Has this expense already been charged? Check - # against this specific journal, on today + // Has this expense already been charged? Check + // against this specific journal, on today $w = [ 'journal_id' => $journal->id, 'ref_model' => Expense::class, diff --git a/app/Services/FleetService.php b/app/Services/FleetService.php index f56e6021..659f5c17 100644 --- a/app/Services/FleetService.php +++ b/app/Services/FleetService.php @@ -9,7 +9,6 @@ use App\Models\Subfleet; /** * Class FleetService - * @package App\Services */ class FleetService extends Service { @@ -17,6 +16,7 @@ class FleetService extends Service * @param Subfleet $subfleet * @param Rank $rank * @param array $overrides + * * @return Subfleet */ public function addSubfleetToRank(Subfleet $subfleet, Rank $rank, array $overrides = []) @@ -45,6 +45,7 @@ class FleetService extends Service /** * Add the subfleet to a flight + * * @param Subfleet $subfleet * @param Flight $flight */ @@ -57,6 +58,7 @@ class FleetService extends Service /** * Remove the subfleet from a flight + * * @param Subfleet $subfleet * @param Flight $flight */ diff --git a/app/Services/FlightService.php b/app/Services/FlightService.php index 2dc213e3..89f75faf 100644 --- a/app/Services/FlightService.php +++ b/app/Services/FlightService.php @@ -14,17 +14,17 @@ use Log; /** * Class FlightService - * @package App\Services */ class FlightService extends Service { - private $fareSvc, - $flightRepo, - $navDataRepo, - $userSvc; + private $fareSvc; + private $flightRepo; + private $navDataRepo; + private $userSvc; /** * FlightService constructor. + * * @param FareService $fareSvc * @param FlightRepository $flightRepo * @param NavdataRepository $navdataRepo @@ -35,8 +35,7 @@ class FlightService extends Service FlightRepository $flightRepo, NavdataRepository $navdataRepo, UserService $userSvc - ) - { + ) { $this->fareSvc = $fareSvc; $this->flightRepo = $flightRepo; $this->navDataRepo = $navdataRepo; @@ -45,7 +44,9 @@ class FlightService extends Service /** * Filter out any flights according to different settings + * * @param $user + * * @return FlightRepository */ public function filterFlights($user) @@ -61,15 +62,17 @@ class FlightService extends Service /** * Filter out subfleets to only include aircraft that a user has access to + * * @param $user * @param $flight + * * @return mixed */ public function filterSubfleets($user, $flight) { $subfleets = $flight->subfleets; - /** + /* * Only allow aircraft that the user has access to in their rank */ if (setting('pireps.restrict_aircraft_to_rank', false)) { @@ -81,7 +84,7 @@ class FlightService extends Service }); } - /** + /* * Only allow aircraft that are at the current departure airport */ if (setting('pireps.only_aircraft_at_dpt_airport', false)) { @@ -103,7 +106,9 @@ class FlightService extends Service /** * Check if this flight has a duplicate already + * * @param Flight $flight + * * @return bool */ public function isFlightDuplicate(Flight $flight) @@ -140,7 +145,9 @@ class FlightService extends Service /** * Delete a flight, and all the user bids, etc associated with it + * * @param Flight $flight + * * @throws \Exception */ public function deleteFlight(Flight $flight): void @@ -152,6 +159,7 @@ class FlightService extends Service /** * Update any custom PIREP fields + * * @param Flight $flight * @param array $field_values */ @@ -164,7 +172,7 @@ class FlightService extends Service 'name' => $fv['name'], ], [ - 'value' => $fv['value'] + 'value' => $fv['value'], ] ); } @@ -172,7 +180,9 @@ class FlightService extends Service /** * Return all of the navaid points as a collection + * * @param Flight $flight + * * @return \Illuminate\Support\Collection */ public function getRoute(Flight $flight) @@ -198,30 +208,33 @@ class FlightService extends Service /** * Allow a user to bid on a flight. Check settings and all that good stuff + * * @param Flight $flight * @param User $user - * @return mixed + * * @throws \App\Exceptions\BidExists + * + * @return mixed */ public function addBid(Flight $flight, User $user) { - # Get all of the bids for this user. See if they're allowed to have multiple - # bids + // Get all of the bids for this user. See if they're allowed to have multiple + // bids $bids = Bid::where('user_id', $user->id)->get(); if ($bids->count() > 0 && setting('bids.allow_multiple_bids') === false) { throw new BidExists('User "'.$user->ident.'" already has bids, skipping'); } - # Get all of the bids for this flight + // Get all of the bids for this flight $bids = Bid::where('flight_id', $flight->id)->get(); if ($bids->count() > 0) { - # Does the flight have a bid set? + // Does the flight have a bid set? if ($flight->has_bid === false) { $flight->has_bid = true; $flight->save(); } - # Check all the bids for one of this user + // Check all the bids for one of this user foreach ($bids as $bid) { if ($bid->user_id === $user->id) { Log::info('Bid exists, user='.$user->ident.', flight='.$flight->id); @@ -229,7 +242,7 @@ class FlightService extends Service } } - # Check if the flight should be blocked off + // Check if the flight should be blocked off if (setting('bids.disable_flight_on_bid') === true) { throw new BidExists('Flight "'.$flight->ident.'" already has a bid, skipping'); } @@ -256,6 +269,7 @@ class FlightService extends Service /** * Remove a bid from a given flight + * * @param Flight $flight * @param User $user */ @@ -263,14 +277,14 @@ class FlightService extends Service { $bids = Bid::where([ 'flight_id' => $flight->id, - 'user_id' => $user->id + 'user_id' => $user->id, ])->get(); foreach ($bids as $bid) { $bid->forceDelete(); } - # Only flip the flag if there are no bids left for this flight + // Only flip the flag if there are no bids left for this flight $bids = Bid::where('flight_id', $flight->id)->get(); if ($bids->count() === 0) { $flight->has_bid = false; diff --git a/app/Services/GeoService.php b/app/Services/GeoService.php index 2ca39cca..cb8cca6b 100644 --- a/app/Services/GeoService.php +++ b/app/Services/GeoService.php @@ -18,14 +18,15 @@ use Log; /** * Class GeoService - * @package App\Services */ class GeoService extends Service { - private $acarsRepo, $navRepo; + private $acarsRepo; + private $navRepo; /** * GeoService constructor. + * * @param AcarsRepository $acarsRepo * @param NavdataRepository $navRepo */ @@ -39,10 +40,13 @@ class GeoService extends Service /** * Determine the closest set of coordinates from the starting position + * * @param array $coordStart * @param array $all_coords - * @return mixed + * * @throws \League\Geotools\Exception\InvalidArgumentException + * + * @return mixed */ public function getClosestCoords($coordStart, $all_coords) { @@ -66,10 +70,12 @@ class GeoService extends Service * Pass in a route string, with the departure/arrival airports, and the * starting coordinates. Return the route points that have been found * from the `navdata` table + * * @param $dep_icao string ICAO to ignore * @param $arr_icao string ICAO to ignore * @param $start_coords array Starting point, [x, y] * @param $route string Textual route + * * @return array */ public function getCoordsFromRoute($dep_icao, $arr_icao, $start_coords, $route): array @@ -114,12 +120,12 @@ class GeoService extends Service continue; } - # Find the point with the shortest distance + // Find the point with the shortest distance Log::info('found '.$size.' for '.$route_point); - # Get the start point and then reverse the lat/lon reference - # If the first point happens to have multiple possibilities, use - # the starting point that was passed in + // Get the start point and then reverse the lat/lon reference + // If the first point happens to have multiple possibilities, use + // the starting point that was passed in if (\count($coords) > 0) { $start_point = $coords[\count($coords) - 1]; $start_point = [$start_point->lat, $start_point->lon]; @@ -127,14 +133,14 @@ class GeoService extends Service $start_point = $start_coords; } - # Put all of the lat/lon sets into an array to pick of what's clsest - # to the starting point + // Put all of the lat/lon sets into an array to pick of what's clsest + // to the starting point $potential_coords = []; foreach ($points as $point) { $potential_coords[] = [$point->lat, $point->lon]; } - # returns an array with the closest lat/lon to start point + // returns an array with the closest lat/lon to start point $closest_coords = $this->getClosestCoords($start_point, $potential_coords); foreach ($points as $point) { if ($point->lat === $closest_coords[0] && $point->lon === $closest_coords[1]) { @@ -150,12 +156,15 @@ class GeoService extends Service /** * Determine the center point between two sets of coordinates + * * @param $latA * @param $lonA * @param $latB * @param $lonB - * @return array + * * @throws \League\Geotools\Exception\InvalidArgumentException + * + * @return array */ public function getCenter($latA, $lonA, $latB, $lonB) { @@ -168,7 +177,7 @@ class GeoService extends Service $center = [ $middlePoint->getLatitude(), - $middlePoint->getLongitude() + $middlePoint->getLongitude(), ]; return $center; @@ -176,7 +185,9 @@ class GeoService extends Service /** * Read an array/relationship of ACARS model points + * * @param Pirep $pirep + * * @return array */ public function getFeatureFromAcars(Pirep $pirep) @@ -206,7 +217,7 @@ class GeoService extends Service ]); } - /** + /* * @var $point \App\Models\Acars */ /*foreach ($pirep->acars as $point) { @@ -226,20 +237,22 @@ class GeoService extends Service 'airports' => [ 'a' => [ 'icao' => $pirep->arr_airport->icao, - 'lat' => $pirep->arr_airport->lat, - 'lon' => $pirep->arr_airport->lon, + 'lat' => $pirep->arr_airport->lat, + 'lon' => $pirep->arr_airport->lon, ], 'd' => [ 'icao' => $pirep->dpt_airport->icao, - 'lat' => $pirep->dpt_airport->lat, - 'lon' => $pirep->dpt_airport->lon, + 'lat' => $pirep->dpt_airport->lat, + 'lon' => $pirep->dpt_airport->lon, ], - ] + ], ]; } /** * Return a single feature point for the + * + * @param mixed $pireps */ public function getFeatureForLiveFlights($pireps) { @@ -269,14 +282,16 @@ class GeoService extends Service /** * Return a FeatureCollection GeoJSON object + * * @param Flight $flight + * * @return array */ public function flightGeoJson(Flight $flight): array { $route = new GeoJson(); - ## Departure Airport + //# Departure Airport $route->addPoint($flight->dpt_airport->lat, $flight->dpt_airport->lon, [ 'name' => $flight->dpt_airport->icao, 'popup' => $flight->dpt_airport->full_name, @@ -295,7 +310,7 @@ class GeoService extends Service $route->addPoint($point->lat, $point->lon, [ 'name' => $point->name, 'popup' => $point->name.' ('.$point->name.')', - 'icon' => '' + 'icon' => '', ]); } } @@ -314,7 +329,9 @@ class GeoService extends Service /** * Return a GeoJSON FeatureCollection for a PIREP + * * @param Pirep $pirep + * * @return array */ public function pirepGeoJson(Pirep $pirep) @@ -322,7 +339,7 @@ class GeoService extends Service $planned = new GeoJson(); $actual = new GeoJson(); - /** + /* * PLANNED ROUTE */ $planned->addPoint($pirep->dpt_airport->lat, $pirep->dpt_airport->lon, [ diff --git a/app/Services/ImportExport/AircraftExporter.php b/app/Services/ImportExport/AircraftExporter.php index deb55062..554e7d4e 100644 --- a/app/Services/ImportExport/AircraftExporter.php +++ b/app/Services/ImportExport/AircraftExporter.php @@ -4,13 +4,10 @@ namespace App\Services\ImportExport; use App\Interfaces\ImportExport; use App\Models\Aircraft; -use App\Models\Enums\AircraftStatus; use App\Models\Flight; /** * The flight importer can be imported or export. Operates on rows - * - * @package App\Services\Import */ class AircraftExporter extends ImportExport { @@ -26,17 +23,19 @@ class AircraftExporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param Aircraft $aircraft + * * @return array */ public function export($aircraft): array { $ret = []; - foreach(self::$columns as $column) { + foreach (self::$columns as $column) { $ret[$column] = $aircraft->{$column}; } - # Modify special fields + // Modify special fields $ret['subfleet'] = $aircraft->subfleet->type; return $ret; diff --git a/app/Services/ImportExport/AircraftImporter.php b/app/Services/ImportExport/AircraftImporter.php index 2e06dee4..24d66b55 100644 --- a/app/Services/ImportExport/AircraftImporter.php +++ b/app/Services/ImportExport/AircraftImporter.php @@ -11,7 +11,6 @@ use App\Support\ICAO; /** * Import aircraft - * @package App\Services\Import */ class AircraftImporter extends ImportExport { @@ -34,7 +33,9 @@ class AircraftImporter extends ImportExport /** * Find the subfleet specified, or just create it on the fly + * * @param $type + * * @return Subfleet|\Illuminate\Database\Eloquent\Model|null|object|static */ protected function getSubfleet($type) @@ -48,8 +49,10 @@ class AircraftImporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param array $row * @param int $index + * * @return bool */ public function import(array $row, $index): bool @@ -57,28 +60,28 @@ class AircraftImporter extends ImportExport $subfleet = $this->getSubfleet($row['subfleet']); $row['subfleet_id'] = $subfleet->id; - # Generate a hex code - if(!$row['hex_code']) { + // Generate a hex code + if (!$row['hex_code']) { $row['hex_code'] = ICAO::createHexCode(); } - # Set a default status + // Set a default status $row['status'] = trim($row['status']); - if($row['status'] === null || $row['status'] === '') { + if ($row['status'] === null || $row['status'] === '') { $row['status'] = AircraftStatus::ACTIVE; } - # Just set its state right now as parked + // Just set its state right now as parked $row['state'] = AircraftState::PARKED; - # Try to add or update + // Try to add or update $aircraft = Aircraft::firstOrNew([ 'registration' => $row['registration'], ], $row); try { $aircraft->save(); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->errorLog('Error in row '.$index.': '.$e->getMessage()); return false; } diff --git a/app/Services/ImportExport/AirportExporter.php b/app/Services/ImportExport/AirportExporter.php index 0c1e9952..4b36f6c6 100644 --- a/app/Services/ImportExport/AirportExporter.php +++ b/app/Services/ImportExport/AirportExporter.php @@ -7,8 +7,6 @@ use App\Models\Airport; /** * The flight importer can be imported or export. Operates on rows - * - * @package App\Services\Import */ class AirportExporter extends ImportExport { @@ -24,13 +22,15 @@ class AirportExporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param Airport $airport + * * @return array */ public function export($airport): array { $ret = []; - foreach(self::$columns as $column) { + foreach (self::$columns as $column) { $ret[$column] = $airport->{$column}; } diff --git a/app/Services/ImportExport/AirportImporter.php b/app/Services/ImportExport/AirportImporter.php index 7a00af1f..765f72f3 100644 --- a/app/Services/ImportExport/AirportImporter.php +++ b/app/Services/ImportExport/AirportImporter.php @@ -7,7 +7,6 @@ use App\Models\Airport; /** * Import airports - * @package App\Services\Import */ class AirportImporter extends ImportExport { @@ -35,8 +34,10 @@ class AirportImporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param array $row * @param int $index + * * @return bool */ public function import(array $row, $index): bool @@ -45,7 +46,7 @@ class AirportImporter extends ImportExport $row['hub'] = get_truth_state($row['hub']); $airport = Airport::firstOrNew([ - 'id' => $row['icao'] + 'id' => $row['icao'], ], $row); try { diff --git a/app/Services/ImportExport/ExpenseExporter.php b/app/Services/ImportExport/ExpenseExporter.php index f9c95f2b..4b3ad9ed 100644 --- a/app/Services/ImportExport/ExpenseExporter.php +++ b/app/Services/ImportExport/ExpenseExporter.php @@ -5,13 +5,11 @@ namespace App\Services\ImportExport; use App\Interfaces\ImportExport; use App\Models\Aircraft; use App\Models\Airport; -use App\Models\Enums\ExpenseType; use App\Models\Expense; use App\Models\Subfleet; /** * Import expenses - * @package App\Services\Import */ class ExpenseExporter extends ImportExport { @@ -27,20 +25,22 @@ class ExpenseExporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param Expense $expense + * * @return array */ public function export($expense): array { $ret = []; - foreach(self::$columns as $col) { + foreach (self::$columns as $col) { $ret[$col] = $expense->{$col}; } // Special fields - if($ret['airline']) { + if ($ret['airline']) { $ret['airline'] = $expense->airline->icao; } @@ -51,7 +51,7 @@ class ExpenseExporter extends ImportExport $ret['ref_model_id'] = ''; } else { $obj = $expense->getReferencedObject(); - if(!$obj) { // bail out + if (!$obj) { // bail out return $ret; } diff --git a/app/Services/ImportExport/ExpenseImporter.php b/app/Services/ImportExport/ExpenseImporter.php index 2f84ed34..3599e74a 100644 --- a/app/Services/ImportExport/ExpenseImporter.php +++ b/app/Services/ImportExport/ExpenseImporter.php @@ -5,14 +5,12 @@ namespace App\Services\ImportExport; use App\Interfaces\ImportExport; use App\Models\Aircraft; use App\Models\Airport; -use App\Models\Enums\ExpenseType; use App\Models\Expense; use App\Models\Subfleet; use Log; /** * Import expenses - * @package App\Services\Import */ class ExpenseImporter extends ImportExport { @@ -36,20 +34,22 @@ class ExpenseImporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param array $row * @param int $index + * * @return bool */ public function import(array $row, $index): bool { - if($row['airline']) { + if ($row['airline']) { $row['airline_id'] = $this->getAirline($row['airline'])->id; } - # Figure out what this is referring to + // Figure out what this is referring to $row = $this->getRefClassInfo($row); - if(!$row['active']) { + if (!$row['active']) { $row['active'] = true; } @@ -70,7 +70,9 @@ class ExpenseImporter extends ImportExport /** * See if this expense refers to a ref_model + * * @param array $row + * * @return array */ protected function getRefClassInfo(array $row) @@ -93,19 +95,19 @@ class ExpenseImporter extends ImportExport $obj = null; if ($class === Aircraft::class) { - Log::info('Trying to import expense on aircraft, registration: ' . $id); + Log::info('Trying to import expense on aircraft, registration: '.$id); $obj = Aircraft::where('registration', $id)->first(); } elseif ($class === Airport::class) { - Log::info('Trying to import expense on airport, icao: ' . $id); + Log::info('Trying to import expense on airport, icao: '.$id); $obj = Airport::where('icao', $id)->first(); } elseif ($class === Subfleet::class) { - Log::info('Trying to import expense on subfleet, type: ' . $id); + Log::info('Trying to import expense on subfleet, type: '.$id); $obj = Subfleet::where('type', $id)->first(); } else { $this->errorLog('Unknown/unsupported Expense class: '.$class); } - if(!$obj) { + if (!$obj) { return $row; } diff --git a/app/Services/ImportExport/FareExporter.php b/app/Services/ImportExport/FareExporter.php index 25d278d4..38f42de2 100644 --- a/app/Services/ImportExport/FareExporter.php +++ b/app/Services/ImportExport/FareExporter.php @@ -7,8 +7,6 @@ use App\Models\Fare; /** * The flight importer can be imported or export. Operates on rows - * - * @package App\Services\Import */ class FareExporter extends ImportExport { @@ -24,13 +22,15 @@ class FareExporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param Fare $fare + * * @return array */ public function export($fare): array { $ret = []; - foreach(self::$columns as $column) { + foreach (self::$columns as $column) { $ret[$column] = $fare->{$column}; } diff --git a/app/Services/ImportExport/FareImporter.php b/app/Services/ImportExport/FareImporter.php index 843a58b5..96e33192 100644 --- a/app/Services/ImportExport/FareImporter.php +++ b/app/Services/ImportExport/FareImporter.php @@ -7,7 +7,6 @@ use App\Models\Fare; /** * Import aircraft - * @package App\Services\Import */ class FareImporter extends ImportExport { @@ -29,20 +28,22 @@ class FareImporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param array $row * @param int $index + * * @return bool */ public function import(array $row, $index): bool { - # Try to add or update + // Try to add or update $fare = Fare::firstOrNew([ 'code' => $row['code'], ], $row); try { $fare->save(); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->errorLog('Error in row '.$index.': '.$e->getMessage()); return false; } diff --git a/app/Services/ImportExport/FlightExporter.php b/app/Services/ImportExport/FlightExporter.php index de53decc..4b01bc83 100644 --- a/app/Services/ImportExport/FlightExporter.php +++ b/app/Services/ImportExport/FlightExporter.php @@ -8,8 +8,6 @@ use App\Models\Flight; /** * The flight importer can be imported or export. Operates on rows - * - * @package App\Services\Import */ class FlightExporter extends ImportExport { @@ -25,23 +23,25 @@ class FlightExporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param Flight $flight + * * @return array */ public function export($flight): array { $ret = []; - foreach(self::$columns as $column) { + foreach (self::$columns as $column) { $ret[$column] = $flight->{$column}; } - # Modify special fields + // Modify special fields $ret['airline'] = $ret['airline']->icao; $ret['distance'] = $ret['distance'][config('phpvms.internal_units.distance')]; $ret['dpt_airport'] = $flight->dpt_airport_id; $ret['arr_airport'] = $flight->arr_airport_id; - if($flight->alt_airport) { + if ($flight->alt_airport) { $ret['alt_airport'] = $flight->alt_airport_id; } @@ -56,14 +56,16 @@ class FlightExporter extends ImportExport /** * Return the days string + * * @param Flight $flight + * * @return string */ protected function getDays(Flight &$flight) { $days_str = ''; - if($flight->on_day(Days::MONDAY)) { + if ($flight->on_day(Days::MONDAY)) { $days_str .= '1'; } @@ -96,15 +98,17 @@ class FlightExporter extends ImportExport /** * Return any custom fares that have been made to this flight + * * @param Flight $flight + * * @return string */ protected function getFares(Flight &$flight): string { $fares = []; - foreach($flight->fares as $fare) { + foreach ($flight->fares as $fare) { $fare_export = []; - if($fare->pivot->price) { + if ($fare->pivot->price) { $fare_export['price'] = $fare->pivot->price; } @@ -124,7 +128,9 @@ class FlightExporter extends ImportExport /** * Parse all of the subfields + * * @param Flight $flight + * * @return string */ protected function getFields(Flight &$flight): string @@ -139,13 +145,15 @@ class FlightExporter extends ImportExport /** * Create the list of subfleets that are associated here + * * @param Flight $flight + * * @return string */ protected function getSubfleets(Flight &$flight): string { $subfleets = []; - foreach($flight->subfleets as $subfleet) { + foreach ($flight->subfleets as $subfleet) { $subfleets[] = $subfleet->type; } diff --git a/app/Services/ImportExport/FlightImporter.php b/app/Services/ImportExport/FlightImporter.php index 086578aa..8b8527be 100644 --- a/app/Services/ImportExport/FlightImporter.php +++ b/app/Services/ImportExport/FlightImporter.php @@ -15,8 +15,6 @@ use Log; /** * The flight importer can be imported or export. Operates on rows - * - * @package App\Services\Import */ class FlightImporter extends ImportExport { @@ -49,11 +47,9 @@ class FlightImporter extends ImportExport 'fields' => 'nullable', ]; - /** - * - */ - private $fareSvc, - $flightSvc; + private $fareSvc; + + private $flightSvc; /** * FlightImportExporter constructor. @@ -66,8 +62,10 @@ class FlightImporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param array $row * @param int $index + * * @return bool */ public function import(array $row, $index): bool @@ -108,7 +106,7 @@ class FlightImporter extends ImportExport // Check for a valid value $flight_type = $row['flight_type']; - if(!array_key_exists($flight_type, FlightType::labels())) { + if (!array_key_exists($flight_type, FlightType::labels())) { $flight_type = 'J'; } @@ -139,17 +137,19 @@ class FlightImporter extends ImportExport /** * Return the mask of the days + * * @param $day_str + * * @return int|mixed */ protected function setDays($day_str) { - if(!$day_str) { + if (!$day_str) { return 0; } $days = []; - if(strpos($day_str, '1') !== false) { + if (strpos($day_str, '1') !== false) { $days[] = Days::MONDAY; } @@ -182,7 +182,9 @@ class FlightImporter extends ImportExport /** * Process the airport + * * @param $airport + * * @return \Illuminate\Database\Eloquent\Model */ protected function processAirport($airport) @@ -195,6 +197,7 @@ class FlightImporter extends ImportExport /** * Parse out all of the subfleets and associate them to the flight * The subfleet is created if it doesn't exist + * * @param Flight $flight * @param $col */ @@ -202,7 +205,7 @@ class FlightImporter extends ImportExport { $count = 0; $subfleets = $this->parseMultiColumnValues($col); - foreach($subfleets as $subfleet_type) { + foreach ($subfleets as $subfleet_type) { $subfleet = Subfleet::firstOrCreate( ['type' => $subfleet_type], ['name' => $subfleet_type] @@ -210,9 +213,9 @@ class FlightImporter extends ImportExport $subfleet->save(); - # sync + // sync $flight->subfleets()->syncWithoutDetaching([$subfleet->id]); - $count ++; + $count++; } Log::info('Subfleets added/processed: '.$count); @@ -220,6 +223,7 @@ class FlightImporter extends ImportExport /** * Parse all of the fares in the multi-format + * * @param Flight $flight * @param $col */ @@ -239,6 +243,7 @@ class FlightImporter extends ImportExport /** * Parse all of the subfields + * * @param Flight $flight * @param $col */ @@ -246,9 +251,9 @@ class FlightImporter extends ImportExport { $pass_fields = []; $fields = $this->parseMultiColumnValues($col); - foreach($fields as $field_name => $field_value) { + foreach ($fields as $field_name => $field_value) { $pass_fields[] = [ - 'name' => $field_name, + 'name' => $field_name, 'value' => $field_value, ]; } diff --git a/app/Services/ImportExport/SubfleetExporter.php b/app/Services/ImportExport/SubfleetExporter.php index d38d80e2..9967ebdd 100644 --- a/app/Services/ImportExport/SubfleetExporter.php +++ b/app/Services/ImportExport/SubfleetExporter.php @@ -3,14 +3,11 @@ namespace App\Services\ImportExport; use App\Interfaces\ImportExport; -use App\Models\Enums\FlightType; use App\Models\Flight; use App\Models\Subfleet; /** * The flight importer can be imported or export. Operates on rows - * - * @package App\Services\Import */ class SubfleetExporter extends ImportExport { @@ -26,17 +23,19 @@ class SubfleetExporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param Subfleet $subfleet + * * @return array */ public function export($subfleet): array { $ret = []; - foreach(self::$columns as $column) { + foreach (self::$columns as $column) { $ret[$column] = $subfleet->{$column}; } - # Modify special fields + // Modify special fields $ret['airline'] = $subfleet->airline->icao; $ret['fares'] = $this->getFares($subfleet); @@ -45,15 +44,17 @@ class SubfleetExporter extends ImportExport /** * Return any custom fares that have been made to this flight + * * @param Subfleet $subfleet + * * @return string */ protected function getFares(Subfleet &$subfleet): string { $fares = []; - foreach($subfleet->fares as $fare) { + foreach ($subfleet->fares as $fare) { $fare_export = []; - if($fare->pivot->price) { + if ($fare->pivot->price) { $fare_export['price'] = $fare->pivot->price; } @@ -73,7 +74,9 @@ class SubfleetExporter extends ImportExport /** * Parse all of the subfields + * * @param Flight $flight + * * @return string */ protected function getFields(Flight &$flight): string @@ -88,13 +91,15 @@ class SubfleetExporter extends ImportExport /** * Create the list of subfleets that are associated here + * * @param Flight $flight + * * @return string */ protected function getSubfleets(Flight &$flight): string { $subfleets = []; - foreach($flight->subfleets as $subfleet) { + foreach ($flight->subfleets as $subfleet) { $subfleets[] = $subfleet->type; } diff --git a/app/Services/ImportExport/SubfleetImporter.php b/app/Services/ImportExport/SubfleetImporter.php index 0d817f71..7ff486eb 100644 --- a/app/Services/ImportExport/SubfleetImporter.php +++ b/app/Services/ImportExport/SubfleetImporter.php @@ -9,7 +9,6 @@ use App\Services\FareService; /** * Import subfleets - * @package App\Services\Import */ class SubfleetImporter extends ImportExport { @@ -38,8 +37,10 @@ class SubfleetImporter extends ImportExport /** * Import a flight, parse out the different rows + * * @param array $row * @param int $index + * * @return bool */ public function import(array $row, $index): bool @@ -48,12 +49,12 @@ class SubfleetImporter extends ImportExport $row['airline_id'] = $airline->id; $subfleet = Subfleet::firstOrNew([ - 'type' => $row['type'] + 'type' => $row['type'], ], $row); try { $subfleet->save(); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->errorLog('Error in row '.$index.': '.$e->getMessage()); return false; } @@ -66,8 +67,9 @@ class SubfleetImporter extends ImportExport /** * Parse all of the fares in the multi-format + * * @param Subfleet $subfleet - * @param $col + * @param $col */ protected function processFares(Subfleet &$subfleet, $col): void { diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 50b7c876..9e74a23a 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -21,7 +21,6 @@ use Validator; /** * Class ImportService - * @package App\Services */ class ImportService extends Service { @@ -29,35 +28,42 @@ class ImportService extends Service /** * ImporterService constructor. + * * @param FlightRepository $flightRepo */ - public function __construct(FlightRepository $flightRepo) { + public function __construct(FlightRepository $flightRepo) + { $this->flightRepo = $flightRepo; } /** * Throw a validation error back up because it will automatically show * itself under the CSV file upload, and nothing special needs to be done + * * @param $error * @param $e + * * @throws ValidationException */ - protected function throwError($error, \Exception $e= null): void + protected function throwError($error, \Exception $e = null): void { Log::error($error); - if($e) { + if ($e) { Log::error($e->getMessage()); } $validator = Validator::make([], []); $validator->errors()->add('csv_file', $error); + throw new ValidationException($validator); } /** - * @param $csv_file - * @return Reader + * @param $csv_file + * * @throws ValidationException + * + * @return Reader */ public function openCsv($csv_file) { @@ -74,10 +80,13 @@ class ImportService extends Service /** * Run the actual importer, pass in one of the Import classes which implements * the ImportExport interface + * * @param $file_path * @param ImportExport $importer - * @return array + * * @throws ValidationException + * + * @return array */ protected function runImport($file_path, ImportExport $importer): array { @@ -93,7 +102,7 @@ class ImportService extends Service if ($first) { $first = false; - if($row[$first_header] !== $first_header) { + if ($row[$first_header] !== $first_header) { $this->throwError('CSV file doesn\'t seem to match import type'); } @@ -109,16 +118,16 @@ class ImportService extends Service // turn it into a collection and run some filtering $row = collect($row)->map(function ($val, $index) { $val = trim($val); - if($val === '') { - return null; + if ($val === '') { + return; } return $val; })->toArray(); - # Try to validate + // Try to validate $validator = Validator::make($row, $importer->getColumns()); - if($validator->fails()) { + if ($validator->fails()) { $errors = 'Error in row '.$offset.','.implode(';', $validator->errors()->all()); $importer->errorLog($errors); continue; @@ -132,15 +141,18 @@ class ImportService extends Service /** * Import aircraft + * * @param string $csv_file * @param bool $delete_previous - * @return mixed + * * @throws ValidationException + * + * @return mixed */ public function importAircraft($csv_file, bool $delete_previous = true) { if ($delete_previous) { - # TODO: delete airports + // TODO: delete airports } $importer = new AircraftImporter(); @@ -149,10 +161,13 @@ class ImportService extends Service /** * Import airports + * * @param string $csv_file * @param bool $delete_previous - * @return mixed + * * @throws ValidationException + * + * @return mixed */ public function importAirports($csv_file, bool $delete_previous = true) { @@ -166,10 +181,13 @@ class ImportService extends Service /** * Import expenses + * * @param string $csv_file * @param bool $delete_previous - * @return mixed + * * @throws ValidationException + * + * @return mixed */ public function importExpenses($csv_file, bool $delete_previous = true) { @@ -183,15 +201,18 @@ class ImportService extends Service /** * Import fares + * * @param string $csv_file * @param bool $delete_previous - * @return mixed + * * @throws ValidationException + * + * @return mixed */ public function importFares($csv_file, bool $delete_previous = true) { if ($delete_previous) { - # TODO: Delete all from: fares + // TODO: Delete all from: fares } $importer = new FareImporter(); @@ -200,15 +221,18 @@ class ImportService extends Service /** * Import flights + * * @param string $csv_file * @param bool $delete_previous - * @return mixed + * * @throws ValidationException + * + * @return mixed */ public function importFlights($csv_file, bool $delete_previous = true) { if ($delete_previous) { - # TODO: Delete all from: flights, flight_field_values + // TODO: Delete all from: flights, flight_field_values } $importer = new FlightImporter(); @@ -217,15 +241,18 @@ class ImportService extends Service /** * Import subfleets + * * @param string $csv_file * @param bool $delete_previous - * @return mixed + * * @throws ValidationException + * + * @return mixed */ public function importSubfleets($csv_file, bool $delete_previous = true) { if ($delete_previous) { - # TODO: Cleanup subfleet data + // TODO: Cleanup subfleet data } $importer = new SubfleetImporter(); diff --git a/app/Services/Metar/AviationWeather.php b/app/Services/Metar/AviationWeather.php index d45b57a9..092a70a5 100644 --- a/app/Services/Metar/AviationWeather.php +++ b/app/Services/Metar/AviationWeather.php @@ -8,7 +8,6 @@ use Cache; /** * Return the raw METAR string from the NOAA Aviation Weather Service - * @package App\Services\Metar */ class AviationWeather extends Metar { @@ -19,7 +18,9 @@ class AviationWeather extends Metar /** * Implement the METAR - Return the string + * * @param $icao + * * @return string */ protected function metar($icao): string @@ -29,14 +30,14 @@ class AviationWeather extends Metar config('cache.keys.WEATHER_LOOKUP.time'), function () use ($icao) { $url = static::METAR_URL.$icao; + try { $res = Http::get($url, []); $xml = simplexml_load_string($res); - if (count($xml->data->METAR->raw_text) == 0) - return ''; - else - return $xml->data->METAR->raw_text->__toString(); - + if (count($xml->data->METAR->raw_text) == 0) { + return ''; + } + return $xml->data->METAR->raw_text->__toString(); } catch (\Exception $e) { return ''; } diff --git a/app/Services/ModuleService.php b/app/Services/ModuleService.php index 9b990d7e..e57c4603 100644 --- a/app/Services/ModuleService.php +++ b/app/Services/ModuleService.php @@ -6,7 +6,6 @@ use App\Interfaces\Service; /** * Class ModuleService - * @package App\Services */ class ModuleService extends Service { @@ -17,14 +16,16 @@ class ModuleService extends Service */ protected static $frontendLinks = [ 0 => [], - 1 => [] + 1 => [], ]; /** * Add a module link in the frontend + * * @param string $title * @param string $url * @param string $icon + * @param mixed $logged_in */ public function addFrontendLink(string $title, string $url, string $icon = '', $logged_in = true) { @@ -37,6 +38,9 @@ class ModuleService extends Service /** * Get all of the frontend links + * + * @param mixed $logged_in + * * @return array */ public function getFrontendLinks($logged_in): array @@ -46,6 +50,7 @@ class ModuleService extends Service /** * Add a module link in the admin panel + * * @param string $title * @param string $url * @param string $icon @@ -55,12 +60,13 @@ class ModuleService extends Service self::$adminLinks[] = [ 'title' => $title, 'url' => $url, - 'icon' => 'pe-7s-users' + 'icon' => 'pe-7s-users', ]; } /** * Get all of the module links in the admin panel + * * @return array */ public function getAdminLinks(): array diff --git a/app/Services/PirepService.php b/app/Services/PirepService.php index cbe2780e..7e094469 100644 --- a/app/Services/PirepService.php +++ b/app/Services/PirepService.php @@ -19,9 +19,6 @@ use App\Models\Navdata; use App\Models\Pirep; use App\Models\PirepFieldValue; use App\Models\User; -use App\Repositories\AcarsRepository; -use App\Repositories\FlightRepository; -use App\Repositories\NavdataRepository; use App\Repositories\PirepRepository; use Carbon\Carbon; use Illuminate\Database\Eloquent\ModelNotFoundException; @@ -29,19 +26,19 @@ use Log; /** * Class PirepService - * @package App\Services */ class PirepService extends Service { - private $geoSvc, - $pilotSvc, - $pirepRepo; + private $geoSvc; + private $pilotSvc; + private $pirepRepo; /** * PirepService constructor. - * @param GeoService $geoSvc - * @param PirepRepository $pirepRepo - * @param UserService $pilotSvc + * + * @param GeoService $geoSvc + * @param PirepRepository $pirepRepo + * @param UserService $pilotSvc */ public function __construct( GeoService $geoSvc, @@ -56,7 +53,9 @@ class PirepService extends Service /** * Find if there are duplicates to a given PIREP. Ideally, the passed * in PIREP hasn't been saved or gone through the create() method + * * @param Pirep $pirep + * * @return bool|Pirep */ public function findDuplicate(Pirep $pirep) @@ -98,19 +97,22 @@ class PirepService extends Service * Save the route into the ACARS table with AcarsType::ROUTE * This attempts to create the route from the navdata and the route * entered into the PIREP's route field + * * @param Pirep $pirep - * @return Pirep + * * @throws \Exception + * + * @return Pirep */ public function saveRoute(Pirep $pirep): Pirep { - # Delete all the existing nav points + // Delete all the existing nav points Acars::where([ 'pirep_id' => $pirep->id, 'type' => AcarsType::ROUTE, ])->delete(); - # See if a route exists + // See if a route exists if (!filled($pirep->route)) { return $pirep; } @@ -142,7 +144,7 @@ class PirepService extends Service $acars->lon = $point->lon; $acars->save(); - ++$point_count; + $point_count++; } return $pirep; @@ -151,7 +153,7 @@ class PirepService extends Service /** * Create a new PIREP with some given fields * - * @param Pirep $pirep + * @param Pirep $pirep * @param array PirepFieldValue[] $field_values * * @return Pirep @@ -162,24 +164,24 @@ class PirepService extends Service $field_values = []; } - # Check the block times. If a block on (arrival) time isn't - # specified, then use the time that it was submitted. It won't - # be the most accurate, but that might be OK - if(!$pirep->block_on_time) { - if($pirep->submitted_at) { + // Check the block times. If a block on (arrival) time isn't + // specified, then use the time that it was submitted. It won't + // be the most accurate, but that might be OK + if (!$pirep->block_on_time) { + if ($pirep->submitted_at) { $pirep->block_on_time = $pirep->submitted_at; } else { $pirep->block_on_time = Carbon::now('UTC'); } } - # If the depart time isn't set, then try to calculate it by - # subtracting the flight time from the block_on (arrival) time - if(!$pirep->block_off_time && $pirep->flight_time > 0) { + // If the depart time isn't set, then try to calculate it by + // subtracting the flight time from the block_on (arrival) time + if (!$pirep->block_off_time && $pirep->flight_time > 0) { $pirep->block_off_time = $pirep->block_on_time->subMinutes($pirep->flight_time); } - # Check that there's a submit time + // Check that there's a submit time if (!$pirep->submitted_at) { $pirep->submitted_at = Carbon::now('UTC'); } @@ -196,12 +198,13 @@ class PirepService extends Service /** * Submit the PIREP. Figure out its default state + * * @param Pirep $pirep */ public function submit(Pirep $pirep) { - # Figure out what default state should be. Look at the default - # behavior from the rank that the pilot is assigned to + // Figure out what default state should be. Look at the default + // behavior from the rank that the pilot is assigned to $default_state = PirepState::PENDING; if ($pirep->source === PirepSource::ACARS) { if ($pirep->pilot->rank->auto_approve_acars) { @@ -220,13 +223,13 @@ class PirepService extends Service Log::info('New PIREP filed', [$pirep]); event(new PirepFiled($pirep)); - # only update the pilot last state if they are accepted + // only update the pilot last state if they are accepted if ($default_state === PirepState::ACCEPTED) { $pirep = $this->accept($pirep); $this->setPilotState($pirep->pilot, $pirep); } - # Check the user state, set them to ACTIVE if on leave + // Check the user state, set them to ACTIVE if on leave if ($pirep->user->state !== UserState::ACTIVE) { $old_state = $pirep->user->state; $pirep->user->state = UserState::ACTIVE; @@ -238,6 +241,7 @@ class PirepService extends Service /** * Update any custom PIREP fields + * * @param $pirep_id * @param array $field_values */ @@ -246,10 +250,10 @@ class PirepService extends Service foreach ($field_values as $fv) { PirepFieldValue::updateOrCreate( ['pirep_id' => $pirep_id, - 'name' => $fv['name'] + 'name' => $fv['name'], ], ['value' => $fv['value'], - 'source' => $fv['source'] + 'source' => $fv['source'], ] ); } @@ -258,6 +262,7 @@ class PirepService extends Service /** * @param Pirep $pirep * @param int $new_state + * * @return Pirep */ public function changeState(Pirep $pirep, int $new_state) @@ -268,7 +273,7 @@ class PirepService extends Service return $pirep; } - /** + /* * Move from a PENDING status into either ACCEPTED or REJECTED */ if ($pirep->state === PirepState::PENDING) { @@ -276,9 +281,8 @@ class PirepService extends Service return $this->accept($pirep); } elseif ($new_state === PirepState::REJECTED) { return $this->reject($pirep); - } else { - return $pirep; } + return $pirep; } /* * Move from a ACCEPTED to REJECTED status */ @@ -286,7 +290,7 @@ class PirepService extends Service $pirep = $this->reject($pirep); return $pirep; - } /** + } /* * Move from REJECTED to ACCEPTED */ elseif ($pirep->state === PirepState::REJECTED) { @@ -300,11 +304,12 @@ class PirepService extends Service /** * @param Pirep $pirep + * * @return Pirep */ public function accept(Pirep $pirep): Pirep { - # moving from a REJECTED state to ACCEPTED, reconcile statuses + // moving from a REJECTED state to ACCEPTED, reconcile statuses if ($pirep->state === PirepState::ACCEPTED) { return $pirep; } @@ -317,14 +322,14 @@ class PirepService extends Service $this->pilotSvc->calculatePilotRank($pilot); $pirep->pilot->refresh(); - # Change the status + // Change the status $pirep->state = PirepState::ACCEPTED; $pirep->save(); $pirep->refresh(); Log::info('PIREP '.$pirep->id.' state change to ACCEPTED'); - # Update the aircraft + // Update the aircraft $pirep->aircraft->flight_time += $pirep->flight_time; $pirep->aircraft->airport_id = $pirep->arr_airport_id; $pirep->aircraft->landing_time = $pirep->updated_at; @@ -332,7 +337,7 @@ class PirepService extends Service $pirep->refresh(); - # Any ancillary tasks before an event is dispatched + // Any ancillary tasks before an event is dispatched $this->removeBid($pirep); $this->setPilotState($pilot, $pirep); @@ -343,12 +348,13 @@ class PirepService extends Service /** * @param Pirep $pirep + * * @return Pirep */ public function reject(Pirep $pirep): Pirep { - # If this was previously ACCEPTED, then reconcile the flight hours - # that have already been counted, etc + // If this was previously ACCEPTED, then reconcile the flight hours + // that have already been counted, etc if ($pirep->state === PirepState::ACCEPTED) { $pilot = $pirep->pilot; $ft = $pirep->flight_time * -1; @@ -359,7 +365,7 @@ class PirepService extends Service $pirep->pilot->refresh(); } - # Change the status + // Change the status $pirep->state = PirepState::REJECTED; $pirep->save(); $pirep->refresh(); @@ -393,7 +399,9 @@ class PirepService extends Service /** * If the setting is enabled, remove the bid + * * @param Pirep $pirep + * * @throws \Exception */ public function removeBid(Pirep $pirep) diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 9c10214c..f69b65c9 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -20,15 +20,15 @@ use Log; /** * Class UserService - * @package App\Services */ class UserService extends Service { - private $aircraftRepo, - $subfleetRepo; + private $aircraftRepo; + private $subfleetRepo; /** * UserService constructor. + * * @param AircraftRepository $aircraftRepo * @param SubfleetRepository $subfleetRepo */ @@ -43,14 +43,17 @@ class UserService extends Service /** * Register a pilot. Also attaches the initial roles * required, and then triggers the UserRegistered event + * * @param User $user User model * @param array $groups Additional groups to assign - * @return mixed + * * @throws \Exception + * + * @return mixed */ public function createPilot(User $user, array $groups = null) { - # Determine if we want to auto accept + // Determine if we want to auto accept if (setting('pilots.auto_accept') === true) { $user->state = UserState::ACTIVE; } else { @@ -59,7 +62,7 @@ class UserService extends Service $user->save(); - # Attach the user roles + // Attach the user roles $role = Role::where('name', 'user')->first(); $user->attachRole($role); @@ -70,7 +73,7 @@ class UserService extends Service } } - # Let's check their rank and where they should start + // Let's check their rank and where they should start $this->calculatePilotRank($user); $user->refresh(); @@ -82,7 +85,9 @@ class UserService extends Service /** * Return the subfleets this user is allowed access to, * based on their current rank + * * @param $user + * * @return Collection */ public function getAllowableSubfleets($user) @@ -97,8 +102,10 @@ class UserService extends Service /** * Return a bool if a user is allowed to fly the current aircraft + * * @param $user * @param $aircraft_id + * * @return bool */ public function aircraftAllowed($user, $aircraft_id) @@ -113,8 +120,10 @@ class UserService extends Service /** * Change the user's state. PENDING to ACCEPTED, etc * Send out an email + * * @param User $user * @param $old_state + * * @return User */ public function changeUserState(User $user, $old_state): User @@ -135,8 +144,10 @@ class UserService extends Service /** * Adjust the number of flights a user has. Triggers * UserStatsChanged event + * * @param User $user * @param int $count + * * @return User */ public function adjustFlightCount(User $user, int $count): User @@ -153,8 +164,10 @@ class UserService extends Service /** * Update a user's flight times + * * @param User $user * @param int $minutes + * * @return User */ public function adjustFlightTime(User $user, int $minutes): User @@ -168,24 +181,26 @@ class UserService extends Service /** * See if a pilot's rank has change. Triggers the UserStatsChanged event + * * @param User $user + * * @return User */ public function calculatePilotRank(User $user): User { $user->refresh(); - # If their current rank is one they were assigned, then - # don't change away from it automatically. + // If their current rank is one they were assigned, then + // don't change away from it automatically. if ($user->rank && $user->rank->auto_promote === false) { return $user; } $pilot_hours = new Time($user->flight_time); - # The current rank's hours are over the pilot's current hours, - # so assume that they were "placed" here by an admin so don't - # bother with updating it + // The current rank's hours are over the pilot's current hours, + // so assume that they were "placed" here by an admin so don't + // bother with updating it if ($user->rank && $user->rank->hours > $pilot_hours->hours) { return $user; } @@ -216,7 +231,9 @@ class UserService extends Service /** * Set the user's status to being on leave + * * @param User $user + * * @return User */ public function setStatusOnLeave(User $user): User @@ -233,21 +250,23 @@ class UserService extends Service /** * Recount/update all of the stats for a user + * * @param User $user + * * @return User */ public function recalculateStats(User $user): User { - # Recalc their hours + // Recalc their hours $w = [ 'user_id' => $user->id, - 'state' => PirepState::ACCEPTED, + 'state' => PirepState::ACCEPTED, ]; $flight_time = Pirep::where($w)->sum('flight_time'); $user->flight_time = $flight_time; - # Recalc the rank + // Recalc the rank $this->calculatePilotRank($user); Log::info('User '.$user->ident.' updated; rank='.$user->rank->name.'; flight_time='.$user->flight_time.' minutes'); diff --git a/app/Support/ClassLoader.php b/app/Support/ClassLoader.php index 8df7851f..829473b9 100644 --- a/app/Support/ClassLoader.php +++ b/app/Support/ClassLoader.php @@ -8,12 +8,12 @@ use Symfony\Component\ClassLoader\ClassMapGenerator; /** * Class find/load related functionality. Is used to find * the award classes right now that might be in a module - * @package App\Support */ class ClassLoader { /** * @param $path + * * @return array */ public static function getClassesInPath($path): array @@ -26,7 +26,7 @@ class ClassLoader $all_classes = array_keys(ClassMapGenerator::createMap($path)); foreach ($all_classes as $cl) { try { - $klass = new $cl; + $klass = new $cl(); } catch (\Exception $e) { Log::error('Error loading class: '.$e->getMessage()); continue; diff --git a/app/Support/Countries.php b/app/Support/Countries.php index c4c56003..bbd477b5 100644 --- a/app/Support/Countries.php +++ b/app/Support/Countries.php @@ -4,17 +4,17 @@ namespace App\Support; /** * Class Countries - * @package App\Support */ class Countries { /** * Get a select box list of all the countries + * * @return static */ public static function getSelectList() { - $countries = collect((new \League\ISO3166\ISO3166)->all()) + $countries = collect((new \League\ISO3166\ISO3166())->all()) ->mapWithKeys(function ($item, $key) { return [strtolower($item['alpha2']) => $item['name']]; }); diff --git a/app/Support/Database.php b/app/Support/Database.php index f27408dc..6accf225 100644 --- a/app/Support/Database.php +++ b/app/Support/Database.php @@ -1,16 +1,12 @@ $value) { if (strtolower($value) === 'now') { $row[$column] = static::time(); @@ -89,6 +91,7 @@ class Database DB::table($table)->insert($row); } catch (QueryException $e) { Log::error($e); + throw $e; } diff --git a/app/Support/Dates.php b/app/Support/Dates.php index 4a69cba8..890069aa 100644 --- a/app/Support/Dates.php +++ b/app/Support/Dates.php @@ -8,7 +8,9 @@ class Dates { /** * Get the list of months, given a start date + * * @param Carbon $start_date + * * @return array */ public static function getMonthsList(Carbon $start_date) @@ -28,7 +30,9 @@ class Dates /** * Return the start/end dates for a given month/year + * * @param $month YYYY-MM + * * @return array */ public static function getMonthBoundary($month) @@ -38,7 +42,7 @@ class Dates return [ "$year-$month-01", - "$year-$month-$days" + "$year-$month-$days", ]; } } diff --git a/app/Support/Http.php b/app/Support/Http.php index f5d2ba31..b5de03d0 100644 --- a/app/Support/Http.php +++ b/app/Support/Http.php @@ -6,17 +6,19 @@ use GuzzleHttp\Client; /** * Helper for HTTP stuff - * @package App\Support */ class Http { /** * Download a URI. If a file is given, it will save the downloaded * content into that file + * * @param $uri * @param array $opts - * @return string + * * @throws \GuzzleHttp\Exception\GuzzleException + * + * @return string */ public static function get($uri, array $opts) { diff --git a/app/Support/ICAO.php b/app/Support/ICAO.php index 71080394..2c20f294 100644 --- a/app/Support/ICAO.php +++ b/app/Support/ICAO.php @@ -4,14 +4,15 @@ namespace App\Support; /** * ICAO Helper Tools - * @package App\Support */ class ICAO { /** * Create a random hex code. Eventually this may follow the format in: * ICAO Aeronautical Telecommunications, Annex 10, Vol. III, chapter 9 + * * @param null $country + * * @return string */ public static function createHexCode($country = null) diff --git a/app/Support/Math.php b/app/Support/Math.php index 8e963752..bf48fa73 100644 --- a/app/Support/Math.php +++ b/app/Support/Math.php @@ -4,15 +4,16 @@ namespace App\Support; /** * Helper math - * @package App\Support */ class Math { /** * Determine from the base rate, if we want to return the overridden rate * or if the overridden rate is a percentage, then return that amount + * * @param $base_rate * @param $override_rate + * * @return float|null */ public static function applyAmountOrPercent($base_rate, $override_rate = null): ?float @@ -21,7 +22,7 @@ class Math return $base_rate; } - # Not a percentage override + // Not a percentage override if (substr_count($override_rate, '%') === 0) { return $override_rate; } @@ -31,8 +32,10 @@ class Math /** * Add/subtract a percentage to a number + * * @param $number * @param $percent + * * @return float */ public static function addPercent($number, $percent): float diff --git a/app/Support/Metar.php b/app/Support/Metar.php index 7f35a382..0a98a928 100644 --- a/app/Support/Metar.php +++ b/app/Support/Metar.php @@ -8,10 +8,6 @@ use App\Support\Units\Temperature; /** * Class Metar - * @package App\Support - * - * Modified by Nabeel S, adapted for phpVMS - * Copyright left intact below! */ /* @@ -174,12 +170,12 @@ class Metar implements \ArrayAccess 'CLR' => 'clear skies', 'NOBS' => 'no observation', // - 'FEW' => 'a few', - 'SCT' => 'scattered', - 'BKN' => 'broken sky', - 'OVC' => 'overcast sky', + 'FEW' => 'a few', + 'SCT' => 'scattered', + 'BKN' => 'broken sky', + 'OVC' => 'overcast sky', // - 'VV' => 'vertical visibility', + 'VV' => 'vertical visibility', ]; /* @@ -331,6 +327,7 @@ class Metar implements \ArrayAccess * UKDR 251830Z 00000MPS CAVOK 08/07 Q1019 3619//60 NOSIG * UBBB 251900Z 34015KT 9999 FEW013 BKN030 16/14 Q1016 88CLRD70 NOSIG * UMMS 251936Z 19002MPS 9999 SCT006 OVC026 06/05 Q1015 R31/D NOSIG RMK QBB080 OFE745 + * * @param $raw * @param bool $taf * @param bool $debug @@ -367,8 +364,10 @@ class Metar implements \ArrayAccess /** * Shortcut to call + * * @param $metar * @param string $taf + * * @return mixed */ public static function parse($metar, $taf = '') @@ -379,7 +378,9 @@ class Metar implements \ArrayAccess /** * Gets the value from result array as class property. + * * @param $parameter + * * @return mixed|null */ public function __get($parameter) @@ -387,8 +388,6 @@ class Metar implements \ArrayAccess if (isset($this->result[$parameter])) { return $this->result[$parameter]; } - - return null; } /** @@ -436,10 +435,10 @@ class Metar implements \ArrayAccess } // Finally determine if it's VFR or IFR conditions // https://www.aviationweather.gov/cva/help - if(array_key_exists('cavok', $this->result) && $this->result['cavok']) { + if (array_key_exists('cavok', $this->result) && $this->result['cavok']) { $this->result['category'] = 'VFR'; } else { - 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) { $this->result['category'] = 'VFR'; } else { @@ -471,6 +470,8 @@ class Metar implements \ArrayAccess * This method formats observation date and time in the local time zone of server, * the current local time on server, and time difference since observation. $time_utc is a * UNIX timestamp for Universal Coordinated Time (Greenwich Mean Time or Zulu Time). + * + * @param mixed $time_utc */ private function set_observed_date($time_utc) { @@ -483,12 +484,13 @@ class Metar implements \ArrayAccess if ($time_diff < 91) { $this->set_result_value('observed_age', $time_diff.' '.trans_choice('widgets.weather.minago', $time_diff)); } else { - $this->set_result_value('observed_age', floor($time_diff / 60).':'.sprintf("%02d", $time_diff % 60).' '.trans_choice('widgets.weather.hrago', floor($time_diff / 60))); + $this->set_result_value('observed_age', floor($time_diff / 60).':'.sprintf('%02d', $time_diff % 60).' '.trans_choice('widgets.weather.hrago', floor($time_diff / 60))); } } /** * Sets the new value to parameter in result array. + * * @param $parameter * @param $value * @param bool $only_if_null @@ -506,6 +508,9 @@ class Metar implements \ArrayAccess /** * Sets the data group to parameter in result array. + * + * @param mixed $parameter + * @param mixed $group */ private function set_result_group($parameter, $group) { @@ -518,6 +523,7 @@ class Metar implements \ArrayAccess /** * Sets the report text to parameter in result array. + * * @param $parameter * @param $report * @param string $separator @@ -532,6 +538,8 @@ class Metar implements \ArrayAccess /** * Adds the debug text to debug information array. + * + * @param mixed $text */ private function set_debug($text) { @@ -542,6 +550,8 @@ class Metar implements \ArrayAccess /** * Adds the error text to parse errors array. + * + * @param mixed $text */ private function set_error($text) { @@ -551,8 +561,11 @@ class Metar implements \ArrayAccess // -------------------------------------------------------------------- // Methods for parsing raw parts // -------------------------------------------------------------------- + /** * Decodes TAF code if present. + * + * @param mixed $part */ private function get_taf($part) { @@ -573,6 +586,8 @@ class Metar implements \ArrayAccess /** * Decodes station code. + * + * @param mixed $part */ private function get_station($part) { @@ -589,6 +604,8 @@ class Metar implements \ArrayAccess /** * Decodes observation time. * Format is ddhhmmZ where dd = day, hh = hours, mm = minutes in UTC time. + * + * @param mixed $part */ private function get_time($part) { @@ -627,6 +644,8 @@ class Metar implements \ArrayAccess /** * Ignore station type if present. + * + * @param mixed $part */ private function get_station_type($part) { @@ -643,7 +662,9 @@ class Metar implements \ArrayAccess * Format is dddssKT where ddd = degrees from North, ss = speed, KT for knots, * or dddssGggKT where G stands for gust and gg = gust speed. (ss or gg can be a 3-digit number.) * KT can be replaced with MPH for meters per second or KMH for kilometers per hour. + * * @param $part + * * @return bool */ private function get_wind($part) @@ -724,6 +745,9 @@ class Metar implements \ArrayAccess * if visibility is limited to an integer mile plus a fraction part. * Format is mmSM for mm = statute miles, or m n/dSM for m = mile and n/d = fraction of a mile, * or just a 4-digit number nnnn (with leading zeros) for nnnn = meters. + * + * @param mixed $part + * * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue */ @@ -792,11 +816,14 @@ class Metar implements \ArrayAccess * (if the visibility is better than 10 km, 9999 is used. 9999 means a minimum * visibility of 50 m or less), and for DD = the approximate direction of minimum and * maximum visibility is given as one of eight compass points (N, SW, ...). + * * @param $part - * @return bool + * * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName + * + * @return bool */ private function get_visibility_min($part) { @@ -819,10 +846,13 @@ class Metar implements \ArrayAccess * Decodes runway visual range information if present. * Format is Rrrr/vvvvFT where rrr = runway number, vvvv = visibility, * and FT = the visibility in feet. + * * @param $part - * @return bool + * * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue + * + * @return bool */ private function get_runway_vr($part) { @@ -911,7 +941,9 @@ class Metar implements \ArrayAccess * to decode all conditions. To learn more about weather condition codes, visit section * 12.6.8 - Present Weather Group of the Federal Meteorological Handbook No. 1 at * www.nws.noaa.gov/oso/oso1/oso12/fmh1/fmh1ch12.htm + * * @param $part + * * @return bool */ private function get_present_weather($part) @@ -925,10 +957,13 @@ class Metar implements \ArrayAccess * Format is SKC or CLR for clear skies, or cccnnn where ccc = 3-letter code and * nnn = height of cloud layer in hundreds of feet. 'VV' seems to be used for * very low cloud layers. + * * @param $part - * @return bool + * * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue + * + * @return bool */ private function get_clouds($part) { @@ -942,10 +977,10 @@ class Metar implements \ArrayAccess } $observed = [ - 'amount' => null, - 'height' => null, - 'type' => null, - 'report' => null, + 'amount' => null, + 'height' => null, + 'type' => null, + 'report' => null, ]; // Clear skies or no observation @@ -984,8 +1019,8 @@ class Metar implements \ArrayAccess $report[] = 'at '.round($observed['height']['m'], 0).' meters, '.static::$cloud_type_codes[$observed['type']]; $report_ft[] = 'at '.round($observed['height']['ft'], 0).' feet, '.static::$cloud_type_codes[$observed['type']]; } else { - $report[] = 'at ' . round($observed['height']['m'], 0) . ' meters'; - $report_ft[] = 'at ' . round($observed['height']['ft'], 0) . ' feet'; + $report[] = 'at '.round($observed['height']['m'], 0).' meters'; + $report_ft[] = 'at '.round($observed['height']['ft'], 0).' feet'; } } @@ -1009,6 +1044,9 @@ class Metar implements \ArrayAccess * Format is tt/dd where tt = temperature and dd = dew point temperature. All units are * in Celsius. A 'M' preceeding the tt or dd indicates a negative temperature. Some * stations do not report dew point, so the format is tt/ or tt/XX. + * + * @param mixed $part + * * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue */ @@ -1057,6 +1095,8 @@ class Metar implements \ArrayAccess * 1 mm Hg = 25.4 in Hg = 0.750062 hPa * 1 lb/sq in = 0.491154 in Hg = 0.014504 hPa * 1 atm = 0.33421 in Hg = 0.0009869 hPa + * + * @param mixed $part */ private function get_pressure($part) { @@ -1079,6 +1119,8 @@ class Metar implements \ArrayAccess /** * Decodes recent weather conditions if present. * Format is REww where ww = Weather phenomenon code (see get_present_weather above). + * + * @param mixed $part */ private function get_recent_weather($part) { @@ -1089,6 +1131,8 @@ class Metar implements \ArrayAccess * Decodes runways report information if present. * Format rrrECeeBB or Rrrr/ECeeBB where rr = runway number, E = deposits, * C = extent of deposit, ee = depth of deposit, BB = friction coefficient. + * + * @param mixed $part */ private function get_runways_report($part) { @@ -1195,6 +1239,8 @@ class Metar implements \ArrayAccess /** * Decodes wind shear information if present. * Format is 'WS ALL RWY' or 'WS RWYdd' where dd = Runway designator (see get_runway_vr above). + * + * @param mixed $part */ private function get_wind_shear($part) { @@ -1211,7 +1257,6 @@ class Metar implements \ArrayAccess $this->part += 2; // can skip neext parts with ALL and RWY records } // See one next part for RWYdd record elseif (isset($this->raw_parts[$this->part])) { - $r = '@^R(WY)?' // 1 .'([\d]{2}[LCR]?)$@'; // 2 @@ -1234,17 +1279,20 @@ class Metar implements \ArrayAccess /** * Decodes max and min temperature forecast information if present. + * * @param string $part - * Format TXTtTt/ddHHZ or TNTtTt/ddHHZ, where: - * TX - Indicator for Maximum temperature - * TN - Indicator for Minimum temperature - * TtTt - Temperature value in Celsius - * dd - Forecast day of month - * HH - Forecast hour, i.e. the time(hour) when the temperature is expected - * Z - Time Zone indicator, Z=GMT. - * @return bool + * Format TXTtTt/ddHHZ or TNTtTt/ddHHZ, where: + * TX - Indicator for Maximum temperature + * TN - Indicator for Minimum temperature + * TtTt - Temperature value in Celsius + * dd - Forecast day of month + * HH - Forecast hour, i.e. the time(hour) when the temperature is expected + * Z - Time Zone indicator, Z=GMT. + * * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue + * + * @return bool */ private function get_forecast_temperature($part): bool { @@ -1262,9 +1310,9 @@ class Metar implements \ArrayAccess $temperture = new Temperature($temperature_c, 'C'); $forecast = [ - 'value' => $temperture, - 'day' => null, - 'time' => null, + 'value' => $temperture, + 'day' => null, + 'time' => null, ]; if (!empty($found[3])) { @@ -1286,6 +1334,8 @@ class Metar implements \ArrayAccess * Decodes trends information if present. * All METAR trend and TAF records is beginning at: NOSIG, BECMG, TEMP, ATDDhhmm, FMDDhhmm, * LTDDhhmm or DDhh/DDhh, where hh = hours, mm = minutes, DD = day of month. + * + * @param mixed $part */ private function get_trends($part) { @@ -1447,7 +1497,9 @@ class Metar implements \ArrayAccess /** * Get remarks information if present. * The information is everything that comes after RMK. + * * @param string $part + * * @return bool */ private function get_remarks($part): bool @@ -1460,7 +1512,7 @@ class Metar implements \ArrayAccess $remarks = []; // Get all parts after - while ($this->part < sizeof($this->raw_parts)) { + while ($this->part < count($this->raw_parts)) { if (isset($this->raw_parts[$this->part])) { $remarks[] = $this->raw_parts[$this->part]; } @@ -1477,9 +1529,11 @@ class Metar implements \ArrayAccess /** * Decodes present or recent weather conditions. + * * @param $part * @param $method * @param string $regexp_prefix + * * @return bool */ private function decode_weather($part, $method, $regexp_prefix = '') @@ -1550,8 +1604,10 @@ class Metar implements \ArrayAccess /** * Calculate Heat Index based on temperature in F and relative humidity (65 = 65%) + * * @param $temperature_f * @param $rh + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ @@ -1572,7 +1628,9 @@ class Metar implements \ArrayAccess /** * Calculate Wind Chill Temperature based on temperature in F * and wind speed in miles per hour. + * * @param $temperature_f + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ @@ -1599,8 +1657,10 @@ class Metar implements \ArrayAccess * 1 knot = 1.852 km/hr = 0.514444 m/s = 1.687809 ft/s = 1.150779 mi/hr * 1 km/hr = 0.539957 knots = 0.277778 m/s = 0.911344 ft/s = 0.621371 mi/hr * 1 m/s = 1.943844 knots = 3.6 km/h = 3.28084 ft/s = 2.236936 mi/hr + * * @param $speed * @param $unit + * * @return float|null */ private function convert_speed($speed, $unit) @@ -1615,8 +1675,6 @@ class Metar implements \ArrayAccess case 'MPS': return round($speed, 2); // m/s } - - return null; } /** @@ -1625,8 +1683,10 @@ class Metar implements \ArrayAccess * 1 m = 3.28084 ft = 0.00062 mi * 1 ft = 0.3048 m = 0.00019 mi * 1 mi = 5279.99 ft = 1609.34 m + * * @param $distance * @param $unit + * * @return float|null */ private function convert_distance($distance, $unit) @@ -1640,36 +1700,40 @@ class Metar implements \ArrayAccess case 'M': return round($distance); // meters } - - return null; } /** * Convert direction degrees to compass label. + * + * @param mixed $direction */ private function convert_direction_label($direction) { if ($direction >= 0 && $direction <= 360) { return static::$direction_codes[round($direction / 22.5) % 16]; } - - return null; } /** * These methods below the implementation of the stubs for ArrayAccess + * + * @param mixed $offset */ /** * Whether a offset exists + * * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * * @param mixed $offset

* An offset to check for. *

- * @return boolean true on success or false on failure. - *

- *

- * The return value will be casted to boolean if non-boolean was returned. + * + * @return bool true on success or false on failure. + *

+ *

+ * The return value will be casted to boolean if non-boolean was returned. + * * @since 5.0.0 */ public function offsetExists($offset) @@ -1679,11 +1743,15 @@ class Metar implements \ArrayAccess /** * Offset to retrieve + * * @link http://php.net/manual/en/arrayaccess.offsetget.php + * * @param mixed $offset

* The offset to retrieve. *

+ * * @return mixed Can return all value types. + * * @since 5.0.0 */ public function offsetGet($offset) @@ -1693,14 +1761,18 @@ class Metar implements \ArrayAccess /** * Offset to set + * * @link http://php.net/manual/en/arrayaccess.offsetset.php + * * @param mixed $offset

* The offset to assign the value to. *

* @param mixed $value

* The value to set. *

+ * * @return void + * * @since 5.0.0 */ public function offsetSet($offset, $value) @@ -1710,11 +1782,15 @@ class Metar implements \ArrayAccess /** * Offset to unset + * * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * * @param mixed $offset

* The offset to unset. *

+ * * @return void + * * @since 5.0.0 */ public function offsetUnset($offset) diff --git a/app/Support/Money.php b/app/Support/Money.php index 7ac690cf..d01d3e8d 100644 --- a/app/Support/Money.php +++ b/app/Support/Money.php @@ -1,7 +1,4 @@ format('P'); if ($htmlencode) { $offset = str_replace('-', ' − ', $offset); @@ -27,7 +27,7 @@ class TimezonelistExtended extends Timezonelist $timezone = substr($timezone, strlen($continent) + 1); $timezone = str_replace('St_', 'St. ', $timezone); $timezone = str_replace('_', ' ', $timezone); - $formatted = '(GMT/UTC' . $offset . ')' . self::WHITESPACE_SEP . $timezone; + $formatted = '(GMT/UTC'.$offset.')'.self::WHITESPACE_SEP.$timezone; return $formatted; } @@ -36,41 +36,42 @@ class TimezonelistExtended extends Timezonelist * * @param string $name * @param string $selected - * @param mixed $attr - * @param bool $htmlencode + * @param mixed $attr + * @param bool $htmlencode + * * @return string */ - public function create($name, $selected='', $attr='', $htmlencode=true) + public function create($name, $selected = '', $attr = '', $htmlencode = true) { // Attributes for select element $attrSet = ''; if (!empty($attr)) { if (is_array($attr)) { foreach ($attr as $attr_name => $attr_value) { - $attrSet .= ' ' .$attr_name. '="' .$attr_value. '"'; + $attrSet .= ' '.$attr_name.'="'.$attr_value.'"'; } } else { - $attrSet = ' ' .$attr; + $attrSet = ' '.$attr; } } // start select element - $listbox = ''; // Add popular timezones $listbox .= ''; foreach ($this->popularTimezones as $key => $value) { $selected_attr = ($selected == $key) ? ' selected="selected"' : ''; - $listbox .= ''; + $listbox .= ''; } $listbox .= ''; // Add all timezone of continents foreach ($this->continents as $continent => $mask) { $timezones = DateTimeZone::listIdentifiers($mask); // start optgroup tag - $listbox .= ''; + $listbox .= ''; // create option tags foreach ($timezones as $timezone) { $selected_attr = ($selected == $timezone) ? ' selected="selected"' : ''; - $listbox .= ''; } @@ -86,9 +87,10 @@ class TimezonelistExtended extends Timezonelist * Create a timezone array * * @param bool $htmlencode + * * @return mixed */ - public function toArray($htmlencode=false) + public function toArray($htmlencode = false) { $list = []; // Add popular timezones to list @@ -104,4 +106,4 @@ class TimezonelistExtended extends Timezonelist } return $list; } -} \ No newline at end of file +} diff --git a/app/Support/Units/Altitude.php b/app/Support/Units/Altitude.php index 8324fa26..3b00f1b5 100644 --- a/app/Support/Units/Altitude.php +++ b/app/Support/Units/Altitude.php @@ -5,14 +5,12 @@ namespace App\Support\Units; use App\Interfaces\Unit; use PhpUnitsOfMeasure\PhysicalQuantity\Length; -/** - * @package App\Support\Units - */ class Altitude extends Unit { /** * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ @@ -23,7 +21,7 @@ class Altitude extends Unit $this->units = [ 'm' => round($this->instance->toUnit('meters'), 2), - 'km' => round($this->instance->toUnit('meters') / 1000, 2), + 'km' => round($this->instance->toUnit('meters') / 1000, 2), 'ft' => round($this->instance->toUnit('feet'), 2), ]; } diff --git a/app/Support/Units/Distance.php b/app/Support/Units/Distance.php index bb8531db..b4b030f2 100644 --- a/app/Support/Units/Distance.php +++ b/app/Support/Units/Distance.php @@ -5,15 +5,14 @@ namespace App\Support\Units; use App\Interfaces\Unit; use PhpUnitsOfMeasure\PhysicalQuantity\Length; -/** - * @package App\Support\Units - */ class Distance extends Unit { /** * Distance constructor. + * * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ diff --git a/app/Support/Units/Fuel.php b/app/Support/Units/Fuel.php index f5d6d1b7..01ce2391 100644 --- a/app/Support/Units/Fuel.php +++ b/app/Support/Units/Fuel.php @@ -5,14 +5,12 @@ namespace App\Support\Units; use App\Interfaces\Unit; use PhpUnitsOfMeasure\PhysicalQuantity\Mass; -/** - * @package App\Support\Units - */ class Fuel extends Unit { /** * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ diff --git a/app/Support/Units/Mass.php b/app/Support/Units/Mass.php index f1fbcc43..fd8e6efa 100644 --- a/app/Support/Units/Mass.php +++ b/app/Support/Units/Mass.php @@ -5,14 +5,12 @@ namespace App\Support\Units; use App\Interfaces\Unit; use PhpUnitsOfMeasure\PhysicalQuantity\Mass as MassUnit; -/** - * @package App\Support\Units - */ class Mass extends Unit { /** * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ diff --git a/app/Support/Units/Temperature.php b/app/Support/Units/Temperature.php index 79f59698..1e314696 100644 --- a/app/Support/Units/Temperature.php +++ b/app/Support/Units/Temperature.php @@ -7,13 +7,13 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Temperature as TemperatureUnit; /** * Composition for the converter - * @package App\Support\Units */ class Temperature extends Unit { /** * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ diff --git a/app/Support/Units/Time.php b/app/Support/Units/Time.php index 4f4612cf..29d09c24 100644 --- a/app/Support/Units/Time.php +++ b/app/Support/Units/Time.php @@ -6,26 +6,27 @@ use Illuminate\Contracts\Support\Arrayable; /** * Class Time - * @package App\Support\Units */ class Time implements Arrayable { - public $hours, - $minutes; + public $hours; + public $minutes; /** * @param $minutes * @param $hours + * * @return static */ public static function init($minutes, $hours) { - return new Time($minutes, $hours); + return new self($minutes, $hours); } /** * Pass just minutes to figure out how many hours * Or both hours and minutes + * * @param $minutes * @param $hours */ @@ -44,6 +45,7 @@ class Time implements Arrayable /** * Get the total number minutes, adding up the hours + * * @return float|int */ public function getMinutes() @@ -53,7 +55,9 @@ class Time implements Arrayable /** * Alias to getMinutes() + * * @alias getMinutes() + * * @return float|int */ public function asInt() @@ -63,6 +67,7 @@ class Time implements Arrayable /** * Return a time string + * * @return string */ public function __toString() diff --git a/app/Support/Units/Velocity.php b/app/Support/Units/Velocity.php index d19b50c9..3a78cb0c 100644 --- a/app/Support/Units/Velocity.php +++ b/app/Support/Units/Velocity.php @@ -7,13 +7,13 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Velocity as VelocityUnit; /** * Class Velocity - * @package App\Support\Units */ class Velocity extends Unit { /** * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ diff --git a/app/Support/Units/Volume.php b/app/Support/Units/Volume.php index fbd84cd9..131a78ff 100644 --- a/app/Support/Units/Volume.php +++ b/app/Support/Units/Volume.php @@ -7,13 +7,13 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Volume as VolumeUnit; /** * Wrap the converter class - * @package App\Support\Units */ class Volume extends Unit { /** * @param float $value * @param string $unit + * * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName */ diff --git a/app/Widgets/AirspaceMap.php b/app/Widgets/AirspaceMap.php index 26b0e0b6..7a591331 100644 --- a/app/Widgets/AirspaceMap.php +++ b/app/Widgets/AirspaceMap.php @@ -6,15 +6,14 @@ use App\Interfaces\Widget; /** * Show the live map in a view - * @package App\Widgets */ class AirspaceMap extends Widget { protected $config = [ 'height' => '800px', 'width' => '100%', - 'lat' => 0, - 'lon' => 0, + 'lat' => 0, + 'lon' => 0, ]; /** @@ -23,7 +22,7 @@ class AirspaceMap extends Widget public function run() { return view('widgets.airspace_map', [ - 'config' => $this->config, + 'config' => $this->config, ]); } } diff --git a/app/Widgets/LatestNews.php b/app/Widgets/LatestNews.php index b5339f69..de244be1 100644 --- a/app/Widgets/LatestNews.php +++ b/app/Widgets/LatestNews.php @@ -7,7 +7,6 @@ use App\Repositories\NewsRepository; /** * Show the latest news in a view - * @package App\Widgets */ class LatestNews extends Widget { diff --git a/app/Widgets/LatestPilots.php b/app/Widgets/LatestPilots.php index 0d026c13..905c4677 100644 --- a/app/Widgets/LatestPilots.php +++ b/app/Widgets/LatestPilots.php @@ -7,7 +7,6 @@ use App\Repositories\UserRepository; /** * Show the latest pilots in a view - * @package App\Widgets */ class LatestPilots extends Widget { diff --git a/app/Widgets/LatestPireps.php b/app/Widgets/LatestPireps.php index 2d322db0..addb7123 100644 --- a/app/Widgets/LatestPireps.php +++ b/app/Widgets/LatestPireps.php @@ -8,7 +8,6 @@ use App\Repositories\PirepRepository; /** * Show the latest PIREPs in a view - * @package App\Widgets */ class LatestPireps extends Widget { @@ -27,7 +26,7 @@ class LatestPireps extends Widget ->whereNotInOrder('state', [ PirepState::CANCELLED, PirepState::DRAFT, - PirepState::IN_PROGRESS + PirepState::IN_PROGRESS, ], 'created_at', 'desc') ->recent($this->config['count']); diff --git a/app/Widgets/LiveMap.php b/app/Widgets/LiveMap.php index 453e4212..1b7312c8 100644 --- a/app/Widgets/LiveMap.php +++ b/app/Widgets/LiveMap.php @@ -8,7 +8,6 @@ use App\Services\GeoService; /** * Show the live map in a view - * @package App\Widgets */ class LiveMap extends Widget { @@ -29,16 +28,16 @@ class LiveMap extends Widget $positions = $geoSvc->getFeatureForLiveFlights($pireps); $center_coords = setting('acars.center_coords', '0,0'); - $center_coords = array_map(function($c) { + $center_coords = array_map(function ($c) { return (float) trim($c); }, explode(',', $center_coords)); return view('widgets.live_map', [ - 'config' => $this->config, - 'pireps' => $pireps, - 'positions' => $positions, - 'center' => $center_coords, - 'zoom' => setting('acars.default_zoom', 5), + 'config' => $this->config, + 'pireps' => $pireps, + 'positions' => $positions, + 'center' => $center_coords, + 'zoom' => setting('acars.default_zoom', 5), ]); } } diff --git a/app/Widgets/Weather.php b/app/Widgets/Weather.php index 19f741cd..35ac75b5 100644 --- a/app/Widgets/Weather.php +++ b/app/Widgets/Weather.php @@ -7,7 +7,6 @@ use App\Support\Metar; /** * This is a widget for the 3rd party CheckWX service - * @package App\Widgets */ class Weather extends Widget { @@ -26,7 +25,7 @@ class Weather extends Widget * @var \App\Interfaces\Metar */ $klass = config('phpvms.metar'); - $metar_class = new $klass; + $metar_class = new $klass(); $metar = null; $wind = null; diff --git a/app/helpers.php b/app/helpers.php index aeb0d99b..20a254ee 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -3,8 +3,10 @@ if (!function_exists('in_mask')) { /** * Return true/false if a value exists in a mask + * * @param $mask * @param $value + * * @return bool */ function in_mask($mask, $value) @@ -17,7 +19,9 @@ if (!function_exists('get_truth_state')) { /** * Check if the passed state matches any of the states that * we regard as being true or false + * * @param $state + * * @return bool */ function get_truth_state($state) @@ -50,6 +54,7 @@ if (!function_exists('list_to_assoc')) { * ['item1' => 'item1', 'item2' => 'item2'] * * @param array $list + * * @return array */ function list_to_assoc(array $list) @@ -77,7 +82,9 @@ if (!function_exists('list_to_editable')) { * [value => text, valueN => textN, ...] * Return: * [{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...] + * * @param array $list + * * @return array */ function list_to_editable(array $list) @@ -97,33 +104,36 @@ if (!function_exists('list_to_editable')) { if (!function_exists('skin_view')) { /** * Render a skin + * * @param $template * @param array $vars * @param array $merge_data + * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ function skin_view($template, array $vars = [], $merge_data = []) { - # 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 + // 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 if (View::exists($template)) { return view($template, $vars, $merge_data); } - # TODO: Look for an overridden template in a special folder + // TODO: Look for an overridden template in a special folder $tpl = 'layouts/'.config('phpvms.skin').'/'.$template; return view($tpl, $vars, $merge_data); } } -/** +/* * Shortcut for retrieving a setting value */ if (!function_exists('setting')) { function setting($key, $default = null) { $settingRepo = app('setting'); + try { $value = $settingRepo->retrieve($key); } catch (\App\Exceptions\SettingNotFound $e) { @@ -134,7 +144,7 @@ if (!function_exists('setting')) { } } -/** +/* * Wrap the asset URL in the publicBaseUrl that's been * set */ @@ -150,14 +160,16 @@ if (!function_exists('public_asset')) { } } -/** +/* * Show a date/time in the proper timezone for a user */ if (!function_exists('show_datetime')) { /** * Format the a Carbon date into the datetime string * but convert it into the user's timezone + * * @param \Carbon\Carbon $date + * * @return string */ function show_datetime(\Carbon\Carbon $date = null) @@ -175,14 +187,16 @@ if (!function_exists('show_datetime')) { } } -/** +/* * Show a date/time in the proper timezone for a user */ if (!function_exists('show_date')) { /** * Format the a Carbon date into the datetime string * but convert it into the user's timezone + * * @param \Carbon\Carbon $date + * * @return string */ function show_date(\Carbon\Carbon $date) @@ -199,8 +213,10 @@ if (!function_exists('show_date')) { if (!function_exists('_fmt')) { /** * Replace strings + * * @param $line "Hi, my name is :name" * @param array $replace ['name' => 'Nabeel'] + * * @return mixed */ function _fmt($line, array $replace) @@ -220,4 +236,4 @@ if (!function_exists('_fmt')) { return $line; } -} \ No newline at end of file +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 688e1d28..0cde1a1f 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,10 +1,10 @@ bindInterfaces(); diff --git a/bootstrap/application.php b/bootstrap/application.php index c37ba6a8..1015571a 100644 --- a/bootstrap/application.php +++ b/bootstrap/application.php @@ -10,10 +10,10 @@ if (!defined('DS')) { * Customized container to allow some of the base Laravel * configurations to be overridden */ -class Application extends Illuminate\Foundation\Application +class application extends Illuminate\Foundation\Application { - private $publicDirPath, - $publicUrlPath = '/'; + private $publicDirPath; + private $publicUrlPath = '/'; public function __construct(string $basePath = null) { @@ -28,6 +28,7 @@ class Application extends Illuminate\Foundation\Application * Override this method so we can inject our own LoadConfiguration * class, which looks for any configurations that have been overridden * in the root's config.php file + * * @param array $bootstrappers */ public function bootstrapWith(array $bootstrappers) @@ -46,9 +47,6 @@ class Application extends Illuminate\Foundation\Application parent::bootstrapWith($bootstrappers); } - /** - * - */ public function bindInterfaces() { $this->singleton( @@ -69,8 +67,9 @@ class Application extends Illuminate\Foundation\Application /** * Override paths + * + * @param mixed $publicDirPath */ - public function setPublicPath($publicDirPath) { $this->publicDirPath = $publicDirPath; diff --git a/config/app.php b/config/app.php index 4a1ca401..c3f4423b 100755 --- a/config/app.php +++ b/config/app.php @@ -8,33 +8,33 @@ */ return [ - 'name' => env('APP_NAME', 'phpvms'), - 'env' => env('APP_ENV', 'dev'), - 'debug' => env('APP_DEBUG', true), - 'url' => env('APP_URL', 'http://localhost'), + 'name' => env('APP_NAME', 'phpvms'), + 'env' => env('APP_ENV', 'dev'), + 'debug' => env('APP_DEBUG', true), + 'url' => env('APP_URL', 'http://localhost'), 'version' => '7.0.0', - 'locale' => env('APP_LOCALE', 'en'), + 'locale' => env('APP_LOCALE', 'en'), 'fallback_locale' => 'en', - # Where to redirect after logging in/registration - 'login_redirect' => '/dashboard', + // Where to redirect after logging in/registration + 'login_redirect' => '/dashboard', 'registration_redirect' => '/profile', - # This sends install and vaCentral specific information to help with - # optimizations and figuring out where slowdowns might be happening + // This sends install and vaCentral specific information to help with + // optimizations and figuring out where slowdowns might be happening 'analytics' => true, - # - # Anything below here won't need changing and could break things - # + // + // Anything below here won't need changing and could break things + // - # DON'T CHANGE THIS OR ELSE YOUR TIMES WILL BE MESSED UP! + // DON'T CHANGE THIS OR ELSE YOUR TIMES WILL BE MESSED UP! 'timezone' => 'UTC', - # Is the default key cipher. Needs to be changed, otherwise phpVMS will think - # that it isn't installed. Doubles as a security feature, so keys are scrambled - 'key' => env('APP_KEY', 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY='), + // Is the default key cipher. Needs to be changed, otherwise phpVMS will think + // that it isn't installed. Doubles as a security feature, so keys are scrambled + 'key' => env('APP_KEY', 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY='), 'cipher' => 'AES-256-CBC', 'providers' => [ @@ -94,53 +94,53 @@ return [ ], 'aliases' => [ - 'App' => Illuminate\Support\Facades\App::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Carbon' => \Carbon\Carbon::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Flash' => Laracasts\Flash\Flash::class, - 'Form' => Collective\Html\FormFacade::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Geotools' => Toin0u\Geotools\Facade\Geotools::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Html' => Collective\Html\HtmlFacade::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, - 'NoCaptcha' => Anhskohbo\NoCaptcha\Facades\NoCaptcha::class, + 'App' => Illuminate\Support\Facades\App::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Carbon' => \Carbon\Carbon::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Flash' => Laracasts\Flash\Flash::class, + 'Form' => Collective\Html\FormFacade::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Geotools' => Toin0u\Geotools\Facade\Geotools::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Html' => Collective\Html\HtmlFacade::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, + 'NoCaptcha' => Anhskohbo\NoCaptcha\Facades\NoCaptcha::class, 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'Theme' => Igaster\LaravelTheme\Facades\Theme::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Utils' => App\Facades\Utils::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'Version' => PragmaRX\Version\Package\Facade::class, - 'View' => Illuminate\Support\Facades\View::class, - 'Yaml' => Symfony\Component\Yaml\Yaml::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Theme' => Igaster\LaravelTheme\Facades\Theme::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Utils' => App\Facades\Utils::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'Version' => PragmaRX\Version\Package\Facade::class, + 'View' => Illuminate\Support\Facades\View::class, + 'Yaml' => Symfony\Component\Yaml\Yaml::class, - # ENUMS + // ENUMS 'ActiveState' => App\Models\Enums\ActiveState::class, - 'UserState' => App\Models\Enums\UserState::class, + 'UserState' => App\Models\Enums\UserState::class, 'PirepSource' => App\Models\Enums\PirepSource::class, - 'PirepState' => App\Models\Enums\PirepState::class, + 'PirepState' => App\Models\Enums\PirepState::class, 'PirepStatus' => App\Models\Enums\PirepStatus::class, ], ]; diff --git a/config/auth.php b/config/auth.php index 6811517a..fa8fd949 100755 --- a/config/auth.php +++ b/config/auth.php @@ -1,7 +1,6 @@ [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_KEY'), - 'secret' => env('PUSHER_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_KEY'), + 'secret' => env('PUSHER_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ // ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index f9611ce1..751820eb 100755 --- a/config/cache.php +++ b/config/cache.php @@ -1,65 +1,64 @@ env('CACHE_DRIVER', 'array'), - 'prefix' => env('CACHE_PREFIX', ''), + 'prefix' => env('CACHE_PREFIX', ''), 'keys' => [ 'AIRPORT_VACENTRAL_LOOKUP' => [ - 'key' => 'airports.lookup:', + 'key' => 'airports.lookup:', 'time' => 60 * 30, ], 'WEATHER_LOOKUP' => [ - 'key' => 'airports.weather.', // append icao + 'key' => 'airports.weather.', // append icao 'time' => 60 * 60, // Cache for 60 minutes ], 'RANKS_PILOT_LIST' => [ - 'key' => 'ranks.pilot_list', + 'key' => 'ranks.pilot_list', 'time' => 60 * 10, ], 'USER_API_KEY' => [ - 'key' => 'user.apikey', + 'key' => 'user.apikey', 'time' => 60 * 5, // 5 min ], ], 'stores' => [ - 'apc' => ['driver' => 'apc'], - 'array' => ['driver' => 'array'], + 'apc' => ['driver' => 'apc'], + 'array' => ['driver' => 'array'], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache'), + 'path' => storage_path('framework/cache'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], - 'options' => [ + 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/captcha.php b/config/captcha.php index 689fcebb..5d9f8736 100644 --- a/config/captcha.php +++ b/config/captcha.php @@ -9,10 +9,10 @@ return [ 'enabled' => false, 'sitekey' => '', - 'secret' => '', + 'secret' => '', - # Attributes can be found here: - # https://developers.google.com/recaptcha/docs/display#render_param + // Attributes can be found here: + // https://developers.google.com/recaptcha/docs/display#render_param 'attributes' => [ 'data-theme' => 'light', ], diff --git a/config/compile.php b/config/compile.php index 04807eac..de1a500e 100755 --- a/config/compile.php +++ b/config/compile.php @@ -1,7 +1,6 @@ PDO::FETCH_ASSOC, 'default' => env('DB_CONNECTION', 'mysql'), 'connections' => [ - 'mysql' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', 3306), - 'database' => env('DB_DATABASE', ''), - 'username' => env('DB_USERNAME', ''), - 'password' => env('DB_PASSWORD', ''), + 'mysql' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', 3306), + 'database' => env('DB_DATABASE', ''), + 'username' => env('DB_USERNAME', ''), + 'password' => env('DB_PASSWORD', ''), //'unix_socket' => env('DB_SOCKET', ''), 'prefix' => env('DB_PREFIX', ''), 'timezone' => '+00:00', @@ -20,10 +20,10 @@ return [ 'engine' => null, 'options' => [ PDO::ATTR_EMULATE_PREPARES => env('DB_EMULATE_PREPARES', false), - #PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + //PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ], ], - 'sqlite' => [ + 'sqlite' => [ 'driver' => 'sqlite', 'database' => storage_path('db.sqlite'), 'timezone' => '+00:00', @@ -35,7 +35,7 @@ return [ 'timezone' => '+00:00', 'prefix' => '', ], - 'memory' => [ + 'memory' => [ 'driver' => 'sqlite', 'database' => ':memory:', 'timezone' => '+00:00', @@ -53,5 +53,5 @@ return [ 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE', 1), ], - ] + ], ]; diff --git a/config/filesystems.php b/config/filesystems.php index 342903c3..46917c53 100755 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -5,24 +5,24 @@ return [ // This is the filesystem the uploaded files should go to 'public_files' => 'public', - 'cloud' => 's3', - 'disks' => [ + 'cloud' => 's3', + 'disks' => [ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path('app'), ], 'public' => [ - 'driver' => 'local', - 'root' => public_path('uploads'), - 'url' => '/uploads', + 'driver' => 'local', + 'root' => public_path('uploads'), + 'url' => '/uploads', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', - 'key' => 'your-key', + 'key' => 'your-key', 'secret' => 'your-secret', 'region' => 'your-region', 'bucket' => 'your-bucket', diff --git a/config/ide-helper.php b/config/ide-helper.php index 307a0fdd..0e193275 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -1,7 +1,6 @@ '_ide_helper', - 'format' => 'php', + 'filename' => '_ide_helper', + 'format' => 'php', /* |-------------------------------------------------------------------------- @@ -26,9 +25,9 @@ return array( 'include_helpers' => false, - 'helper_files' => array( + 'helper_files' => [ base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php', - ), + ], /* |-------------------------------------------------------------------------- @@ -40,10 +39,9 @@ return array( | */ - 'model_locations' => array( + 'model_locations' => [ //'app/Models', - ), - + ], /* |-------------------------------------------------------------------------- @@ -54,13 +52,13 @@ return array( | */ - 'extra' => array( - 'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'), - 'Session' => array('Illuminate\Session\Store'), - ), + 'extra' => [ + 'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'], + 'Session' => ['Illuminate\Session\Store'], + ], - 'magic' => array( - 'Log' => array( + 'magic' => [ + 'Log' => [ 'debug' => 'Monolog\Logger::addDebug', 'info' => 'Monolog\Logger::addInfo', 'notice' => 'Monolog\Logger::addNotice', @@ -69,8 +67,8 @@ return array( 'critical' => 'Monolog\Logger::addCritical', 'alert' => 'Monolog\Logger::addAlert', 'emergency' => 'Monolog\Logger::addEmergency', - ) - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -82,9 +80,9 @@ return array( | */ - 'interfaces' => array( + 'interfaces' => [ - ), + ], /* |-------------------------------------------------------------------------- @@ -112,9 +110,9 @@ return array( | ), | */ - 'custom_db_types' => array( + 'custom_db_types' => [ - ), + ], /* |-------------------------------------------------------------------------- @@ -142,4 +140,4 @@ return array( */ 'model_camel_case_properties' => false, -); +]; diff --git a/config/installer.php b/config/installer.php index 743eab58..6922b048 100644 --- a/config/installer.php +++ b/config/installer.php @@ -2,9 +2,9 @@ return [ 'php' => [ - # You can change this to a lower version, the lowest - # can be 7.0. However, there's no guarantee that things - # will work properly. Change at your peril! - 'version' => '7.1.3' - ] + // You can change this to a lower version, the lowest + // can be 7.0. However, there's no guarantee that things + // will work properly. Change at your peril! + 'version' => '7.1.3', + ], ]; diff --git a/config/laratrust.php b/config/laratrust.php index c4151f11..4ee117e7 100644 --- a/config/laratrust.php +++ b/config/laratrust.php @@ -5,7 +5,6 @@ * a role & permission management solution for Laravel. * * @license MIT - * @package Laratrust */ return [ @@ -81,17 +80,17 @@ return [ | */ 'models' => [ - /** + /* * Role model */ 'role' => 'App\Models\Role', - /** + /* * Permission model */ 'permission' => 'App\Models\Permission', - /** + /* * Team model */ 'team' => 'App\Team', @@ -107,32 +106,32 @@ return [ | */ 'tables' => [ - /** + /* * Roles table. */ 'roles' => 'roles', - /** + /* * Permissions table. */ 'permissions' => 'permissions', - /** + /* * Teams table. */ 'teams' => 'teams', - /** + /* * Role - User intermediate table. */ 'role_user' => 'role_user', - /** + /* * Permission - User intermediate table. */ 'permission_user' => 'permission_user', - /** + /* * Permission - Role intermediate table. */ 'permission_role' => 'permission_role', @@ -148,22 +147,22 @@ return [ | */ 'foreign_keys' => [ - /** + /* * User foreign key on Laratrust's role_user and permission_user tables. */ 'user' => 'user_id', - /** + /* * Role foreign key on Laratrust's role_user and permission_role tables. */ 'role' => 'role_id', - /** + /* * Role foreign key on Laratrust's permission_user and permission_role tables. */ 'permission' => 'permission_id', - /** + /* * Role foreign key on Laratrust's role_user and permission_user tables. */ 'team' => 'team_id', @@ -179,18 +178,18 @@ return [ | */ 'middleware' => [ - /** + /* * Define if the laratrust middleware are registered automatically in the service provider */ 'register' => true, - /** + /* * Method to be called in the middleware return case. * Available: abort|redirect */ 'handling' => 'abort', - /** + /* * Parameter passed to the middleware_handling method */ 'params' => '403', diff --git a/config/laravel-widgets.php b/config/laravel-widgets.php index 108a50aa..b44007fd 100644 --- a/config/laravel-widgets.php +++ b/config/laravel-widgets.php @@ -10,6 +10,6 @@ return [ */ 'route_middleware' => [], - 'widget_stub' => 'resources/stubs/widgets/widget.stub', - 'widget_plain_stub' => 'resources/stubs/widgets/widget_plain.stub', + 'widget_stub' => 'resources/stubs/widgets/widget.stub', + 'widget_plain_stub' => 'resources/stubs/widgets/widget_plain.stub', ]; diff --git a/config/logging.php b/config/logging.php index 288b2a00..a423e38c 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,4 +1,5 @@ [ 'stack' => [ - 'driver' => 'stack', + 'driver' => 'stack', 'channels' => [ 'daily', - # PHP_SAPI === 'cli' ? 'console' : 'daily', + // PHP_SAPI === 'cli' ? 'console' : 'daily', ], ], 'cron' => [ - 'driver' => 'stack', + 'driver' => 'stack', 'channels' => [ 'cron_rotating', 'stdout', @@ -42,39 +43,39 @@ return [ ], 'single' => [ 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', ], 'daily' => [ 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', - 'days' => 3, + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + 'days' => 3, ], 'cron_rotating' => [ 'driver' => 'daily', - 'path' => storage_path('logs/cron.log'), - 'level' => 'debug', - 'days' => 3, + 'path' => storage_path('logs/cron.log'), + 'level' => 'debug', + 'days' => 3, ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => 'critical', + 'emoji' => ':boom:', + 'level' => 'critical', ], 'stdout' => [ 'driver' => 'custom', - 'via' => \App\Console\Logger::class, + 'via' => \App\Console\Logger::class, ], 'syslog' => [ 'driver' => 'syslog', - 'level' => 'debug', + 'level' => 'debug', ], 'errorlog' => [ 'driver' => 'errorlog', - 'level' => 'debug', + 'level' => 'debug', ], ], ]; diff --git a/config/mail.php b/config/mail.php index faf8715f..0fb7b4ff 100755 --- a/config/mail.php +++ b/config/mail.php @@ -1,7 +1,6 @@ [ - 'name' => env('MAIL_FROM_NAME', 'phpVMS Admin'), + 'name' => env('MAIL_FROM_NAME', 'phpVMS Admin'), 'address' => env('MAIL_FROM_ADDRESS', 'no-reply@phpvms.net'), ], diff --git a/config/map.php b/config/map.php index 3c4e8961..5a268dc1 100644 --- a/config/map.php +++ b/config/map.php @@ -4,13 +4,13 @@ */ return [ - /** + /* * This can really be any METAR service, as long as it returns GeoJSON */ 'metar_wms' => [ - 'url' => 'https://ogcie.iblsoft.com/observations?', + 'url' => 'https://ogcie.iblsoft.com/observations?', 'params' => [ - 'layers' => 'metar' + 'layers' => 'metar', ], ], ]; diff --git a/config/modules.php b/config/modules.php index 6f4bd3ce..e96331d0 100644 --- a/config/modules.php +++ b/config/modules.php @@ -3,9 +3,9 @@ return [ 'namespace' => 'Modules', 'stubs' => [ - 'enabled' => true, - 'path' => resource_path().'/stubs/modules', - 'files' => [ + 'enabled' => true, + 'path' => resource_path().'/stubs/modules', + 'files' => [ 'routes' => 'Http/Routes/web.php', 'routes-api' => 'Http/Routes/api.php', 'routes-admin' => 'Http/Routes/admin.php', @@ -43,9 +43,9 @@ return [ 'MODULE_NAMESPACE', ], ], - 'gitkeep' => false, + 'gitkeep' => false, ], - 'paths' => [ + 'paths' => [ 'modules' => base_path('modules'), 'assets' => public_path('modules'), 'migration' => base_path('database/migrations'), @@ -118,7 +118,7 @@ return [ | Here is the config for setting up caching feature. | */ - 'cache' => [ + 'cache' => [ 'enabled' => true, 'key' => 'phpvms-modules', 'lifetime' => 60, diff --git a/config/money.php b/config/money.php index f00de574..167d91e9 100644 --- a/config/money.php +++ b/config/money.php @@ -1,7 +1,6 @@ [ 'name' => 'UAE Dirham', 'code' => 784, diff --git a/config/phpvms.php b/config/phpvms.php index 1a303d31..92a16a14 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -10,13 +10,12 @@ */ return [ - - /** + /* * Check for if we're "installed" or not */ 'installed' => env('PHPVMS_INSTALLED', false), - /** + /* * The ISO "Currency Code" to use, the list is in config/money.php * * Note, do not change this after you've set it, unless you don't @@ -24,44 +23,44 @@ return [ */ 'currency' => 'USD', - /** + /* * Point to the class to use to retrieve the METAR string. If this * goes inactive at some date, it can be replaced */ 'metar' => App\Services\Metar\AviationWeather::class, - /** + /* * Your vaCentral API key */ 'vacentral_api_key' => env('VACENTRAL_API_KEY', ''), - /** + /* * vaCentral API URL. You likely don't need to change this */ 'vacentral_api_url' => 'https://api.vacentral.net', - /** + /* * Misc Settings */ 'news_feed_url' => 'http://forum.phpvms.net/rss/1-announcements-feed.xml/?', - /** + /* * URL to the latest version file */ 'version_file' => 'http://downloads.phpvms.net/VERSION', - /** + /* * DO NOT CHANGE THESE! It will result in messed up data * The setting you're looking for is in the admin panel, * under settings, for the display units */ 'internal_units' => [ - 'altitude' => 'feet', - 'distance' => 'nmi', - 'fuel' => 'lbs', - 'mass' => 'lbs', - 'velocity' => 'knots', - 'volume' => 'gallons', + 'altitude' => 'feet', + 'distance' => 'nmi', + 'fuel' => 'lbs', + 'mass' => 'lbs', + 'velocity' => 'knots', + 'volume' => 'gallons', ], /* @@ -70,7 +69,7 @@ return [ * Both parameters are in px. */ 'avatar' => [ - 'width' => '200', + 'width' => '200', 'height' => '200', ], ]; diff --git a/config/queue.php b/config/queue.php index 7a150cfe..e4026e0d 100755 --- a/config/queue.php +++ b/config/queue.php @@ -1,7 +1,6 @@ [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', + 'key' => 'your-public-key', 'secret' => 'your-secret-key', 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', + 'queue' => 'your-queue-name', 'region' => 'us-east-1', ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'default', 'retry_after' => 90, ], ], @@ -78,7 +77,7 @@ return [ 'failed' => [ 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/repository.php b/config/repository.php index 4e403514..b020da00 100644 --- a/config/repository.php +++ b/config/repository.php @@ -7,7 +7,6 @@ | */ return [ - /* |-------------------------------------------------------------------------- | Repository Pagination Limit Default @@ -15,7 +14,7 @@ return [ | */ 'pagination' => [ - 'limit' => 15 + 'limit' => 15, ], /* @@ -30,11 +29,11 @@ return [ JsonApiSerializer */ - 'fractal' => [ - 'params' => [ - 'include' => 'include' + 'fractal' => [ + 'params' => [ + 'include' => 'include', ], - 'serializer' => League\Fractal\Serializer\DataArraySerializer::class + 'serializer' => League\Fractal\Serializer\DataArraySerializer::class, ], /* @@ -43,7 +42,7 @@ return [ |-------------------------------------------------------------------------- | */ - 'cache' => [ + 'cache' => [ /* |-------------------------------------------------------------------------- | Cache Status @@ -52,7 +51,7 @@ return [ | Enable or disable cache | */ - 'enabled' => env('CACHE_ENABLED', false), + 'enabled' => env('CACHE_ENABLED', false), /* |-------------------------------------------------------------------------- @@ -62,7 +61,7 @@ return [ | Time of expiration cache | */ - 'minutes' => 30, + 'minutes' => 30, /* |-------------------------------------------------------------------------- @@ -82,7 +81,7 @@ return [ | | */ - 'clean' => [ + 'clean' => [ /* |-------------------------------------------------------------------------- @@ -102,14 +101,14 @@ return [ | delete : Clear Cache on delete Entry in repository | */ - 'on' => [ + 'on' => [ 'create' => true, 'update' => true, 'delete' => true, - ] + ], ], - 'params' => [ + 'params' => [ /* |-------------------------------------------------------------------------- | Skip Cache Params @@ -119,7 +118,7 @@ return [ | Ex: http://prettus.local/?search=lorem&skipCache=true | */ - 'skipCache' => 'skipCache' + 'skipCache' => 'skipCache', ], /* @@ -137,10 +136,10 @@ return [ | | 'except' =>['find'], */ - 'allowed' => [ + 'allowed' => [ 'only' => null, - 'except' => null - ] + 'except' => null, + ], ], /* @@ -151,7 +150,7 @@ return [ | Settings of request parameters names that will be used by Criteria | */ - 'criteria' => [ + 'criteria' => [ /* |-------------------------------------------------------------------------- | Accepted Conditions @@ -169,7 +168,7 @@ return [ */ 'acceptedConditions' => [ '=', - 'like' + 'like', ], /* |-------------------------------------------------------------------------- @@ -203,14 +202,14 @@ return [ | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc | */ - 'params' => [ + 'params' => [ 'search' => 'search', 'searchFields' => 'searchFields', 'filter' => 'filter', 'orderBy' => 'orderBy', 'sortedBy' => 'sortedBy', - 'with' => 'with' - ] + 'with' => 'with', + ], ], /* |-------------------------------------------------------------------------- @@ -218,20 +217,20 @@ return [ |-------------------------------------------------------------------------- | */ - 'generator' => [ + 'generator' => [ 'basePath' => app_path(), 'rootNamespace' => 'App\\', 'paths' => [ - 'models' => 'Models', - 'repositories' => 'Repositories', - 'interfaces' => 'Repositories', - 'transformers' => 'Transformers', - 'presenters' => 'Presenters', - 'validators' => 'Validators', - 'controllers' => 'Http/Controllers', - 'provider' => 'RepositoryServiceProvider', - 'criteria' => 'Criteria', - 'stubsOverridePath' => app_path() - ] - ] + 'models' => 'Models', + 'repositories' => 'Repositories', + 'interfaces' => 'Repositories', + 'transformers' => 'Transformers', + 'presenters' => 'Presenters', + 'validators' => 'Validators', + 'controllers' => 'Http/Controllers', + 'provider' => 'RepositoryServiceProvider', + 'criteria' => 'Criteria', + 'stubsOverridePath' => app_path(), + ], + ], ]; diff --git a/config/services.php b/config/services.php index 4460f0ec..fe795b74 100755 --- a/config/services.php +++ b/config/services.php @@ -1,7 +1,6 @@ [ - 'key' => env('SES_KEY'), + 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), 'region' => 'us-east-1', ], @@ -30,8 +29,8 @@ return [ ], 'stripe' => [ - 'model' => App\User::class, - 'key' => env('STRIPE_KEY'), + 'model' => App\User::class, + 'key' => env('STRIPE_KEY'), 'secret' => env('STRIPE_SECRET'), ], diff --git a/config/session.php b/config/session.php index 5ec53db7..76e8ef5f 100755 --- a/config/session.php +++ b/config/session.php @@ -1,7 +1,6 @@ env('SESSION_DRIVER', 'file'), - 'lifetime' => 120, + 'driver' => env('SESSION_DRIVER', 'file'), + 'lifetime' => 120, 'expire_on_close' => false, - 'encrypt' => false, - 'files' => storage_path('framework/sessions'), - 'connection' => null, - 'table' => 'sessions', - 'store' => null, - 'lottery' => [1, 100], - 'cookie' => 'phpvms_session', - 'path' => '/', - 'domain' => env('SESSION_DOMAIN', null), - 'secure' => false, - 'http_only' => true, + 'encrypt' => false, + 'files' => storage_path('framework/sessions'), + 'connection' => null, + 'table' => 'sessions', + 'store' => null, + 'lottery' => [1, 100], + 'cookie' => 'phpvms_session', + 'path' => '/', + 'domain' => env('SESSION_DOMAIN', null), + 'secure' => false, + 'http_only' => true, ]; diff --git a/config/themes.php b/config/themes.php index a14372ba..662125d9 100644 --- a/config/themes.php +++ b/config/themes.php @@ -1,68 +1,68 @@ resource_path('views/layouts'), // eg: base_path('resources/themes') - 'asset_not_found' => 'LOG_ERROR', - 'default' => 'default', - 'cache' => true, + 'themes_path' => resource_path('views/layouts'), // eg: base_path('resources/themes') + 'asset_not_found' => 'LOG_ERROR', + 'default' => 'default', + 'cache' => true, - /* - |-------------------------------------------------------------------------- - | Define available themes. Format: - | - | 'theme-name' => [ - | 'extends' => 'theme-to-extend', // optional - | 'views-path' => 'path-to-views', // defaults to: resources/views/theme-name - | 'asset-path' => 'path-to-assets', // defaults to: public/theme-name - | - | // You can add your own custom keys - | // Use Theme::getSetting('key') & Theme::setSetting('key', 'value') to access them - | 'key' => 'value', - | ], - | - |-------------------------------------------------------------------------- - */ + /* + |-------------------------------------------------------------------------- + | Define available themes. Format: + | + | 'theme-name' => [ + | 'extends' => 'theme-to-extend', // optional + | 'views-path' => 'path-to-views', // defaults to: resources/views/theme-name + | 'asset-path' => 'path-to-assets', // defaults to: public/theme-name + | + | // You can add your own custom keys + | // Use Theme::getSetting('key') & Theme::setSetting('key', 'value') to access them + | 'key' => 'value', + | ], + | + |-------------------------------------------------------------------------- + */ - 'themes' => [ + 'themes' => [ - 'default' => [ - 'extends' => 'false' + 'default' => [ + 'extends' => 'false', ], // Add your themes here. These settings will override theme.json settings defined for each theme - /* - |---------------------------[ Example Structure ]-------------------------- - | - | // Full theme Syntax: - | - | 'example1' => [ - | 'extends' => null, // doesn't extend any theme - | 'views-path' => example, // = resources/views/example_theme - | 'asset-path' => example, // = public/example_theme - | ], - | - | // Use all Defaults: - | - | 'example2', // Assets =\public\example2, Views =\resources\views\example2 - | // Note that if you use all default values, you can omit declaration completely. - | // i.e. defaults will be used when you call Theme::set('undefined-theme') - | - | - | // This theme shares the views with example2 but defines its own assets in \public\example3 - | - | 'example3' => [ - | 'views-path' => 'example', - | ], - | - | // This theme extends example1 and may override SOME views\assets in its own paths - | - | 'example4' => [ - | 'extends' => 'example1', - | ], - | - |-------------------------------------------------------------------------- - */ - ], + /* + |---------------------------[ Example Structure ]-------------------------- + | + | // Full theme Syntax: + | + | 'example1' => [ + | 'extends' => null, // doesn't extend any theme + | 'views-path' => example, // = resources/views/example_theme + | 'asset-path' => example, // = public/example_theme + | ], + | + | // Use all Defaults: + | + | 'example2', // Assets =\public\example2, Views =\resources\views\example2 + | // Note that if you use all default values, you can omit declaration completely. + | // i.e. defaults will be used when you call Theme::set('undefined-theme') + | + | + | // This theme shares the views with example2 but defines its own assets in \public\example3 + | + | 'example3' => [ + | 'views-path' => 'example', + | ], + | + | // This theme extends example1 and may override SOME views\assets in its own paths + | + | 'example4' => [ + | 'extends' => 'example1', + | ], + | + |-------------------------------------------------------------------------- + */ + ], ]; diff --git a/config/vacentral.php b/config/vacentral.php index d07e525d..e57709f4 100644 --- a/config/vacentral.php +++ b/config/vacentral.php @@ -4,12 +4,12 @@ */ return [ - /** + /* * Your vaCentral API key */ 'api_key' => env('VACENTRAL_API_KEY', ''), - /** + /* * vaCentral API URL. You likely don't need to change this */ 'api_url' => 'https://api.vacentral.net', diff --git a/config/view.php b/config/view.php index feecf812..3bbe20f3 100755 --- a/config/view.php +++ b/config/view.php @@ -1,7 +1,6 @@ setPublicPath(__DIR__ . '/public'); +$app->setPublicPath(__DIR__.'/public'); $app->setPublicUrlPath(env('APP_PUBLIC_URL', '/public')); $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); diff --git a/public/index.php b/public/index.php index fdb2ec1c..e87c0855 100755 --- a/public/index.php +++ b/public/index.php @@ -9,7 +9,6 @@ * folder, be sure to go into the bootstrap/app.php file, and change * the 'path.public' path to where it lives. */ - $path_to_phpvms_folder = __DIR__.'/../'; require $path_to_phpvms_folder.'/bootstrap/autoload.php'; diff --git a/resources/lang/en/aircraft.php b/resources/lang/en/aircraft.php index 56027eb6..9991e15f 100644 --- a/resources/lang/en/aircraft.php +++ b/resources/lang/en/aircraft.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/en/airports.php b/resources/lang/en/airports.php index 81d044fa..9edc5cc1 100644 --- a/resources/lang/en/airports.php +++ b/resources/lang/en/airports.php @@ -1,7 +1,5 @@ 'Identification', diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index 009c2b4c..42c81bc2 100644 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -1,7 +1,5 @@ 'Dashboard', diff --git a/resources/lang/en/dashboard.php b/resources/lang/en/dashboard.php index 91a195fe..28dbc0ae 100644 --- a/resources/lang/en/dashboard.php +++ b/resources/lang/en/dashboard.php @@ -1,7 +1,5 @@ 'Total Hours', diff --git a/resources/lang/en/downloads.php b/resources/lang/en/downloads.php index 3e939470..adb145f6 100644 --- a/resources/lang/en/downloads.php +++ b/resources/lang/en/downloads.php @@ -1,7 +1,5 @@ 'There are no downloads!', diff --git a/resources/lang/en/email.php b/resources/lang/en/email.php index 74e5fc03..bfce5ac0 100644 --- a/resources/lang/en/email.php +++ b/resources/lang/en/email.php @@ -1,10 +1,7 @@ - 'If you’re having trouble clicking the ":actiontext" button, ' . + 'buttontroubles' => 'If you’re having trouble clicking the ":actiontext" button, '. 'copy and paste the URL below into your web browser:', ]; diff --git a/resources/lang/en/errors.php b/resources/lang/en/errors.php index 6797450f..e3a88167 100644 --- a/resources/lang/en/errors.php +++ b/resources/lang/en/errors.php @@ -1,19 +1,15 @@ [ '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 here to go back to the home page.', ], '404' => [ '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 here to go back to the home page.', ], '503' => [ diff --git a/resources/lang/en/expenses.php b/resources/lang/en/expenses.php index 5cba3658..52c78f67 100644 --- a/resources/lang/en/expenses.php +++ b/resources/lang/en/expenses.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/en/flights.php b/resources/lang/en/flights.php index 73b99f16..efc9d9e5 100644 --- a/resources/lang/en/flights.php +++ b/resources/lang/en/flights.php @@ -1,7 +1,5 @@ 'Flight Number', diff --git a/resources/lang/en/home.php b/resources/lang/en/home.php index 59113c12..c94e5861 100644 --- a/resources/lang/en/home.php +++ b/resources/lang/en/home.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/en/installer.php b/resources/lang/en/installer.php index 59f281dd..eada5694 100644 --- a/resources/lang/en/installer.php +++ b/resources/lang/en/installer.php @@ -1,246 +1,245 @@ - 'phpVMS Installer', - 'next' => 'Next Step', - 'back' => 'Previous', - 'finish' => 'Install', - 'forms' => [ - 'errorTitle' => 'The Following errors occurred:', - ], - - /** - * - * Home page translations. - * - */ - 'welcome' => [ - 'templateTitle' => 'Welcome', - 'title' => 'phpVMS Installer', - 'message' => 'Easy Installation and Setup Wizard.', - 'next' => 'Check Requirements', - ], - - /** - * - * Requirements page translations. - * - */ - 'requirements' => [ - 'templateTitle' => 'Step 1 | Server Requirements', - 'title' => 'Server Requirements', - 'next' => 'Check Permissions', - ], - - /** - * - * Permissions page translations. - * - */ - 'permissions' => [ - 'templateTitle' => 'Step 2 | Permissions', - 'title' => 'Permissions', - 'next' => 'Configure Environment', - ], - - /** - * - * Environment page translations. - * - */ - 'environment' => [ - 'menu' => [ - 'templateTitle' => 'Step 3 | Environment Settings', - 'title' => 'Environment Settings', - 'desc' => 'Please select how you want to configure the apps .env file.', - 'wizard-button' => 'Form Wizard Setup', - 'classic-button' => 'Classic Text Editor', - ], - 'wizard' => [ - 'templateTitle' => 'Step 3 | Environment Settings | Guided Wizard', - 'title' => 'Guided .env Wizard', - 'tabs' => [ - 'environment' => 'Environment', - 'database' => 'Database', - 'application' => 'Application' - ], - 'form' => [ - 'name_required' => 'An environment name is required.', - 'app_name_label' => 'App Name', - 'app_name_placeholder' => 'App Name', - 'app_environment_label' => 'App Environment', - 'app_environment_label_local' => 'Local', - 'app_environment_label_developement' => 'Development', - 'app_environment_label_qa' => 'Qa', - 'app_environment_label_production' => 'Production', - 'app_environment_label_other' => 'Other', - 'app_environment_placeholder_other' => 'Enter your environment...', - 'app_debug_label' => 'App Debug', - 'app_debug_label_true' => 'True', - 'app_debug_label_false' => 'False', - 'app_log_level_label' => 'App Log Level', - 'app_log_level_label_debug' => 'debug', - 'app_log_level_label_info' => 'info', - 'app_log_level_label_notice' => 'notice', - 'app_log_level_label_warning' => 'warning', - 'app_log_level_label_error' => 'error', - 'app_log_level_label_critical' => 'critical', - 'app_log_level_label_alert' => 'alert', - 'app_log_level_label_emergency' => 'emergency', - 'app_url_label' => 'App Url', - 'app_url_placeholder' => 'App Url', - 'db_connection_label' => 'Database Connection', - 'db_connection_label_mysql' => 'mysql', - 'db_connection_label_sqlite' => 'sqlite', - 'db_connection_label_pgsql' => 'pgsql', - 'db_connection_label_sqlsrv' => 'sqlsrv', - 'db_host_label' => 'Database Host', - 'db_host_placeholder' => 'Database Host', - 'db_port_label' => 'Database Port', - 'db_port_placeholder' => 'Database Port', - 'db_name_label' => 'Database Name', - 'db_name_placeholder' => 'Database Name', - 'db_username_label' => 'Database User Name', - 'db_username_placeholder' => 'Database User Name', - 'db_password_label' => 'Database Password', - 'db_password_placeholder' => 'Database Password', - - 'app_tabs' => [ - 'more_info' => 'More Info', - 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', - 'broadcasting_label' => 'Broadcast Driver', - 'broadcasting_placeholder' => 'Broadcast Driver', - 'cache_label' => 'Cache Driver', - 'cache_placeholder' => 'Cache Driver', - 'session_label' => 'Session Driver', - 'session_placeholder' => 'Session Driver', - 'queue_label' => 'Queue Driver', - 'queue_placeholder' => 'Queue Driver', - 'redis_label' => 'Redis Driver', - 'redis_host' => 'Redis Host', - 'redis_password' => 'Redis Password', - 'redis_port' => 'Redis Port', - - 'mail_label' => 'Mail', - 'mail_driver_label' => 'Mail Driver', - 'mail_driver_placeholder' => 'Mail Driver', - 'mail_host_label' => 'Mail Host', - 'mail_host_placeholder' => 'Mail Host', - 'mail_port_label' => 'Mail Port', - 'mail_port_placeholder' => 'Mail Port', - 'mail_username_label' => 'Mail Username', - 'mail_username_placeholder' => 'Mail Username', - 'mail_password_label' => 'Mail Password', - 'mail_password_placeholder' => 'Mail Password', - 'mail_encryption_label' => 'Mail Encryption', - 'mail_encryption_placeholder' => 'Mail Encryption', - - 'pusher_label' => 'Pusher', - 'pusher_app_id_label' => 'Pusher App Id', - 'pusher_app_id_palceholder' => 'Pusher App Id', - 'pusher_app_key_label' => 'Pusher App Key', - 'pusher_app_key_palceholder' => 'Pusher App Key', - 'pusher_app_secret_label' => 'Pusher App Secret', - 'pusher_app_secret_palceholder' => 'Pusher App Secret', - ], - 'buttons' => [ - 'setup_database' => 'Setup Database', - 'setup_application' => 'Setup Application', - 'install' => 'Install', - ], - ], - ], - 'classic' => [ - 'templateTitle' => 'Step 3 | Environment Settings | Classic Editor', - 'title' => 'Classic Environment Editor', - 'save' => 'Save .env', - 'back' => 'Use Form Wizard', - 'install' => 'Save and Install', - ], - 'success' => 'Your .env file settings have been saved.', - 'errors' => 'Unable to save the .env file, Please create it manually.', - ], - - 'install' => 'Install', - - /** - * - * Installed Log translations. - * - */ - 'installed' => [ - 'success_log_message' => 'Laravel Installer successfully INSTALLED on ', - ], - - /** - * - * Final page translations. - * - */ - 'final' => [ - 'title' => 'Installation Finished', - 'templateTitle' => 'Installation Finished', - 'finished' => 'Application has been successfully installed.', - 'migration' => 'Migration & Seed Console Output:', - 'console' => 'Application Console Output:', - 'log' => 'Installation Log Entry:', - 'env' => 'Final .env File:', - 'exit' => 'Click here to exit', - ], - - /** - * - * Update specific translations - * - */ - 'updater' => [ - /** - * - * Shared translations. - * - */ - 'title' => 'Laravel Updater', - - /** - * - * Welcome page translations for update feature. - * - */ - 'welcome' => [ - 'title' => 'Welcome To The Updater', - 'message' => 'Welcome to the update wizard.', - ], - - /** - * - * Welcome page translations for update feature. - * - */ - 'overview' => [ - 'title' => 'Overview', - 'message' => 'There is 1 update.|There are :number updates.', - 'install_updates' => "Install Updates" - ], - - /** - * - * Final page translations. - * - */ - 'final' => [ - 'title' => 'Finished', - 'finished' => 'Application\'s database has been successfully updated.', - 'exit' => 'Click here to exit', - ], - - 'log' => [ - 'success_message' => 'Laravel Installer successfully UPDATED on ', - ], - ], -]; + 'phpVMS Installer', + 'next' => 'Next Step', + 'back' => 'Previous', + 'finish' => 'Install', + 'forms' => [ + 'errorTitle' => 'The Following errors occurred:', + ], + + /* + * + * Home page translations. + * + */ + 'welcome' => [ + 'templateTitle' => 'Welcome', + 'title' => 'phpVMS Installer', + 'message' => 'Easy Installation and Setup Wizard.', + 'next' => 'Check Requirements', + ], + + /* + * + * Requirements page translations. + * + */ + 'requirements' => [ + 'templateTitle' => 'Step 1 | Server Requirements', + 'title' => 'Server Requirements', + 'next' => 'Check Permissions', + ], + + /* + * + * Permissions page translations. + * + */ + 'permissions' => [ + 'templateTitle' => 'Step 2 | Permissions', + 'title' => 'Permissions', + 'next' => 'Configure Environment', + ], + + /* + * + * Environment page translations. + * + */ + 'environment' => [ + 'menu' => [ + 'templateTitle' => 'Step 3 | Environment Settings', + 'title' => 'Environment Settings', + 'desc' => 'Please select how you want to configure the apps .env file.', + 'wizard-button' => 'Form Wizard Setup', + 'classic-button' => 'Classic Text Editor', + ], + 'wizard' => [ + 'templateTitle' => 'Step 3 | Environment Settings | Guided Wizard', + 'title' => 'Guided .env Wizard', + 'tabs' => [ + 'environment' => 'Environment', + 'database' => 'Database', + 'application' => 'Application', + ], + 'form' => [ + 'name_required' => 'An environment name is required.', + 'app_name_label' => 'App Name', + 'app_name_placeholder' => 'App Name', + 'app_environment_label' => 'App Environment', + 'app_environment_label_local' => 'Local', + 'app_environment_label_developement' => 'Development', + 'app_environment_label_qa' => 'Qa', + 'app_environment_label_production' => 'Production', + 'app_environment_label_other' => 'Other', + 'app_environment_placeholder_other' => 'Enter your environment...', + 'app_debug_label' => 'App Debug', + 'app_debug_label_true' => 'True', + 'app_debug_label_false' => 'False', + 'app_log_level_label' => 'App Log Level', + 'app_log_level_label_debug' => 'debug', + 'app_log_level_label_info' => 'info', + 'app_log_level_label_notice' => 'notice', + 'app_log_level_label_warning' => 'warning', + 'app_log_level_label_error' => 'error', + 'app_log_level_label_critical' => 'critical', + 'app_log_level_label_alert' => 'alert', + 'app_log_level_label_emergency' => 'emergency', + 'app_url_label' => 'App Url', + 'app_url_placeholder' => 'App Url', + 'db_connection_label' => 'Database Connection', + 'db_connection_label_mysql' => 'mysql', + 'db_connection_label_sqlite' => 'sqlite', + 'db_connection_label_pgsql' => 'pgsql', + 'db_connection_label_sqlsrv' => 'sqlsrv', + 'db_host_label' => 'Database Host', + 'db_host_placeholder' => 'Database Host', + 'db_port_label' => 'Database Port', + 'db_port_placeholder' => 'Database Port', + 'db_name_label' => 'Database Name', + 'db_name_placeholder' => 'Database Name', + 'db_username_label' => 'Database User Name', + 'db_username_placeholder' => 'Database User Name', + 'db_password_label' => 'Database Password', + 'db_password_placeholder' => 'Database Password', + + 'app_tabs' => [ + 'more_info' => 'More Info', + 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', + 'broadcasting_label' => 'Broadcast Driver', + 'broadcasting_placeholder' => 'Broadcast Driver', + 'cache_label' => 'Cache Driver', + 'cache_placeholder' => 'Cache Driver', + 'session_label' => 'Session Driver', + 'session_placeholder' => 'Session Driver', + 'queue_label' => 'Queue Driver', + 'queue_placeholder' => 'Queue Driver', + 'redis_label' => 'Redis Driver', + 'redis_host' => 'Redis Host', + 'redis_password' => 'Redis Password', + 'redis_port' => 'Redis Port', + + 'mail_label' => 'Mail', + 'mail_driver_label' => 'Mail Driver', + 'mail_driver_placeholder' => 'Mail Driver', + 'mail_host_label' => 'Mail Host', + 'mail_host_placeholder' => 'Mail Host', + 'mail_port_label' => 'Mail Port', + 'mail_port_placeholder' => 'Mail Port', + 'mail_username_label' => 'Mail Username', + 'mail_username_placeholder' => 'Mail Username', + 'mail_password_label' => 'Mail Password', + 'mail_password_placeholder' => 'Mail Password', + 'mail_encryption_label' => 'Mail Encryption', + 'mail_encryption_placeholder' => 'Mail Encryption', + + 'pusher_label' => 'Pusher', + 'pusher_app_id_label' => 'Pusher App Id', + 'pusher_app_id_palceholder' => 'Pusher App Id', + 'pusher_app_key_label' => 'Pusher App Key', + 'pusher_app_key_palceholder' => 'Pusher App Key', + 'pusher_app_secret_label' => 'Pusher App Secret', + 'pusher_app_secret_palceholder' => 'Pusher App Secret', + ], + 'buttons' => [ + 'setup_database' => 'Setup Database', + 'setup_application' => 'Setup Application', + 'install' => 'Install', + ], + ], + ], + 'classic' => [ + 'templateTitle' => 'Step 3 | Environment Settings | Classic Editor', + 'title' => 'Classic Environment Editor', + 'save' => 'Save .env', + 'back' => 'Use Form Wizard', + 'install' => 'Save and Install', + ], + 'success' => 'Your .env file settings have been saved.', + 'errors' => 'Unable to save the .env file, Please create it manually.', + ], + + 'install' => 'Install', + + /* + * + * Installed Log translations. + * + */ + 'installed' => [ + 'success_log_message' => 'Laravel Installer successfully INSTALLED on ', + ], + + /* + * + * Final page translations. + * + */ + 'final' => [ + 'title' => 'Installation Finished', + 'templateTitle' => 'Installation Finished', + 'finished' => 'Application has been successfully installed.', + 'migration' => 'Migration & Seed Console Output:', + 'console' => 'Application Console Output:', + 'log' => 'Installation Log Entry:', + 'env' => 'Final .env File:', + 'exit' => 'Click here to exit', + ], + + /* + * + * Update specific translations + * + */ + 'updater' => [ + /* + * + * Shared translations. + * + */ + 'title' => 'Laravel Updater', + + /* + * + * Welcome page translations for update feature. + * + */ + 'welcome' => [ + 'title' => 'Welcome To The Updater', + 'message' => 'Welcome to the update wizard.', + ], + + /* + * + * Welcome page translations for update feature. + * + */ + 'overview' => [ + 'title' => 'Overview', + 'message' => 'There is 1 update.|There are :number updates.', + 'install_updates' => 'Install Updates', + ], + + /* + * + * Final page translations. + * + */ + 'final' => [ + 'title' => 'Finished', + 'finished' => 'Application\'s database has been successfully updated.', + 'exit' => 'Click here to exit', + ], + + 'log' => [ + 'success_message' => 'Laravel Installer successfully UPDATED on ', + ], + ], +]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index fcab34b2..85ea1c51 100755 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -1,7 +1,6 @@ 'New Flight Report', @@ -36,7 +34,7 @@ return [ 'manual' => 'Manual', 'acars' => 'ACARS', ], - 'state' => [ + 'state' => [ 'accepted' => 'Accepted', 'pending' => 'Pending Approval', 'rejected' => 'Rejected', @@ -67,5 +65,5 @@ return [ 'arrived' => 'Arrived', 'cancelled' => 'Cancelled', 'emerg_decent' => 'Emergency decent', - ] + ], ]; diff --git a/resources/lang/en/profile.php b/resources/lang/en/profile.php index d64d2c04..552c7771 100644 --- a/resources/lang/en/profile.php +++ b/resources/lang/en/profile.php @@ -1,10 +1,8 @@ 'This avatar will be resized to :width x :height pixels', + 'avatarresize' => 'This avatar will be resized to :width x :height pixels', 'newapikey' => 'New API Key', 'yourprofile' => 'Your Profile', diff --git a/resources/lang/en/toc.php b/resources/lang/en/toc.php index c9528a10..afea70f5 100644 --- a/resources/lang/en/toc.php +++ b/resources/lang/en/toc.php @@ -1,7 +1,5 @@ 'Terms and Conditions', diff --git a/resources/lang/en/user.php b/resources/lang/en/user.php index 426a4046..d985fc14 100644 --- a/resources/lang/en/user.php +++ b/resources/lang/en/user.php @@ -1,11 +1,9 @@ 'Location', - 'state' => [ + 'state' => [ 'pending' => 'Pending', 'active' => 'Active', 'rejected' => 'Rejected', diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index bb1bf4b6..9952b398 100755 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -1,52 +1,51 @@ 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'between' => [ + 'accepted' => 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', 'file' => 'The :attribute must be between :min and :max kilobytes.', 'string' => 'The :attribute must be between :min and :max characters.', 'array' => 'The :attribute must have between :min and :max items.', ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The ":attribute" is required.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'max' => [ + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The ":attribute" is required.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', 'file' => 'The :attribute may not be greater than :max kilobytes.', 'string' => 'The :attribute may not be greater than :max characters.', 'array' => 'The :attribute may not have more than :max items.', ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'min' => [ + 'mimes' => 'The :attribute must be a file of type: :values.', + 'min' => [ 'numeric' => 'The :attribute must be at least :min.', 'file' => 'The :attribute must be at least :min kilobytes.', 'string' => 'The :attribute must be at least :min characters.', @@ -70,39 +69,39 @@ return [ 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', ], - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'url' => 'The :attribute format is invalid.', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'url' => 'The :attribute format is invalid.', - /** + /* * Custom Validation Language Lines */ 'custom' => [ - 'airline_id' => [ + 'airline_id' => [ 'required' => 'An airline is required', 'exists' => 'The airline doesn\'t exist', ], - 'aircraft_id' => [ + 'aircraft_id' => [ 'required' => 'An aircraft is required', 'exists' => 'The aircraft doesn\'t exist', ], - 'arr_airport_id' => [ + 'arr_airport_id' => [ 'required' => 'An arrival airport is required', ], - 'dpt_airport_id' => [ + 'dpt_airport_id' => [ 'required' => 'A departure airport is required', ], - 'flight_time' => [ + 'flight_time' => [ 'required' => 'Flight time, in minutes, is required', 'integer' => 'Flight time, in minutes, is required', ], - 'planned_flight_time' => [ + 'planned_flight_time' => [ 'required' => 'Flight time, in minutes, is required', 'integer' => 'Flight time, in minutes, is required', ], - 'source_name' => [ + 'source_name' => [ 'required' => 'PIREP Source is required', ], 'g-recaptcha-response' => [ @@ -111,7 +110,7 @@ return [ ], ], - /** + /* * Custom Validation Attributes */ diff --git a/resources/lang/en/widgets.php b/resources/lang/en/widgets.php index 76ef2c15..0a8cf62a 100644 --- a/resources/lang/en/widgets.php +++ b/resources/lang/en/widgets.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/es/aircraft.php b/resources/lang/es/aircraft.php index 3cc677dd..7de30624 100644 --- a/resources/lang/es/aircraft.php +++ b/resources/lang/es/aircraft.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/es/airports.php b/resources/lang/es/airports.php index 706dceb9..0ca454fd 100644 --- a/resources/lang/es/airports.php +++ b/resources/lang/es/airports.php @@ -1,7 +1,5 @@ 'Identificación', diff --git a/resources/lang/es/auth.php b/resources/lang/es/auth.php index 47bad3f1..18fb9f6f 100644 --- a/resources/lang/es/auth.php +++ b/resources/lang/es/auth.php @@ -1,19 +1,18 @@ 'Estas credenciales no coinciden con nuestros registros.', + 'failed' => 'Estas credenciales no coinciden con nuestros registros.', 'throttle' => 'Demasiados intentos de inicio de sesión. Por favor intente nuevamente en :seconds segundos.', ]; diff --git a/resources/lang/es/common.php b/resources/lang/es/common.php index 86145e76..2ce3dc57 100644 --- a/resources/lang/es/common.php +++ b/resources/lang/es/common.php @@ -1,7 +1,5 @@ 'Tablero', diff --git a/resources/lang/es/dashboard.php b/resources/lang/es/dashboard.php index 8dafa25f..fe0c1d14 100644 --- a/resources/lang/es/dashboard.php +++ b/resources/lang/es/dashboard.php @@ -1,7 +1,5 @@ 'Horas totales', diff --git a/resources/lang/es/downloads.php b/resources/lang/es/downloads.php index 7793301f..51fe4de6 100644 --- a/resources/lang/es/downloads.php +++ b/resources/lang/es/downloads.php @@ -1,7 +1,5 @@ '¡No hay descargas!', diff --git a/resources/lang/es/email.php b/resources/lang/es/email.php index 4dc2a900..f47919eb 100644 --- a/resources/lang/es/email.php +++ b/resources/lang/es/email.php @@ -1,10 +1,7 @@ - 'Si estas teniendo problemas haciendo clic en el botón ":actiontext", ' . + 'buttontroubles' => 'Si estas teniendo problemas haciendo clic en el botón ":actiontext", '. 'copia y pega la URL inferior en tu navegador web:', ]; diff --git a/resources/lang/es/errors.php b/resources/lang/es/errors.php index 787be238..85dd9cc9 100644 --- a/resources/lang/es/errors.php +++ b/resources/lang/es/errors.php @@ -1,19 +1,15 @@ [ '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 aquí para retroceder a la página de inicio.', ], '404' => [ '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 aquí para retroceder a la página de inicio.', ], '503' => [ diff --git a/resources/lang/es/expenses.php b/resources/lang/es/expenses.php index 3dbc1023..b0fc0272 100644 --- a/resources/lang/es/expenses.php +++ b/resources/lang/es/expenses.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/es/flights.php b/resources/lang/es/flights.php index 0272551b..b4f090d7 100644 --- a/resources/lang/es/flights.php +++ b/resources/lang/es/flights.php @@ -1,7 +1,5 @@ 'Número de vuelo', diff --git a/resources/lang/es/home.php b/resources/lang/es/home.php index 143dba61..04099b46 100644 --- a/resources/lang/es/home.php +++ b/resources/lang/es/home.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/es/installer.php b/resources/lang/es/installer.php index 45b4f56b..46d8bf96 100644 --- a/resources/lang/es/installer.php +++ b/resources/lang/es/installer.php @@ -1,175 +1,174 @@ 'Instalador de phpVMS', - 'next' => 'Siguiente', - 'back' => 'Anterior', + 'title' => 'Instalador de phpVMS', + 'next' => 'Siguiente', + 'back' => 'Anterior', 'finish' => 'Instalar', - 'forms' => [ + 'forms' => [ 'errorTitle' => 'Ocurrieron los siguientes errores:', ], - /** + /* * * Home page translations. * */ 'welcome' => [ 'templateTitle' => 'Bienvenido', - 'title' => 'Instalador de phpVMS', - 'message' => 'Instalación fácil y asistente de configuración.', - 'next' => 'Comprobar requisitios', + 'title' => 'Instalador de phpVMS', + 'message' => 'Instalación fácil y asistente de configuración.', + 'next' => 'Comprobar requisitios', ], - /** + /* * * Requirements page translations. * */ 'requirements' => [ 'templateTitle' => 'Paso 1 | Requisitos del Servidor', - 'title' => 'Requisitos del servidor', - 'next' => 'Comprobar permisos', + 'title' => 'Requisitos del servidor', + 'next' => 'Comprobar permisos', ], - /** + /* * * Permissions page translations. * */ 'permissions' => [ 'templateTitle' => 'Paso 2 | Permisos', - 'title' => 'Permisos', - 'next' => 'Configurar entorno', + 'title' => 'Permisos', + 'next' => 'Configurar entorno', ], - /** + /* * * Environment page translations. * */ 'environment' => [ 'menu' => [ - 'templateTitle' => 'Paso 3 | Configuración de entorno', - 'title' => 'Configuraciones de entorno', - 'desc' => 'Seleccione cómo desea configurar las aplicaciones .env archivo.', - 'wizard-button' => 'Desde el asistente', + 'templateTitle' => 'Paso 3 | Configuración de entorno', + 'title' => 'Configuraciones de entorno', + 'desc' => 'Seleccione cómo desea configurar las aplicaciones .env archivo.', + 'wizard-button' => 'Desde el asistente', 'classic-button' => 'Editor de texto clásico', ], 'wizard' => [ 'templateTitle' => 'Paso 3 | Configuraciones de entorno | Asistente guíado', - 'title' => 'Asistente .env guíado', - 'tabs' => [ + 'title' => 'Asistente .env guíado', + 'tabs' => [ 'environment' => 'Entorno', - 'database' => 'Base de datos', - 'application' => 'Aplicación' + 'database' => 'Base de datos', + 'application' => 'Aplicación', ], 'form' => [ - 'name_required' => 'Un nombre de entorno es requerido.', - 'app_name_label' => 'Nombre de la aplicación', - 'app_name_placeholder' => 'Nombre de la aplicación', - 'app_environment_label' => 'Entorno de aplicación', - 'app_environment_label_local' => 'Local', + 'name_required' => 'Un nombre de entorno es requerido.', + 'app_name_label' => 'Nombre de la aplicación', + 'app_name_placeholder' => 'Nombre de la aplicación', + 'app_environment_label' => 'Entorno de aplicación', + 'app_environment_label_local' => 'Local', 'app_environment_label_developement' => 'Desarrollo', - 'app_environment_label_qa' => 'QA', - 'app_environment_label_production' => 'Producción', - 'app_environment_label_other' => 'Otra', - 'app_environment_placeholder_other' => 'Introduce tu entorno...', - 'app_debug_label' => 'Debug de aplicación', - 'app_debug_label_true' => 'Verdadero', - 'app_debug_label_false' => 'Falso', - 'app_log_level_label' => 'Nivel de LOG de la aplicación', - 'app_log_level_label_debug' => 'debug', - 'app_log_level_label_info' => 'info', - 'app_log_level_label_notice' => 'aviso', - 'app_log_level_label_warning' => 'advertencia', - 'app_log_level_label_error' => 'error', - 'app_log_level_label_critical' => 'critico', - 'app_log_level_label_alert' => 'alerta', - 'app_log_level_label_emergency' => 'emergencía', - 'app_url_label' => 'URL de la App', - 'app_url_placeholder' => 'URL App ', - 'db_connection_label' => 'Conexión base de datos', - 'db_connection_label_mysql' => 'mysql', - 'db_connection_label_sqlite' => 'sqlite', - 'db_connection_label_pgsql' => 'pgsql', - 'db_connection_label_sqlsrv' => 'sqlsrv', - 'db_host_label' => 'Database: Host', - 'db_host_placeholder' => 'Database: Host', - 'db_port_label' => 'Database: Puerto', - 'db_port_placeholder' => 'Database: Puerto', - 'db_name_label' => 'Database: Nombre', - 'db_name_placeholder' => 'Database: Nombre', - 'db_username_label' => 'Database: Nombre usuario', - 'db_username_placeholder' => 'Database: Nombre usuario', - 'db_password_label' => 'Database: Contraseña', - 'db_password_placeholder' => 'Database: Contraseña', + 'app_environment_label_qa' => 'QA', + 'app_environment_label_production' => 'Producción', + 'app_environment_label_other' => 'Otra', + 'app_environment_placeholder_other' => 'Introduce tu entorno...', + 'app_debug_label' => 'Debug de aplicación', + 'app_debug_label_true' => 'Verdadero', + 'app_debug_label_false' => 'Falso', + 'app_log_level_label' => 'Nivel de LOG de la aplicación', + 'app_log_level_label_debug' => 'debug', + 'app_log_level_label_info' => 'info', + 'app_log_level_label_notice' => 'aviso', + 'app_log_level_label_warning' => 'advertencia', + 'app_log_level_label_error' => 'error', + 'app_log_level_label_critical' => 'critico', + 'app_log_level_label_alert' => 'alerta', + 'app_log_level_label_emergency' => 'emergencía', + 'app_url_label' => 'URL de la App', + 'app_url_placeholder' => 'URL App ', + 'db_connection_label' => 'Conexión base de datos', + 'db_connection_label_mysql' => 'mysql', + 'db_connection_label_sqlite' => 'sqlite', + 'db_connection_label_pgsql' => 'pgsql', + 'db_connection_label_sqlsrv' => 'sqlsrv', + 'db_host_label' => 'Database: Host', + 'db_host_placeholder' => 'Database: Host', + 'db_port_label' => 'Database: Puerto', + 'db_port_placeholder' => 'Database: Puerto', + 'db_name_label' => 'Database: Nombre', + 'db_name_placeholder' => 'Database: Nombre', + 'db_username_label' => 'Database: Nombre usuario', + 'db_username_placeholder' => 'Database: Nombre usuario', + 'db_password_label' => 'Database: Contraseña', + 'db_password_placeholder' => 'Database: Contraseña', 'app_tabs' => [ - 'more_info' => 'Más info', - 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', - 'broadcasting_label' => 'Broadcast Driver', + 'more_info' => 'Más info', + 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', + 'broadcasting_label' => 'Broadcast Driver', 'broadcasting_placeholder' => 'Broadcast Driver', - 'cache_label' => 'Cache Driver', - 'cache_placeholder' => 'Cache Driver', - 'session_label' => 'Session Driver', - 'session_placeholder' => 'Session Driver', - 'queue_label' => 'Queue Driver', - 'queue_placeholder' => 'Queue Driver', - 'redis_label' => 'Redis Driver', - 'redis_host' => 'Redis Host', - 'redis_password' => 'Redis Password', - 'redis_port' => 'Redis Port', + 'cache_label' => 'Cache Driver', + 'cache_placeholder' => 'Cache Driver', + 'session_label' => 'Session Driver', + 'session_placeholder' => 'Session Driver', + 'queue_label' => 'Queue Driver', + 'queue_placeholder' => 'Queue Driver', + 'redis_label' => 'Redis Driver', + 'redis_host' => 'Redis Host', + 'redis_password' => 'Redis Password', + 'redis_port' => 'Redis Port', - 'mail_label' => 'Mail', - 'mail_driver_label' => 'Mail Driver', - 'mail_driver_placeholder' => 'Mail Driver', - 'mail_host_label' => 'Mail Host', - 'mail_host_placeholder' => 'Mail Host', - 'mail_port_label' => 'Mail Port', - 'mail_port_placeholder' => 'Mail Port', - 'mail_username_label' => 'Mail Username', - 'mail_username_placeholder' => 'Mail Username', - 'mail_password_label' => 'Mail Password', - 'mail_password_placeholder' => 'Mail Password', - 'mail_encryption_label' => 'Mail Encryption', + 'mail_label' => 'Mail', + 'mail_driver_label' => 'Mail Driver', + 'mail_driver_placeholder' => 'Mail Driver', + 'mail_host_label' => 'Mail Host', + 'mail_host_placeholder' => 'Mail Host', + 'mail_port_label' => 'Mail Port', + 'mail_port_placeholder' => 'Mail Port', + 'mail_username_label' => 'Mail Username', + 'mail_username_placeholder' => 'Mail Username', + 'mail_password_label' => 'Mail Password', + 'mail_password_placeholder' => 'Mail Password', + 'mail_encryption_label' => 'Mail Encryption', 'mail_encryption_placeholder' => 'Mail Encryption', - 'pusher_label' => 'Pusher', - 'pusher_app_id_label' => 'Pusher App Id', - 'pusher_app_id_palceholder' => 'Pusher App Id', - 'pusher_app_key_label' => 'Pusher App Key', - 'pusher_app_key_palceholder' => 'Pusher App Key', - 'pusher_app_secret_label' => 'Pusher App Secret', + 'pusher_label' => 'Pusher', + 'pusher_app_id_label' => 'Pusher App Id', + 'pusher_app_id_palceholder' => 'Pusher App Id', + 'pusher_app_key_label' => 'Pusher App Key', + 'pusher_app_key_palceholder' => 'Pusher App Key', + 'pusher_app_secret_label' => 'Pusher App Secret', 'pusher_app_secret_palceholder' => 'Pusher App Secret', ], 'buttons' => [ - 'setup_database' => 'Configurar base de datos', + 'setup_database' => 'Configurar base de datos', 'setup_application' => 'Configurar aplicación', - 'install' => 'Instalar', + 'install' => 'Instalar', ], ], ], 'classic' => [ 'templateTitle' => 'Paso 3 | Configuración de entorno | Editor clásico', - 'title' => 'Editor de entorno cásico', - 'save' => 'Guardar .env', - 'back' => 'Usar el asistente de formulario', - 'install' => 'Guardar e instalar', + 'title' => 'Editor de entorno cásico', + 'save' => 'Guardar .env', + 'back' => 'Usar el asistente de formulario', + 'install' => 'Guardar e instalar', ], 'success' => 'Tu archivo de configuración .env ha sido guardado.', - 'errors' => 'No se ha guardado el archivo .env , Crealo manualmente.', + 'errors' => 'No se ha guardado el archivo .env , Crealo manualmente.', ], 'install' => 'Instalar', - /** + /* * * Installed Log translations. * @@ -178,36 +177,36 @@ return [ 'success_log_message' => 'Inslatador Laravel exitosamente creado en ', ], - /** + /* * * Final page translations. * */ 'final' => [ - 'title' => 'Instalación finalizada', + 'title' => 'Instalación finalizada', 'templateTitle' => 'Instalación finalizada', - 'finished' => 'La aplicación ha sido instalada exitosamente.', - 'migration' => 'Migración & salida de la consola:', - 'console' => 'Salida de la consola de la aplicación:', - 'log' => 'Instalación Log de entrada:', - 'env' => 'Final .env archivo:', - 'exit' => 'Clic aquí para salir', + 'finished' => 'La aplicación ha sido instalada exitosamente.', + 'migration' => 'Migración & salida de la consola:', + 'console' => 'Salida de la consola de la aplicación:', + 'log' => 'Instalación Log de entrada:', + 'env' => 'Final .env archivo:', + 'exit' => 'Clic aquí para salir', ], - /** + /* * * Update specific translations * */ 'updater' => [ - /** + /* * * Shared translations. * */ 'title' => 'Actualizador Laravel', - /** + /* * * Welcome page translations for update feature. * @@ -217,26 +216,26 @@ return [ 'message' => 'Bienvenido al asistente de actualización.', ], - /** + /* * * Welcome page translations for update feature. * */ 'overview' => [ - 'title' => 'Resumen', - 'message' => 'Hay 1 actualización.|Hay :number actualizaciones.', - 'install_updates' => "Instalar actualizaciones" + 'title' => 'Resumen', + 'message' => 'Hay 1 actualización.|Hay :number actualizaciones.', + 'install_updates' => 'Instalar actualizaciones', ], - /** + /* * * Final page translations. * */ 'final' => [ - 'title' => 'Finalizado', + 'title' => 'Finalizado', 'finished' => 'Aplicación/es actualizada/s con éxito.', - 'exit' => 'Clic aquí para salir', + 'exit' => 'Clic aquí para salir', ], 'log' => [ diff --git a/resources/lang/es/pagination.php b/resources/lang/es/pagination.php index 8993ea3f..a3ee8b7d 100644 --- a/resources/lang/es/pagination.php +++ b/resources/lang/es/pagination.php @@ -1,7 +1,6 @@ 'Las contraseñas deben tener al menos seis caracteres y coincidir con la confirmación.', - 'reset' => '¡Tu contraseña ha sido restablecida!', - 'sent' => '¡Le hemos enviado por correo electrónico el enlace de restablecimiento de contraseña!', - 'token' => 'Este token de restablecimiento de contraseña no es válido.', - 'user' => "No podemos encontrar un usuario con esa dirección de correo electrónico.", + 'reset' => '¡Tu contraseña ha sido restablecida!', + 'sent' => '¡Le hemos enviado por correo electrónico el enlace de restablecimiento de contraseña!', + 'token' => 'Este token de restablecimiento de contraseña no es válido.', + 'user' => 'No podemos encontrar un usuario con esa dirección de correo electrónico.', ]; diff --git a/resources/lang/es/pireps.php b/resources/lang/es/pireps.php index e24f6eb9..b76ae408 100644 --- a/resources/lang/es/pireps.php +++ b/resources/lang/es/pireps.php @@ -1,7 +1,5 @@ 'Nuevo informe de vuelo', @@ -36,7 +34,7 @@ return [ 'manual' => 'Manual', 'acars' => 'ACARS', ], - 'state' => [ + 'state' => [ 'accepted' => 'Aceptado', 'pending' => 'Pendiente de aprobación', 'rejected' => 'Rechazado', @@ -67,5 +65,5 @@ return [ 'arrived' => 'Llegó', 'cancelled' => 'Cancelado', 'emerg_decent' => 'Descenso de emergencía', - ] + ], ]; diff --git a/resources/lang/es/profile.php b/resources/lang/es/profile.php index e53b10bf..9f972080 100644 --- a/resources/lang/es/profile.php +++ b/resources/lang/es/profile.php @@ -1,10 +1,8 @@ 'Este avatar será redimensionado a :width x :height pixeles', + 'avatarresize' => 'Este avatar será redimensionado a :width x :height pixeles', 'newapikey' => 'Nueva clave API', 'yourprofile' => 'Tu perfil', diff --git a/resources/lang/es/toc.php b/resources/lang/es/toc.php index aed453e9..3f3a33d7 100644 --- a/resources/lang/es/toc.php +++ b/resources/lang/es/toc.php @@ -1,7 +1,5 @@ 'Términos y condiciones', diff --git a/resources/lang/es/user.php b/resources/lang/es/user.php index c8a525fa..16073990 100644 --- a/resources/lang/es/user.php +++ b/resources/lang/es/user.php @@ -1,11 +1,9 @@ 'Location', - 'state' => [ + 'state' => [ 'pending' => 'Pendiente', 'active' => 'Activo', 'rejected' => 'Rechazado', diff --git a/resources/lang/es/validation.php b/resources/lang/es/validation.php index 8a5ab112..1db4e951 100644 --- a/resources/lang/es/validation.php +++ b/resources/lang/es/validation.php @@ -1,52 +1,51 @@ 'El :attribute debe ser aceptado.', - 'active_url' => 'El :attribute No es una URL valida.', - 'after' => 'El :attribute debe ser una fecha después de :date.', - 'alpha' => 'El :attribute solo puede contener letras.', - 'alpha_dash' => 'El :attribute solo puede contener letras, números, y guiones.', - 'alpha_num' => 'El :attribute solo puede contener letras y números.', - 'array' => 'El :attribute debe ser un array.', - 'before' => 'El :attribute debe ser una fecha antes de :date.', - 'between' => [ + 'accepted' => 'El :attribute debe ser aceptado.', + 'active_url' => 'El :attribute No es una URL valida.', + 'after' => 'El :attribute debe ser una fecha después de :date.', + 'alpha' => 'El :attribute solo puede contener letras.', + 'alpha_dash' => 'El :attribute solo puede contener letras, números, y guiones.', + 'alpha_num' => 'El :attribute solo puede contener letras y números.', + 'array' => 'El :attribute debe ser un array.', + 'before' => 'El :attribute debe ser una fecha antes de :date.', + 'between' => [ 'numeric' => 'El :attribute debe estar entre :min and :max.', 'file' => 'El :attribute debe estar entre :min and :max kilobytes.', 'string' => 'El :attribute debe estar entre :min and :max caracteres.', 'array' => 'El :attribute debe estar entre :min and :max objetos.', ], - 'boolean' => 'El :attribute campo debe ser verdadero o falso.', - 'confirmed' => 'El :attribute confirmación no coincide.', - 'date' => 'El :attribute no es una fecha valida.', - 'date_format' => 'El :attribute no coincide el formato :format.', - 'different' => 'El :attribute y :other deben ser diferentes.', - 'digits' => 'El :attribute debe ser :digits digitos.', - 'digits_between' => 'El :attribute debe estar entre :min and :max digitos.', - 'dimensions' => 'El :attribute tiene dimensiones de imagen no valida.', - 'distinct' => 'El :attribute campo tiene un valor duplicado.', - 'email' => 'El :attribute debe ser un email valido.', - 'exists' => 'El :attribute seleccionado es invalido.', - 'file' => 'El :attribute debe ser un archivo.', - 'filled' => 'El ":attribute" es requerido.', - 'image' => 'El :attribute debe ser una imagen.', - 'in' => 'El :attribute seleccionado es invalido.', - 'in_array' => 'El :attribute campo no existe en :other.', - 'integer' => 'El :attribute debe ser un integer.', - 'ip' => 'El :attribute debe ser una dirección IP valida.', - 'json' => 'El :attribute debe ser un string JSON valido.', - 'max' => [ + 'boolean' => 'El :attribute campo debe ser verdadero o falso.', + 'confirmed' => 'El :attribute confirmación no coincide.', + 'date' => 'El :attribute no es una fecha valida.', + 'date_format' => 'El :attribute no coincide el formato :format.', + 'different' => 'El :attribute y :other deben ser diferentes.', + 'digits' => 'El :attribute debe ser :digits digitos.', + 'digits_between' => 'El :attribute debe estar entre :min and :max digitos.', + 'dimensions' => 'El :attribute tiene dimensiones de imagen no valida.', + 'distinct' => 'El :attribute campo tiene un valor duplicado.', + 'email' => 'El :attribute debe ser un email valido.', + 'exists' => 'El :attribute seleccionado es invalido.', + 'file' => 'El :attribute debe ser un archivo.', + 'filled' => 'El ":attribute" es requerido.', + 'image' => 'El :attribute debe ser una imagen.', + 'in' => 'El :attribute seleccionado es invalido.', + 'in_array' => 'El :attribute campo no existe en :other.', + 'integer' => 'El :attribute debe ser un integer.', + 'ip' => 'El :attribute debe ser una dirección IP valida.', + 'json' => 'El :attribute debe ser un string JSON valido.', + 'max' => [ 'numeric' => 'El :attribute no puede ser mayor que :max.', 'file' => 'El :attribute no puede ser mayor que :max kilobytes.', 'string' => 'El :attribute no puede ser mayor que :max caracteres.', 'array' => 'El :attribute no puede tener más de :max objetos.', ], - 'mimes' => 'El :attribute must be a file of type: :values.', - 'min' => [ + 'mimes' => 'El :attribute must be a file of type: :values.', + 'min' => [ 'numeric' => 'El :attribute debe tener al menos :min.', 'file' => 'El :attribute debe tener al menos :min kilobytes.', 'string' => 'El :attribute debe tener al menos :min caracteres.', @@ -70,23 +69,23 @@ return [ 'string' => 'El :attribute debe ser :size caracteres.', 'array' => 'El :attribute debe contener :size objetos.', ], - 'string' => 'El :attribute debe ser un string.', - 'timezone' => 'El :attribute debe ser una zona valida.', - 'unique' => 'El :attribute ha sido actualmente usado.', - 'url' => 'El :attribute es un formato invalido.', + 'string' => 'El :attribute debe ser un string.', + 'timezone' => 'El :attribute debe ser una zona valida.', + 'unique' => 'El :attribute ha sido actualmente usado.', + 'url' => 'El :attribute es un formato invalido.', - /** + /* * Custom Validation Language Lines */ 'custom' => [ 'airline_id' => [ 'required' => 'Una aerolínea es requerida', - 'exists' => 'La aerolínea no existe', + 'exists' => 'La aerolínea no existe', ], 'aircraft_id' => [ 'required' => 'Una aeronave es requerido', - 'exists' => 'La aeronave no existe', + 'exists' => 'La aeronave no existe', ], 'arr_airport_id' => [ 'required' => 'Un aeropuerto de llegada es requerido', @@ -96,22 +95,22 @@ return [ ], 'flight_time' => [ 'required' => 'Tiempo de vuelo, en minutos, es requerido', - 'integer' => 'Tiempo de vuelo, en minutos, es requerido', + 'integer' => 'Tiempo de vuelo, en minutos, es requerido', ], 'planned_flight_time' => [ 'required' => 'Tiempo de vuelo, en minutos, es requerido', - 'integer' => 'Tiempo de vuelo, en minutos, es requerido', + 'integer' => 'Tiempo de vuelo, en minutos, es requerido', ], 'source_name' => [ 'required' => 'Origen del PIREP es requerido', ], 'g-recaptcha-response' => [ 'required' => 'Por favor verifica que no eres un robot.', - 'captcha' => '¡Error de CAPTCHA! intente de nuevo más tarde o póngase en contacto con el administrador del sitio.', + 'captcha' => '¡Error de CAPTCHA! intente de nuevo más tarde o póngase en contacto con el administrador del sitio.', ], ], - /** + /* * Custom Validation Attributes */ diff --git a/resources/lang/es/widgets.php b/resources/lang/es/widgets.php index d24c11cd..62321384 100644 --- a/resources/lang/es/widgets.php +++ b/resources/lang/es/widgets.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/it/aircraft.php b/resources/lang/it/aircraft.php index 98b59741..0678cd86 100644 --- a/resources/lang/it/aircraft.php +++ b/resources/lang/it/aircraft.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/it/airports.php b/resources/lang/it/airports.php index 81635f4f..eb422d7e 100644 --- a/resources/lang/it/airports.php +++ b/resources/lang/it/airports.php @@ -1,7 +1,5 @@ 'Identificativo', diff --git a/resources/lang/it/common.php b/resources/lang/it/common.php index 7b3d67ec..6f86879c 100644 --- a/resources/lang/it/common.php +++ b/resources/lang/it/common.php @@ -1,7 +1,5 @@ 'Dashboard', diff --git a/resources/lang/it/dashboard.php b/resources/lang/it/dashboard.php index 9bc8812d..bb636ea6 100644 --- a/resources/lang/it/dashboard.php +++ b/resources/lang/it/dashboard.php @@ -1,7 +1,5 @@ 'Ore Totali', diff --git a/resources/lang/it/downloads.php b/resources/lang/it/downloads.php index 27eb85af..43eb028d 100644 --- a/resources/lang/it/downloads.php +++ b/resources/lang/it/downloads.php @@ -1,7 +1,5 @@ 'Non ci sono downloads!', diff --git a/resources/lang/it/email.php b/resources/lang/it/email.php index 05c3e248..fa6f515f 100644 --- a/resources/lang/it/email.php +++ b/resources/lang/it/email.php @@ -1,10 +1,7 @@ - 'Se hai problemi a cliccare il bottone ":actiontext", ' . + 'buttontroubles' => 'Se hai problemi a cliccare il bottone ":actiontext", '. 'copia e incolla l\'URL qui sotto nel tuo browser:', ]; diff --git a/resources/lang/it/errors.php b/resources/lang/it/errors.php index 82cb7642..c2309709 100644 --- a/resources/lang/it/errors.php +++ b/resources/lang/it/errors.php @@ -1,19 +1,15 @@ [ '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 qui per tornare alla home page.', ], '404' => [ '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 qui per tornare alla home page.', ], '503' => [ diff --git a/resources/lang/it/expenses.php b/resources/lang/it/expenses.php index cc5f015c..6f086cb9 100644 --- a/resources/lang/it/expenses.php +++ b/resources/lang/it/expenses.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/it/flights.php b/resources/lang/it/flights.php index 5ebd3882..7e72ea28 100644 --- a/resources/lang/it/flights.php +++ b/resources/lang/it/flights.php @@ -1,7 +1,5 @@ 'Numero di Volo', diff --git a/resources/lang/it/home.php b/resources/lang/it/home.php index d9ccafd8..443dc343 100644 --- a/resources/lang/it/home.php +++ b/resources/lang/it/home.php @@ -1,7 +1,5 @@ [ diff --git a/resources/lang/it/installer.php b/resources/lang/it/installer.php index 95618be4..eada5694 100644 --- a/resources/lang/it/installer.php +++ b/resources/lang/it/installer.php @@ -1,175 +1,174 @@ 'phpVMS Installer', - 'next' => 'Next Step', - 'back' => 'Previous', + 'title' => 'phpVMS Installer', + 'next' => 'Next Step', + 'back' => 'Previous', 'finish' => 'Install', - 'forms' => [ + 'forms' => [ 'errorTitle' => 'The Following errors occurred:', ], - /** + /* * * Home page translations. * */ 'welcome' => [ 'templateTitle' => 'Welcome', - 'title' => 'phpVMS Installer', - 'message' => 'Easy Installation and Setup Wizard.', - 'next' => 'Check Requirements', + 'title' => 'phpVMS Installer', + 'message' => 'Easy Installation and Setup Wizard.', + 'next' => 'Check Requirements', ], - /** + /* * * Requirements page translations. * */ 'requirements' => [ 'templateTitle' => 'Step 1 | Server Requirements', - 'title' => 'Server Requirements', - 'next' => 'Check Permissions', + 'title' => 'Server Requirements', + 'next' => 'Check Permissions', ], - /** + /* * * Permissions page translations. * */ 'permissions' => [ 'templateTitle' => 'Step 2 | Permissions', - 'title' => 'Permissions', - 'next' => 'Configure Environment', + 'title' => 'Permissions', + 'next' => 'Configure Environment', ], - /** + /* * * Environment page translations. * */ 'environment' => [ 'menu' => [ - 'templateTitle' => 'Step 3 | Environment Settings', - 'title' => 'Environment Settings', - 'desc' => 'Please select how you want to configure the apps .env file.', - 'wizard-button' => 'Form Wizard Setup', + 'templateTitle' => 'Step 3 | Environment Settings', + 'title' => 'Environment Settings', + 'desc' => 'Please select how you want to configure the apps .env file.', + 'wizard-button' => 'Form Wizard Setup', 'classic-button' => 'Classic Text Editor', ], 'wizard' => [ 'templateTitle' => 'Step 3 | Environment Settings | Guided Wizard', - 'title' => 'Guided .env Wizard', - 'tabs' => [ + 'title' => 'Guided .env Wizard', + 'tabs' => [ 'environment' => 'Environment', - 'database' => 'Database', - 'application' => 'Application' + 'database' => 'Database', + 'application' => 'Application', ], 'form' => [ - 'name_required' => 'An environment name is required.', - 'app_name_label' => 'App Name', - 'app_name_placeholder' => 'App Name', - 'app_environment_label' => 'App Environment', - 'app_environment_label_local' => 'Local', + 'name_required' => 'An environment name is required.', + 'app_name_label' => 'App Name', + 'app_name_placeholder' => 'App Name', + 'app_environment_label' => 'App Environment', + 'app_environment_label_local' => 'Local', 'app_environment_label_developement' => 'Development', - 'app_environment_label_qa' => 'Qa', - 'app_environment_label_production' => 'Production', - 'app_environment_label_other' => 'Other', - 'app_environment_placeholder_other' => 'Enter your environment...', - 'app_debug_label' => 'App Debug', - 'app_debug_label_true' => 'True', - 'app_debug_label_false' => 'False', - 'app_log_level_label' => 'App Log Level', - 'app_log_level_label_debug' => 'debug', - 'app_log_level_label_info' => 'info', - 'app_log_level_label_notice' => 'notice', - 'app_log_level_label_warning' => 'warning', - 'app_log_level_label_error' => 'error', - 'app_log_level_label_critical' => 'critical', - 'app_log_level_label_alert' => 'alert', - 'app_log_level_label_emergency' => 'emergency', - 'app_url_label' => 'App Url', - 'app_url_placeholder' => 'App Url', - 'db_connection_label' => 'Database Connection', - 'db_connection_label_mysql' => 'mysql', - 'db_connection_label_sqlite' => 'sqlite', - 'db_connection_label_pgsql' => 'pgsql', - 'db_connection_label_sqlsrv' => 'sqlsrv', - 'db_host_label' => 'Database Host', - 'db_host_placeholder' => 'Database Host', - 'db_port_label' => 'Database Port', - 'db_port_placeholder' => 'Database Port', - 'db_name_label' => 'Database Name', - 'db_name_placeholder' => 'Database Name', - 'db_username_label' => 'Database User Name', - 'db_username_placeholder' => 'Database User Name', - 'db_password_label' => 'Database Password', - 'db_password_placeholder' => 'Database Password', + 'app_environment_label_qa' => 'Qa', + 'app_environment_label_production' => 'Production', + 'app_environment_label_other' => 'Other', + 'app_environment_placeholder_other' => 'Enter your environment...', + 'app_debug_label' => 'App Debug', + 'app_debug_label_true' => 'True', + 'app_debug_label_false' => 'False', + 'app_log_level_label' => 'App Log Level', + 'app_log_level_label_debug' => 'debug', + 'app_log_level_label_info' => 'info', + 'app_log_level_label_notice' => 'notice', + 'app_log_level_label_warning' => 'warning', + 'app_log_level_label_error' => 'error', + 'app_log_level_label_critical' => 'critical', + 'app_log_level_label_alert' => 'alert', + 'app_log_level_label_emergency' => 'emergency', + 'app_url_label' => 'App Url', + 'app_url_placeholder' => 'App Url', + 'db_connection_label' => 'Database Connection', + 'db_connection_label_mysql' => 'mysql', + 'db_connection_label_sqlite' => 'sqlite', + 'db_connection_label_pgsql' => 'pgsql', + 'db_connection_label_sqlsrv' => 'sqlsrv', + 'db_host_label' => 'Database Host', + 'db_host_placeholder' => 'Database Host', + 'db_port_label' => 'Database Port', + 'db_port_placeholder' => 'Database Port', + 'db_name_label' => 'Database Name', + 'db_name_placeholder' => 'Database Name', + 'db_username_label' => 'Database User Name', + 'db_username_placeholder' => 'Database User Name', + 'db_password_label' => 'Database Password', + 'db_password_placeholder' => 'Database Password', 'app_tabs' => [ - 'more_info' => 'More Info', - 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', - 'broadcasting_label' => 'Broadcast Driver', + 'more_info' => 'More Info', + 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', + 'broadcasting_label' => 'Broadcast Driver', 'broadcasting_placeholder' => 'Broadcast Driver', - 'cache_label' => 'Cache Driver', - 'cache_placeholder' => 'Cache Driver', - 'session_label' => 'Session Driver', - 'session_placeholder' => 'Session Driver', - 'queue_label' => 'Queue Driver', - 'queue_placeholder' => 'Queue Driver', - 'redis_label' => 'Redis Driver', - 'redis_host' => 'Redis Host', - 'redis_password' => 'Redis Password', - 'redis_port' => 'Redis Port', + 'cache_label' => 'Cache Driver', + 'cache_placeholder' => 'Cache Driver', + 'session_label' => 'Session Driver', + 'session_placeholder' => 'Session Driver', + 'queue_label' => 'Queue Driver', + 'queue_placeholder' => 'Queue Driver', + 'redis_label' => 'Redis Driver', + 'redis_host' => 'Redis Host', + 'redis_password' => 'Redis Password', + 'redis_port' => 'Redis Port', - 'mail_label' => 'Mail', - 'mail_driver_label' => 'Mail Driver', - 'mail_driver_placeholder' => 'Mail Driver', - 'mail_host_label' => 'Mail Host', - 'mail_host_placeholder' => 'Mail Host', - 'mail_port_label' => 'Mail Port', - 'mail_port_placeholder' => 'Mail Port', - 'mail_username_label' => 'Mail Username', - 'mail_username_placeholder' => 'Mail Username', - 'mail_password_label' => 'Mail Password', - 'mail_password_placeholder' => 'Mail Password', - 'mail_encryption_label' => 'Mail Encryption', + 'mail_label' => 'Mail', + 'mail_driver_label' => 'Mail Driver', + 'mail_driver_placeholder' => 'Mail Driver', + 'mail_host_label' => 'Mail Host', + 'mail_host_placeholder' => 'Mail Host', + 'mail_port_label' => 'Mail Port', + 'mail_port_placeholder' => 'Mail Port', + 'mail_username_label' => 'Mail Username', + 'mail_username_placeholder' => 'Mail Username', + 'mail_password_label' => 'Mail Password', + 'mail_password_placeholder' => 'Mail Password', + 'mail_encryption_label' => 'Mail Encryption', 'mail_encryption_placeholder' => 'Mail Encryption', - 'pusher_label' => 'Pusher', - 'pusher_app_id_label' => 'Pusher App Id', - 'pusher_app_id_palceholder' => 'Pusher App Id', - 'pusher_app_key_label' => 'Pusher App Key', - 'pusher_app_key_palceholder' => 'Pusher App Key', - 'pusher_app_secret_label' => 'Pusher App Secret', + 'pusher_label' => 'Pusher', + 'pusher_app_id_label' => 'Pusher App Id', + 'pusher_app_id_palceholder' => 'Pusher App Id', + 'pusher_app_key_label' => 'Pusher App Key', + 'pusher_app_key_palceholder' => 'Pusher App Key', + 'pusher_app_secret_label' => 'Pusher App Secret', 'pusher_app_secret_palceholder' => 'Pusher App Secret', ], 'buttons' => [ - 'setup_database' => 'Setup Database', + 'setup_database' => 'Setup Database', 'setup_application' => 'Setup Application', - 'install' => 'Install', + 'install' => 'Install', ], ], ], 'classic' => [ 'templateTitle' => 'Step 3 | Environment Settings | Classic Editor', - 'title' => 'Classic Environment Editor', - 'save' => 'Save .env', - 'back' => 'Use Form Wizard', - 'install' => 'Save and Install', + 'title' => 'Classic Environment Editor', + 'save' => 'Save .env', + 'back' => 'Use Form Wizard', + 'install' => 'Save and Install', ], 'success' => 'Your .env file settings have been saved.', - 'errors' => 'Unable to save the .env file, Please create it manually.', + 'errors' => 'Unable to save the .env file, Please create it manually.', ], 'install' => 'Install', - /** + /* * * Installed Log translations. * @@ -178,36 +177,36 @@ return [ 'success_log_message' => 'Laravel Installer successfully INSTALLED on ', ], - /** + /* * * Final page translations. * */ 'final' => [ - 'title' => 'Installation Finished', + 'title' => 'Installation Finished', 'templateTitle' => 'Installation Finished', - 'finished' => 'Application has been successfully installed.', - 'migration' => 'Migration & Seed Console Output:', - 'console' => 'Application Console Output:', - 'log' => 'Installation Log Entry:', - 'env' => 'Final .env File:', - 'exit' => 'Click here to exit', + 'finished' => 'Application has been successfully installed.', + 'migration' => 'Migration & Seed Console Output:', + 'console' => 'Application Console Output:', + 'log' => 'Installation Log Entry:', + 'env' => 'Final .env File:', + 'exit' => 'Click here to exit', ], - /** + /* * * Update specific translations * */ 'updater' => [ - /** + /* * * Shared translations. * */ 'title' => 'Laravel Updater', - /** + /* * * Welcome page translations for update feature. * @@ -217,26 +216,26 @@ return [ 'message' => 'Welcome to the update wizard.', ], - /** + /* * * Welcome page translations for update feature. * */ 'overview' => [ - 'title' => 'Overview', - 'message' => 'There is 1 update.|There are :number updates.', - 'install_updates' => "Install Updates" + 'title' => 'Overview', + 'message' => 'There is 1 update.|There are :number updates.', + 'install_updates' => 'Install Updates', ], - /** + /* * * Final page translations. * */ 'final' => [ - 'title' => 'Finished', + 'title' => 'Finished', 'finished' => 'Application\'s database has been successfully updated.', - 'exit' => 'Click here to exit', + 'exit' => 'Click here to exit', ], 'log' => [ diff --git a/resources/lang/it/pagination.php b/resources/lang/it/pagination.php index 1d57f683..3fd7c9d9 100644 --- a/resources/lang/it/pagination.php +++ b/resources/lang/it/pagination.php @@ -1,7 +1,6 @@ 'Inserici Nuovo PIREP', @@ -36,7 +34,7 @@ return [ 'manual' => 'Manuale', 'acars' => 'ACARS', ], - 'state' => [ + 'state' => [ 'accepted' => 'Accettato', 'pending' => 'In Attesa di Approvazione', 'rejected' => 'Rifiutato', @@ -45,7 +43,7 @@ return [ 'deleted' => 'Eliminato', 'draft' => 'Bozza', ], - 'status' => [ + 'status' => [ 'initialized' => 'Iniziato', 'scheduled' => 'Programmato', 'boarding' => 'Imbarco', @@ -67,5 +65,5 @@ return [ 'arrived' => 'Arrivato', 'cancelled' => 'Cancellato', 'emerg_decent' => 'Discesa di Emergenza', - ] + ], ]; diff --git a/resources/lang/it/profile.php b/resources/lang/it/profile.php index 66043313..2380ddbd 100644 --- a/resources/lang/it/profile.php +++ b/resources/lang/it/profile.php @@ -1,7 +1,5 @@ 'Questo avatar sarà ridimensionato a :width x :height pixels', diff --git a/resources/lang/it/toc.php b/resources/lang/it/toc.php index f8364c08..0e8cc30d 100644 --- a/resources/lang/it/toc.php +++ b/resources/lang/it/toc.php @@ -1,7 +1,5 @@ 'Termini e Condizioni di Utilizzo', diff --git a/resources/lang/it/user.php b/resources/lang/it/user.php index 60b59d98..d7a1a74b 100644 --- a/resources/lang/it/user.php +++ b/resources/lang/it/user.php @@ -1,11 +1,9 @@ 'Posizione', - 'state' => [ + 'state' => [ 'pending' => 'In Attesa', 'active' => 'Attivo', 'rejected' => 'Rifiutato', diff --git a/resources/lang/it/validation.php b/resources/lang/it/validation.php index 0c0a2941..b2b6b8d8 100644 --- a/resources/lang/it/validation.php +++ b/resources/lang/it/validation.php @@ -1,52 +1,51 @@ ':attribute deve essere accettato.', - 'active_url' => ':attribute non è un URL valido.', - 'after' => ':attribute deve essere una data successiva al :date.', - 'alpha' => ':attribute può contenere solo lettere.', - 'alpha_dash' => ':attribute può contenere solo lettere, numeri e trattini.', - 'alpha_num' => ':attribute può contenere solo lettere e numeri.', - 'array' => ':attribute deve essere un array.', - 'before' => ':attribute deve essere una data precedente al :date.', - 'between' => [ + 'accepted' => ':attribute deve essere accettato.', + 'active_url' => ':attribute non è un URL valido.', + 'after' => ':attribute deve essere una data successiva al :date.', + 'alpha' => ':attribute può contenere solo lettere.', + 'alpha_dash' => ':attribute può contenere solo lettere, numeri e trattini.', + 'alpha_num' => ':attribute può contenere solo lettere e numeri.', + 'array' => ':attribute deve essere un array.', + 'before' => ':attribute deve essere una data precedente al :date.', + 'between' => [ 'numeric' => ':attribute deve essere compreso tra :min e :max.', 'file' => ':attribute deve essere compreso tra :min e :max kilobytes.', 'string' => ':attribute deve essere compreso tra :min e :max caratteri.', 'array' => ':attribute deve essere compreso tra :min e :max elementi.', ], - 'boolean' => ':attribute deve essere true o false.', - 'confirmed' => ':attribute la conferma non corrisponde.', - 'date' => ':attribute non è una data valida.', - 'date_format' => ':attribute non corrisponde al formato :format.', - 'different' => ':attribute e :other devono essere differenti.', - 'digits' => ':attribute deve essere di almeno :digits cifre.', - 'digits_between' => ':attribute deve essere compreso tra :min e :max cifre.', - 'dimensions' => ':attribute ha dimensioni di immagine non valide.', - 'distinct' => ':attribute il campo è duplicato.', - 'email' => ':attribute deve essere un indirizzo email valido.', - 'exists' => 'Il/la :attribute selezionato non è valido.', - 'file' => ':attribute deve essere un file.', - 'filled' => '":attribute" è obbligatorio.', - 'image' => ':attribute deve essere un\'immagine.', - 'in' => 'Il/la :attribute selezionato non è valido.', - 'in_array' => 'Il campo :attribute non esiste in :other.', - 'integer' => ':attribute deve essere un intero.', - 'ip' => ':attribute deve essere un indirizzo IP valido.', - 'json' => ':attribute deve essere una stringa JSON valida.', - 'max' => [ + 'boolean' => ':attribute deve essere true o false.', + 'confirmed' => ':attribute la conferma non corrisponde.', + 'date' => ':attribute non è una data valida.', + 'date_format' => ':attribute non corrisponde al formato :format.', + 'different' => ':attribute e :other devono essere differenti.', + 'digits' => ':attribute deve essere di almeno :digits cifre.', + 'digits_between' => ':attribute deve essere compreso tra :min e :max cifre.', + 'dimensions' => ':attribute ha dimensioni di immagine non valide.', + 'distinct' => ':attribute il campo è duplicato.', + 'email' => ':attribute deve essere un indirizzo email valido.', + 'exists' => 'Il/la :attribute selezionato non è valido.', + 'file' => ':attribute deve essere un file.', + 'filled' => '":attribute" è obbligatorio.', + 'image' => ':attribute deve essere un\'immagine.', + 'in' => 'Il/la :attribute selezionato non è valido.', + 'in_array' => 'Il campo :attribute non esiste in :other.', + 'integer' => ':attribute deve essere un intero.', + 'ip' => ':attribute deve essere un indirizzo IP valido.', + 'json' => ':attribute deve essere una stringa JSON valida.', + 'max' => [ 'numeric' => ':attribute non può essere maggiore di :max.', 'file' => ':attribute non può essere maggiore di :max kilobytes.', 'string' => ':attribute non può essere maggiore di :max caratteri.', 'array' => ':attribute non può essere maggiore di :max elementi.', ], - 'mimes' => ':attribute deve essere un file di tipo: :values.', - 'min' => [ + 'mimes' => ':attribute deve essere un file di tipo: :values.', + 'min' => [ 'numeric' => ':attribute deve essere di almeno :min.', 'file' => ':attribute deve essere di almeno :min kilobytes.', 'string' => ':attribute deve essere di almeno :min caratteri.', @@ -70,23 +69,23 @@ return [ 'string' => ':attribute deve essere di :size caratteri.', 'array' => ':attribute deve contenere :size elementi.', ], - 'string' => ':attribute deve essere una stringa.', - 'timezone' => ':attribute deve essere una zona valida.', - 'unique' => ':attribute è già stato utilizzato.', - 'url' => 'Il formato del/della :attribute non è valido.', + 'string' => ':attribute deve essere una stringa.', + 'timezone' => ':attribute deve essere una zona valida.', + 'unique' => ':attribute è già stato utilizzato.', + 'url' => 'Il formato del/della :attribute non è valido.', - /** + /* * Custom Validation Language Lines */ 'custom' => [ 'airline_id' => [ 'required' => 'Una compagnia aerea è obbligatoria', - 'exists' => 'La compagnia aerea non esiste', + 'exists' => 'La compagnia aerea non esiste', ], 'aircraft_id' => [ 'required' => 'Un aereo è obbligatorio', - 'exists' => 'L\'aereo non esiste', + 'exists' => 'L\'aereo non esiste', ], 'arr_airport_id' => [ 'required' => 'Un aeroporto di arrivo è obbligatorio', @@ -96,22 +95,22 @@ return [ ], 'flight_time' => [ 'required' => 'Il tempo di volo in minuti è obbligatorio', - 'integer' => 'Il tempo di volo in minuti deve essere un intero', + 'integer' => 'Il tempo di volo in minuti deve essere un intero', ], 'planned_flight_time' => [ 'required' => 'Il tempo di volo in minuti è obbligatorio', - 'integer' => 'Il tempo di volo in minuti deve essere un intero', + 'integer' => 'Il tempo di volo in minuti deve essere un intero', ], 'source_name' => [ 'required' => 'La fonte del PIREP è obbligatoria', ], 'g-recaptcha-response' => [ 'required' => 'Conferma di non essere un robot per favore.', - 'captcha' => 'Errore captcha! Riprova più tardi o contatta un amministratiore.', + 'captcha' => 'Errore captcha! Riprova più tardi o contatta un amministratiore.', ], ], - /** + /* * Custom Validation Attributes */ diff --git a/resources/lang/it/widgets.php b/resources/lang/it/widgets.php index 2a74af5a..7d827b03 100644 --- a/resources/lang/it/widgets.php +++ b/resources/lang/it/widgets.php @@ -1,7 +1,5 @@ [ diff --git a/tests/AcarsTest.php b/tests/AcarsTest.php index 30e712fe..848e191a 100644 --- a/tests/AcarsTest.php +++ b/tests/AcarsTest.php @@ -77,19 +77,18 @@ class AcarsTest extends TestCase */ $uri = '/api/pireps/prefile'; $pirep = [ - '_airline_id' => $airline->id, - 'aircraft_id' => $aircraft->id, - 'dpt_airport_id' => $airport->icao, - 'arr_airport_id' => $airport->icao, - 'flight_number' => '6000', - 'level' => 38000, + '_airline_id' => $airline->id, + 'aircraft_id' => $aircraft->id, + 'dpt_airport_id' => $airport->icao, + 'arr_airport_id' => $airport->icao, + 'flight_number' => '6000', + 'level' => 38000, 'planned_flight_time' => 120, - 'route' => 'POINTA POINTB', + 'route' => 'POINTA POINTB', ]; $response = $this->post($uri, $pirep); $response->assertStatus(400); - } /** @@ -146,7 +145,7 @@ class AcarsTest extends TestCase $airport = factory(App\Models\Airport::class)->create(); $airline = factory(App\Models\Airline::class)->create(); $aircraft = factory(App\Models\Aircraft::class)->create([ - 'airport_id' => 'KAUS' + 'airport_id' => 'KAUS', ]); /** @@ -192,22 +191,22 @@ class AcarsTest extends TestCase $uri = '/api/pireps/prefile'; $pirep = [ - 'airline_id' => $airline->id, - 'aircraft_id' => $aircraft->id, - 'dpt_airport_id' => $airport->icao, - 'arr_airport_id' => $airport->icao, - 'flight_number' => '6000', - 'level' => 38000, - 'planned_distance' => 400, + 'airline_id' => $airline->id, + 'aircraft_id' => $aircraft->id, + 'dpt_airport_id' => $airport->icao, + 'arr_airport_id' => $airport->icao, + 'flight_number' => '6000', + 'level' => 38000, + 'planned_distance' => 400, 'planned_flight_time' => 120, - 'route' => 'POINTA POINTB', - 'source_name' => 'UnitTest', - 'fields' => [ + 'route' => 'POINTA POINTB', + 'source_name' => 'UnitTest', + 'fields' => [ 'custom_field' => 'custom_value', ], 'fares' => [ [ - 'id' => $fare->id, + 'id' => $fare->id, 'count' => $fare->capacity, ], ], @@ -217,7 +216,7 @@ class AcarsTest extends TestCase $response->assertStatus(201); $pirep = $response->json('data'); - # See that the fields and fares were set + // See that the fields and fares were set $fares = \App\Models\PirepFare::where('pirep_id', $pirep['id'])->get(); $this->assertCount(1, $fares); $saved_fare = $fares->first(); @@ -225,7 +224,7 @@ class AcarsTest extends TestCase $this->assertEquals($fare->id, $saved_fare['fare_id']); $this->assertEquals($fare->capacity, $saved_fare['count']); - # Check saved fields + // Check saved fields $saved_fields = \App\Models\PirepFieldValue::where('pirep_id', $pirep['id'])->get(); $this->assertCount(1, $saved_fields); $field = $saved_fields->first(); @@ -240,7 +239,7 @@ class AcarsTest extends TestCase $update = [ 'fares' => [ [ - 'id' => $fare->id, + 'id' => $fare->id, 'count' => $fare->capacity, ], ], @@ -250,7 +249,7 @@ class AcarsTest extends TestCase $response->assertStatus(200); $updated_pirep = $response->json('data'); - # Make sure there are no duplicates + // Make sure there are no duplicates $fares = \App\Models\PirepFare::where('pirep_id', $pirep['id'])->get(); $this->assertCount(1, $fares); $saved_fare = $fares->first(); @@ -279,17 +278,17 @@ class AcarsTest extends TestCase $uri = '/api/pireps/prefile'; $pirep = [ - 'airline_id' => $airline->id, - 'aircraft_id' => $aircraft->id, - 'dpt_airport_id' => $airport->icao, - 'arr_airport_id' => $airport->icao, - 'flight_number' => '6000', - 'level' => 38000, - 'planned_distance' => 400, + 'airline_id' => $airline->id, + 'aircraft_id' => $aircraft->id, + 'dpt_airport_id' => $airport->icao, + 'arr_airport_id' => $airport->icao, + 'flight_number' => '6000', + 'level' => 38000, + 'planned_distance' => 400, 'planned_flight_time' => 120, - 'route' => 'POINTA POINTB', - 'source_name' => 'AcarsTest::testAcarsUpdates', - 'fields' => [ + 'route' => 'POINTA POINTB', + 'source_name' => 'AcarsTest::testAcarsUpdates', + 'fields' => [ 'custom_field' => 'custom_value', ], ]; @@ -297,7 +296,7 @@ class AcarsTest extends TestCase $response = $this->post($uri, $pirep); $response->assertStatus(201); - # Get the PIREP ID + // Get the PIREP ID $body = $response->json(); $pirep_id = $body['data']['id']; @@ -305,12 +304,12 @@ class AcarsTest extends TestCase $this->assertNotNull($pirep_id); $this->assertEquals($body['data']['user_id'], $this->user->id); - # Check the PIREP state and status + // Check the PIREP state and status $pirep = $this->getPirep($pirep_id); $this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']); $this->assertEquals(PirepStatus::INITIATED, $pirep['status']); - /** + /* * Check the fields */ $this->assertHasKeys($pirep, ['fields']); @@ -334,16 +333,15 @@ class AcarsTest extends TestCase /** * Add some position updates */ - $uri = '/api/pireps/'.$pirep_id.'/acars/position'; - # Test missing positions field - # Post an ACARS update + // Test missing positions field + // Post an ACARS update $update = []; $response = $this->post($uri, $update); $response->assertStatus(400); - # Post an ACARS update + // Post an ACARS update $acars = factory(App\Models\Acars::class)->make(['pirep_id' => $pirep_id])->toArray(); $acars = $this->transformData($acars); @@ -352,13 +350,13 @@ class AcarsTest extends TestCase $response = $this->post($uri, $update); $response->assertStatus(200)->assertJson(['count' => 1]); - # Read that if the ACARS record posted + // Read that if the ACARS record posted $acars_data = $this->get($uri)->json()['data'][0]; $this->assertEquals(round($acars['lat'], 2), round($acars_data['lat'], 2)); $this->assertEquals(round($acars['lon'], 2), round($acars_data['lon'], 2)); $this->assertEquals($acars['log'], $acars_data['log']); - # Make sure PIREP state moved into ENROUTE + // Make sure PIREP state moved into ENROUTE $pirep = $this->getPirep($pirep_id); $this->assertEquals(PirepState::IN_PROGRESS, $pirep['state']); $this->assertEquals(PirepStatus::AIRBORNE, $pirep['status']); @@ -372,8 +370,8 @@ class AcarsTest extends TestCase $this->assertEquals(round($acars['lat'], 2), round($body[0]['lat'], 2)); $this->assertEquals(round($acars['lon'], 2), round($body[0]['lon'], 2)); - # Update fields standalone - $uri = '/api/pireps/' . $pirep_id . '/fields'; + // Update fields standalone + $uri = '/api/pireps/'.$pirep_id.'/fields'; $response = $this->post($uri, [ 'fields' => [ 'Departure Gate' => 'G26', @@ -384,7 +382,7 @@ class AcarsTest extends TestCase $body = $response->json('data'); $this->assertEquals('G26', $body['Departure Gate']); - # File the PIREP now + // File the PIREP now $uri = '/api/pireps/'.$pirep_id.'/file'; $response = $this->post($uri, []); $response->assertStatus(400); // missing field @@ -394,14 +392,14 @@ class AcarsTest extends TestCase $response = $this->post($uri, [ 'flight_time' => 130, - 'fuel_used' => 8000.19, - 'distance' => 400, + 'fuel_used' => 8000.19, + 'distance' => 400, ]); $response->assertStatus(200); $body = $response->json(); - # Add a comment + // Add a comment $uri = '/api/pireps/'.$pirep_id.'/comments'; $response = $this->post($uri, ['comment' => 'A comment']); $response->assertStatus(201); @@ -431,23 +429,23 @@ class AcarsTest extends TestCase $uri = '/api/pireps/prefile'; $pirep = [ - 'airline_id' => $airline->id, - 'aircraft_id' => $aircraft->id, - 'dpt_airport_id' => $airport->icao, - 'arr_airport_id' => $airport->icao, - 'flight_number' => '6000', - 'level' => 38000, - 'source_name' => 'AcarsTest::testFilePirepApi', + 'airline_id' => $airline->id, + 'aircraft_id' => $aircraft->id, + 'dpt_airport_id' => $airport->icao, + 'arr_airport_id' => $airport->icao, + 'flight_number' => '6000', + 'level' => 38000, + 'source_name' => 'AcarsTest::testFilePirepApi', ]; $response = $this->post($uri, $pirep); $response->assertStatus(201); - # Get the PIREP ID + // Get the PIREP ID $body = $response->json(); $pirep_id = $body['data']['id']; - # File the PIREP now + // File the PIREP now $uri = '/api/pireps/'.$pirep_id.'/file'; $response = $this->post($uri, [ @@ -458,12 +456,12 @@ class AcarsTest extends TestCase $response->assertStatus(200); - # Check the block_off_time and block_on_time being set + // Check the block_off_time and block_on_time being set $body = $this->get('/api/pireps/'.$pirep_id)->json('data'); $this->assertNotNull($body['block_off_time']); $this->assertNotNull($body['block_on_time']); - # make sure the time matches up + // make sure the time matches up /*$block_on = new Carbon($body['block_on_time'], 'UTC'); $block_off = new Carbon($body['block_off_time'], 'UTC'); $this->assertEquals($block_on->subMinutes($body['flight_time']), $block_off);*/ @@ -479,7 +477,7 @@ class AcarsTest extends TestCase $airport = factory(App\Models\Airport::class)->create(); $airline = factory(App\Models\Airline::class)->create(); - # Add subfleets and aircraft, but also add another set of subfleets + // Add subfleets and aircraft, but also add another set of subfleets $subfleetA = $this->createSubfleetWithAircraft(1); // User not allowed aircraft from this subfleet @@ -495,15 +493,15 @@ class AcarsTest extends TestCase $uri = '/api/pireps/prefile'; $pirep = [ - 'airline_id' => $airline->id, - 'aircraft_id' => $subfleetB['aircraft']->random()->id, - 'dpt_airport_id' => $airport->icao, - 'arr_airport_id' => $airport->icao, - 'flight_number' => '6000', - 'level' => 38000, + 'airline_id' => $airline->id, + 'aircraft_id' => $subfleetB['aircraft']->random()->id, + 'dpt_airport_id' => $airport->icao, + 'arr_airport_id' => $airport->icao, + 'flight_number' => '6000', + 'level' => 38000, 'planned_flight_time' => 120, - 'route' => 'POINTA POINTB', - 'source_name' => 'Unit test', + 'route' => 'POINTA POINTB', + 'source_name' => 'Unit test', ]; $response = $this->post($uri, $pirep); @@ -525,7 +523,7 @@ class AcarsTest extends TestCase $airport = factory(App\Models\Airport::class)->create(); $airline = factory(App\Models\Airline::class)->create(); - # Add subfleets and aircraft, but also add another set of subfleets + // Add subfleets and aircraft, but also add another set of subfleets $subfleetA = $this->createSubfleetWithAircraft(1); // User not allowed aircraft from this subfleet @@ -541,15 +539,15 @@ class AcarsTest extends TestCase $uri = '/api/pireps/prefile'; $pirep = [ - 'airline_id' => $airline->id, - 'aircraft_id' => $subfleetB['aircraft']->random()->id, - 'dpt_airport_id' => $airport->icao, - 'arr_airport_id' => $airport->icao, - 'flight_number' => '6000', - 'level' => 38000, + 'airline_id' => $airline->id, + 'aircraft_id' => $subfleetB['aircraft']->random()->id, + 'dpt_airport_id' => $airport->icao, + 'arr_airport_id' => $airport->icao, + 'flight_number' => '6000', + 'level' => 38000, 'planned_flight_time' => 120, - 'route' => 'POINTA POINTB', - 'source_name' => 'Unit test', + 'route' => 'POINTA POINTB', + 'source_name' => 'Unit test', ]; $response = $this->post($uri, $pirep); @@ -571,7 +569,7 @@ class AcarsTest extends TestCase $uri = '/api/pireps/'.$pirep_id.'/acars/position'; - # Post an ACARS update + // Post an ACARS update $acars_count = \random_int(2, 10); $acars = factory(App\Models\Acars::class, $acars_count)->make(['id' => ''])->toArray(); @@ -583,9 +581,6 @@ class AcarsTest extends TestCase $response->assertStatus(200)->assertJsonCount($acars_count, 'data'); } - /** - * - */ public function testNonExistentPirepGet() { $this->user = factory(App\Models\User::class)->create(); @@ -595,9 +590,6 @@ class AcarsTest extends TestCase $response->assertStatus(404); } - /** - * - */ public function testNonExistentPirepStore() { $this->user = factory(App\Models\User::class)->create(); @@ -608,9 +600,6 @@ class AcarsTest extends TestCase $response->assertStatus(404); } - /** - * - */ public function testAcarsIsoDate() { $pirep = $this->createPirep()->toArray(); @@ -695,9 +684,6 @@ class AcarsTest extends TestCase $this->assertEquals(1, $body['count']); } - /** - * - */ public function testAcarsRoutePost() { $pirep = $this->createPirep()->toArray(); @@ -714,13 +700,13 @@ class AcarsTest extends TestCase foreach ($route as $position) { $post_route[] = [ 'order' => $order, - 'id' => $position->id, - 'name' => $position->id, - 'lat' => $position->lat, - 'lon' => $position->lon, + 'id' => $position->id, + 'name' => $position->id, + 'lat' => $position->lat, + 'lon' => $position->lon, ]; - ++$order; + $order++; } $uri = '/api/pireps/'.$pirep_id.'/route'; @@ -730,7 +716,6 @@ class AcarsTest extends TestCase /** * Get */ - $uri = '/api/pireps/'.$pirep_id.'/route'; $response = $this->get($uri); $response->assertStatus(200)->assertJsonCount($route_count, 'data'); @@ -762,7 +747,7 @@ class AcarsTest extends TestCase $response->assertStatus(201); $pirep_id = $response->json()['data']['id']; - # try readding + // try readding $response = $this->post($uri, $pirep); $response->assertStatus(200); $dupe_pirep_id = $response->json()['data']['id']; diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 5241bbe7..47d0d754 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -1,6 +1,6 @@ assertJson(['data' => ['id' => $user->id]]); } - /** - * - */ public function testApiDeniedOnInactiveUser() { $this->user = factory(User::class)->create([ - 'state' => UserState::PENDING + 'state' => UserState::PENDING, ]); $uri = '/api/user'; @@ -74,14 +71,11 @@ class ApiTest extends TestCase $this->assertTrue(array_key_exists('user', $response['data'][0])); } - /** - * - */ public function testGetAirlines() { $size = \random_int(5, 10); $this->user = factory(App\Models\User::class)->create([ - 'airline_id' => 0 + 'airline_id' => 0, ]); $airlines = factory(App\Models\Airline::class, $size)->create(); @@ -104,7 +98,7 @@ class ApiTest extends TestCase $this->user = factory(App\Models\User::class)->create(); $airport = factory(App\Models\Airport::class)->create(); - $response = $this->get('/api/airports/' . $airport->icao); + $response = $this->get('/api/airports/'.$airport->icao); $response->assertStatus(200); $response->assertJson(['data' => ['icao' => $airport->icao]]); @@ -156,19 +150,19 @@ class ApiTest extends TestCase $subfleetA_size = \random_int(2, 10); $subfleetB_size = \random_int(2, 10); factory(App\Models\Aircraft::class, $subfleetA_size)->create([ - 'subfleet_id' => $subfleetA->id + 'subfleet_id' => $subfleetA->id, ]); factory(App\Models\Aircraft::class, $subfleetB_size)->create([ - 'subfleet_id' => $subfleetB->id + 'subfleet_id' => $subfleetB->id, ]); $response = $this->get('/api/fleet'); $response->assertStatus(200); $body = $response->json()['data']; - foreach($body as $subfleet) { - if($subfleet['id'] === $subfleetA->id) { + foreach ($body as $subfleet) { + if ($subfleet['id'] === $subfleetA->id) { $size = $subfleetA_size; } else { $size = $subfleetB_size; @@ -188,28 +182,28 @@ class ApiTest extends TestCase $fare_svc = app(FareService::class); $subfleet = factory(App\Models\Subfleet::class)->create([ - 'airline_id' => $this->user->airline_id + 'airline_id' => $this->user->airline_id, ]); $fare = factory(App\Models\Fare::class)->create(); $fare_svc->setForSubfleet($subfleet, $fare); $aircraft = factory(App\Models\Aircraft::class)->create([ - 'subfleet_id' => $subfleet->id + 'subfleet_id' => $subfleet->id, ]); /** * Just try retrieving by ID */ - $resp = $this->get('/api/fleet/aircraft/' . $aircraft->id); + $resp = $this->get('/api/fleet/aircraft/'.$aircraft->id); $body = $resp->json()['data']; $this->assertEquals($body['id'], $aircraft->id); - $resp = $this->get('/api/fleet/aircraft/' . $aircraft->id . '?registration=' . $aircraft->registration); + $resp = $this->get('/api/fleet/aircraft/'.$aircraft->id.'?registration='.$aircraft->registration); $body = $resp->json()['data']; $this->assertEquals($body['id'], $aircraft->id); - $resp = $this->get('/api/fleet/aircraft/' . $aircraft->id . '?icao=' . $aircraft->icao); + $resp = $this->get('/api/fleet/aircraft/'.$aircraft->id.'?icao='.$aircraft->icao); $body = $resp->json()['data']; $this->assertEquals($body['id'], $aircraft->id); } diff --git a/tests/ApiTestTrait.php b/tests/ApiTestTrait.php index 0a6fd2c4..0d18ab30 100644 --- a/tests/ApiTestTrait.php +++ b/tests/ApiTestTrait.php @@ -2,7 +2,7 @@ trait ApiTestTrait { - public function assertApiResponse(Array $actualData) + public function assertApiResponse(array $actualData) { $this->assertApiSuccess(); @@ -19,10 +19,10 @@ trait ApiTestTrait $this->seeJson(['success' => true]); } - public function assertModelData(Array $actualData, Array $expectedData) + public function assertModelData(array $actualData, array $expectedData) { foreach ($actualData as $key => $value) { $this->assertEquals($actualData[$key], $expectedData[$key]); } } -} \ No newline at end of file +} diff --git a/tests/AwardsTest.php b/tests/AwardsTest.php index b8ce62ef..42c075de 100644 --- a/tests/AwardsTest.php +++ b/tests/AwardsTest.php @@ -4,8 +4,8 @@ use App\Models\UserAward; class AwardsTest extends TestCase { - private $awardSvc, - $pirepSvc; + private $awardSvc; + private $pirepSvc; public function setUp() { @@ -30,7 +30,7 @@ class AwardsTest extends TestCase { // Create one award that's given out with one flight $award = factory(App\Models\Award::class)->create([ - 'ref_model' => App\Awards\PilotFlightAwards::class, + 'ref_model' => App\Awards\PilotFlightAwards::class, 'ref_model_params' => 1, ]); @@ -40,18 +40,18 @@ class AwardsTest extends TestCase $pirep = factory(App\Models\Pirep::class)->create([ 'airline_id' => $user->airline->id, - 'user_id' => $user->id, + 'user_id' => $user->id, ]); $this->pirepSvc->create($pirep); $this->pirepSvc->accept($pirep); $w = [ - 'user_id' => $user->id, + 'user_id' => $user->id, 'award_id' => $award->id, ]; - # Make sure only one is awarded + // Make sure only one is awarded $this->assertEquals(1, UserAward::where($w)->count(['id'])); $found_award = UserAward::where($w)->first(); diff --git a/tests/FinanceTest.php b/tests/FinanceTest.php index 197a0465..7dd7a488 100644 --- a/tests/FinanceTest.php +++ b/tests/FinanceTest.php @@ -2,21 +2,21 @@ use App\Models\Enums\ExpenseType; use App\Repositories\ExpenseRepository; -use App\Services\PirepService; use App\Repositories\JournalRepository; use App\Services\FareService; use App\Services\Finance\PirepFinanceService; use App\Services\FleetService; +use App\Services\PirepService; use App\Support\Math; use App\Support\Money; class FinanceTest extends TestCase { - private $expenseRepo, - $fareSvc, - $financeSvc, - $fleetSvc, - $pirepSvc; + private $expenseRepo; + private $fareSvc; + private $financeSvc; + private $fleetSvc; + private $pirepSvc; /** * @throws Exception @@ -36,8 +36,10 @@ class FinanceTest extends TestCase /** * Create a user and a PIREP, that has all of the data filled out * so that we can test all of the disparate parts of the finances - * @return array + * * @throws Exception + * + * @return array */ public function createFullPirep() { @@ -55,7 +57,7 @@ class FinanceTest extends TestCase $this->fleetSvc->addSubfleetToRank($subfleet['subfleet'], $rank); $airport = factory(App\Models\Airport::class)->create([ - 'ground_handling_cost' => 10 + 'ground_handling_cost' => 10, ]); $user = factory(App\Models\User::class)->create([ @@ -63,20 +65,20 @@ class FinanceTest extends TestCase ]); $flight = factory(App\Models\Flight::class)->create([ - 'airline_id' => $user->airline_id, + 'airline_id' => $user->airline_id, 'arr_airport_id' => $airport->icao, ]); $pirep = factory(App\Models\Pirep::class)->create([ - 'flight_number' => $flight->flight_number, - 'route_code' => $flight->route_code, - 'route_leg' => $flight->route_leg, + 'flight_number' => $flight->flight_number, + 'route_code' => $flight->route_code, + 'route_leg' => $flight->route_leg, 'arr_airport_id' => $airport->id, - 'user_id' => $user->id, - 'airline_id' => $user->airline_id, - 'aircraft_id' => $subfleet['aircraft']->random(), - 'source' => PirepSource::ACARS, - 'flight_time' => 120, + 'user_id' => $user->id, + 'airline_id' => $user->airline_id, + 'aircraft_id' => $subfleet['aircraft']->random(), + 'source' => PirepSource::ACARS, + 'flight_time' => 120, ]); /** @@ -84,8 +86,8 @@ class FinanceTest extends TestCase * to the PIREP when it's saved, and set the capacity */ $fares = factory(App\Models\Fare::class, 3)->create([ - 'price' => 100, - 'cost' => 50, + 'price' => 100, + 'cost' => 50, 'capacity' => 10, ]); @@ -93,17 +95,17 @@ class FinanceTest extends TestCase $this->fareSvc->setForSubfleet($subfleet['subfleet'], $fare); } - # Add an expense + // Add an expense factory(App\Models\Expense::class)->create([ 'airline_id' => null, - 'amount' => 100 + 'amount' => 100, ]); - # Add a subfleet expense + // Add a subfleet expense factory(App\Models\Expense::class)->create([ - 'ref_model' => \App\Models\Subfleet::class, + 'ref_model' => \App\Models\Subfleet::class, 'ref_model_id' => $subfleet['subfleet']->id, - 'amount' => 200 + 'amount' => 200, ]); $pirep = $this->pirepSvc->create($pirep, []); @@ -111,9 +113,6 @@ class FinanceTest extends TestCase return [$user, $pirep, $fares]; } - /** - * - */ public function testFlightFaresNoOverride() { $flight = factory(App\Models\Flight::class)->create(); @@ -126,21 +125,21 @@ class FinanceTest extends TestCase $this->assertEquals($fare->price, $subfleet_fares->get(0)->price); $this->assertEquals($fare->capacity, $subfleet_fares->get(0)->capacity); - # - # set an override now - # + // + // set an override now + // $this->fareSvc->setForFlight($flight, $fare, [ - 'price' => 50, 'capacity' => 400 + 'price' => 50, 'capacity' => 400, ]); - # look for them again + // look for them again $subfleet_fares = $this->fareSvc->getForFlight($flight); $this->assertCount(1, $subfleet_fares); $this->assertEquals(50, $subfleet_fares[0]->price); $this->assertEquals(400, $subfleet_fares[0]->capacity); - # delete + // delete $this->fareSvc->delFareFromFlight($flight, $fare); $this->assertCount(0, $this->fareSvc->getForFlight($flight)); } @@ -162,8 +161,8 @@ class FinanceTest extends TestCase $new_capacity = Math::addPercent($fare->capacity, $percent_200); $this->fareSvc->setForFlight($flight, $fare, [ - 'price' => $percent_incr, - 'cost' => $percent_decr, + 'price' => $percent_incr, + 'cost' => $percent_decr, 'capacity' => $percent_200, ]); @@ -187,21 +186,21 @@ class FinanceTest extends TestCase $this->assertEquals($fare->price, $subfleet_fares->get(0)->price); $this->assertEquals($fare->capacity, $subfleet_fares->get(0)->capacity); - # - # set an override now - # + // + // set an override now + // $this->fareSvc->setForSubfleet($subfleet, $fare, [ - 'price' => 50, 'capacity' => 400 + 'price' => 50, 'capacity' => 400, ]); - # look for them again + // look for them again $subfleet_fares = $this->fareSvc->getForSubfleet($subfleet); $this->assertCount(1, $subfleet_fares); $this->assertEquals(50, $subfleet_fares[0]->price); $this->assertEquals(400, $subfleet_fares[0]->capacity); - # delete + // delete $this->fareSvc->delFareFromSubfleet($subfleet, $fare); $this->assertCount(0, $this->fareSvc->getForSubfleet($subfleet)); } @@ -212,7 +211,7 @@ class FinanceTest extends TestCase $fare = factory(App\Models\Fare::class)->create(); $this->fareSvc->setForSubfleet($subfleet, $fare, [ - 'price' => 50, 'capacity' => 400 + 'price' => 50, 'capacity' => 400, ]); $ac_fares = $this->fareSvc->getForSubfleet($subfleet); @@ -221,12 +220,12 @@ class FinanceTest extends TestCase $this->assertEquals(50, $ac_fares[0]->price); $this->assertEquals(400, $ac_fares[0]->capacity); - # - # update the override to a different amount and make sure it updates - # + // + // update the override to a different amount and make sure it updates + // $this->fareSvc->setForSubfleet($subfleet, $fare, [ - 'price' => 150, 'capacity' => 50 + 'price' => 150, 'capacity' => 50, ]); $ac_fares = $this->fareSvc->getForSubfleet($subfleet); @@ -235,7 +234,7 @@ class FinanceTest extends TestCase $this->assertEquals(150, $ac_fares[0]->price); $this->assertEquals(50, $ac_fares[0]->capacity); - # delete + // delete $this->fareSvc->delFareFromSubfleet($subfleet, $fare); $this->assertCount(0, $this->fareSvc->getForSubfleet($subfleet)); } @@ -257,8 +256,8 @@ class FinanceTest extends TestCase $new_capacity = Math::addPercent($fare->capacity, $percent_200); $this->fareSvc->setForSubfleet($subfleet, $fare, [ - 'price' => $percent_incr, - 'cost' => $percent_decr, + 'price' => $percent_incr, + 'cost' => $percent_decr, 'capacity' => $percent_200, ]); @@ -280,33 +279,33 @@ class FinanceTest extends TestCase $subfleet = factory(App\Models\Subfleet::class)->create(); [$fare1, $fare2, $fare3, $fare4] = factory(App\Models\Fare::class, 4)->create(); - # add to the subfleet, and just override one of them + // add to the subfleet, and just override one of them $this->fareSvc->setForSubfleet($subfleet, $fare1); $this->fareSvc->setForSubfleet($subfleet, $fare2, [ - 'price' => 100, - 'cost' => 50, + 'price' => 100, + 'cost' => 50, 'capacity' => 25, ]); $this->fareSvc->setForSubfleet($subfleet, $fare3); - # Now set the last one to the flight and then override stuff + // Now set the last one to the flight and then override stuff $this->fareSvc->setForFlight($flight, $fare3, [ 'price' => '300%', - 'cost' => 250, + 'cost' => 250, ]); $fare3_price = Math::addPercent($fare3->price, 300); - # Assign another one to the flight, that's not on the subfleet - # This one should NOT be returned in the list of fares + // Assign another one to the flight, that's not on the subfleet + // This one should NOT be returned in the list of fares $this->fareSvc->setForFlight($flight, $fare4); $fares = $this->fareSvc->getAllFares($flight, $subfleet); $this->assertCount(3, $fares); - foreach($fares as $fare) { - switch($fare->id) { + foreach ($fares as $fare) { + switch ($fare->id) { case $fare1->id: $this->assertEquals($fare->price, $fare1->price); $this->assertEquals($fare->cost, $fare1->cost); @@ -333,11 +332,11 @@ class FinanceTest extends TestCase $subfleet = factory(App\Models\Subfleet::class)->create(); [$fare1, $fare2, $fare3] = factory(App\Models\Fare::class, 3)->create(); - # add to the subfleet, and just override one of them + // add to the subfleet, and just override one of them $this->fareSvc->setForSubfleet($subfleet, $fare1); $this->fareSvc->setForSubfleet($subfleet, $fare2, [ - 'price' => 100, - 'cost' => 50, + 'price' => 100, + 'cost' => 50, 'capacity' => 25, ]); @@ -383,9 +382,9 @@ class FinanceTest extends TestCase ]); $pirep = factory(App\Models\Pirep::class)->create([ - 'user_id' => $this->user->id, + 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), - 'source' => PirepSource::ACARS, + 'source' => PirepSource::ACARS, ]); $rate = $this->financeSvc->getPilotPayRateForPirep($pirep); @@ -410,15 +409,15 @@ class FinanceTest extends TestCase ]); $pirep_acars = factory(App\Models\Pirep::class)->create([ - 'user_id' => $this->user->id, + 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), - 'source' => PirepSource::ACARS, + 'source' => PirepSource::ACARS, ]); $rate = $this->financeSvc->getPilotPayRateForPirep($pirep_acars); $this->assertEquals($acars_pay_rate, $rate); - # Change to a percentage + // Change to a percentage $manual_pay_rate = '50%'; $manual_pay_adjusted = Math::addPercent( $rank->manual_base_pay_rate, $manual_pay_rate); @@ -428,15 +427,15 @@ class FinanceTest extends TestCase ]); $pirep_manual = factory(App\Models\Pirep::class)->create([ - 'user_id' => $this->user->id, + 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), - 'source' => PirepSource::MANUAL, + 'source' => PirepSource::MANUAL, ]); $rate = $this->financeSvc->getPilotPayRateForPirep($pirep_manual); $this->assertEquals($manual_pay_adjusted, $rate); - # And make sure the original acars override still works + // And make sure the original acars override still works $rate = $this->financeSvc->getPilotPayRateForPirep($pirep_acars); $this->assertEquals($acars_pay_rate, $rate); } @@ -459,9 +458,9 @@ class FinanceTest extends TestCase ]); $pirep_acars = factory(App\Models\Pirep::class)->create([ - 'user_id' => $this->user->id, + 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), - 'source' => PirepSource::ACARS, + 'source' => PirepSource::ACARS, 'flight_time' => 60, ]); @@ -469,9 +468,9 @@ class FinanceTest extends TestCase $this->assertEquals(100, $payment->getValue()); $pirep_acars = factory(App\Models\Pirep::class)->create([ - 'user_id' => $this->user->id, + 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), - 'source' => PirepSource::ACARS, + 'source' => PirepSource::ACARS, 'flight_time' => 90, ]); @@ -500,7 +499,7 @@ class FinanceTest extends TestCase $this->assertEquals(100, $balance->getValue()); $this->assertEquals(100, $journal->balance->getValue()); - # add another transaction + // add another transaction $journalRepo->post( $journal, @@ -513,7 +512,7 @@ class FinanceTest extends TestCase $this->assertEquals(125, $balance->getValue()); $this->assertEquals(125, $journal->balance->getValue()); - # debit an amount + // debit an amount $journalRepo->post( $journal, null, @@ -525,7 +524,7 @@ class FinanceTest extends TestCase $this->assertEquals(100, $balance->getValue()); $this->assertEquals(100, $journal->balance->getValue()); - # find all transactions + // find all transactions $transactions = $journalRepo->getAllForObject($user); $this->assertCount(3, $transactions['transactions']); @@ -534,20 +533,19 @@ class FinanceTest extends TestCase } /** - * * @throws Exception */ public function testPirepFares() { [$user, $pirep, $fares] = $this->createFullPirep(); - # Override the fares + // Override the fares $fare_counts = []; foreach ($fares as $fare) { $fare_counts[] = [ 'fare_id' => $fare->id, - 'price' => $fare->price, - 'count' => round($fare->capacity / 2), + 'price' => $fare->price, + 'count' => round($fare->capacity / 2), ]; } @@ -555,7 +553,7 @@ class FinanceTest extends TestCase $all_fares = $this->financeSvc->getReconciledFaresForPirep($pirep); $fare_counts = collect($fare_counts); - foreach($all_fares as $fare) { + foreach ($all_fares as $fare) { $set_fare = $fare_counts->where('fare_id', $fare->id)->first(); $this->assertEquals($set_fare['count'], $fare->count); $this->assertEquals($set_fare['price'], $fare->price); @@ -571,15 +569,15 @@ class FinanceTest extends TestCase $airline2 = factory(App\Models\Airline::class)->create(); factory(App\Models\Expense::class)->create([ - 'airline_id' => $airline->id + 'airline_id' => $airline->id, ]); factory(App\Models\Expense::class)->create([ - 'airline_id' => $airline2->id + 'airline_id' => $airline2->id, ]); factory(App\Models\Expense::class)->create([ - 'airline_id' => null + 'airline_id' => null, ]); $expenses = $this->expenseRepo->getAllForType( @@ -605,8 +603,8 @@ class FinanceTest extends TestCase $subfleet = factory(App\Models\Subfleet::class)->create(); factory(App\Models\Expense::class)->create([ - 'airline_id' => null, - 'ref_model' => \App\Models\Subfleet::class, + 'airline_id' => null, + 'ref_model' => \App\Models\Subfleet::class, 'ref_model_id' => $subfleet->id, ]); @@ -625,7 +623,6 @@ class FinanceTest extends TestCase } /** - * * @throws Exception */ public function testPirepFinances() @@ -635,19 +632,19 @@ class FinanceTest extends TestCase [$user, $pirep, $fares] = $this->createFullPirep(); $user->airline->initJournal(config('phpvms.currency')); - # Override the fares + // Override the fares $fare_counts = []; foreach ($fares as $fare) { $fare_counts[] = [ 'fare_id' => $fare->id, - 'price' => $fare->price, - 'count' => 100, + 'price' => $fare->price, + 'count' => 100, ]; } $this->fareSvc->saveForPirep($pirep, $fare_counts); - # This should process all of the + // This should process all of the $pirep = $this->pirepSvc->accept($pirep); $transactions = $journalRepo->getAllForObject($pirep); @@ -656,17 +653,17 @@ class FinanceTest extends TestCase $this->assertEquals(3020, $transactions['credits']->getValue()); $this->assertEquals(1860, $transactions['debits']->getValue()); - # Check that all the different transaction types are there - # test by the different groups that exist + // Check that all the different transaction types are there + // test by the different groups that exist $transaction_tags = [ - 'expense' => 1, - 'subfleet' => 2, - 'fare' => 3, - 'ground_handling' => 1, - 'pilot_pay' => 2, # debit on the airline, credit to the pilot + 'expense' => 1, + 'subfleet' => 2, + 'fare' => 3, + 'ground_handling' => 1, + 'pilot_pay' => 2, // debit on the airline, credit to the pilot ]; - foreach($transaction_tags as $type => $count) { + foreach ($transaction_tags as $type => $count) { $find = $transactions['transactions']->where('tags', $type); $this->assertEquals($count, $find->count()); } diff --git a/tests/FlightTest.php b/tests/FlightTest.php index 1c53b90d..f8a2d6d8 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -1,15 +1,16 @@ create([ - 'airline_id' => $user->airline_id + 'airline_id' => $user->airline_id, ]); $flight->subfleets()->syncWithoutDetaching([ factory(App\Models\Subfleet::class)->create([ - 'airline_id' => $user->airline_id - ])->id + 'airline_id' => $user->airline_id, + ])->id, ]); return $flight; @@ -55,7 +56,7 @@ class FlightTest extends TestCase $this->assertTrue($this->flightSvc->isFlightDuplicate($flight_dupe)); - # same flight but diff airline shouldn't be a dupe + // same flight but diff airline shouldn't be a dupe $new_airline = factory(App\Models\Airline::class)->create(); $flight_dupe = new Flight([ 'airline_id' => $new_airline->airline_id, @@ -66,7 +67,7 @@ class FlightTest extends TestCase $this->assertFalse($this->flightSvc->isFlightDuplicate($flight_dupe)); - # add another flight with a code + // add another flight with a code $flight_leg = factory(App\Models\Flight::class)->create([ 'airline_id' => $flight->airline_id, 'flight_number' => $flight->flight_number, @@ -91,7 +92,7 @@ class FlightTest extends TestCase $this->user = factory(App\Models\User::class)->create(); $flight = $this->addFlight($this->user); - $req = $this->get('/api/flights/' . $flight->id); + $req = $this->get('/api/flights/'.$flight->id); $req->assertStatus(200); $body = $req->json()['data']; @@ -99,7 +100,7 @@ class FlightTest extends TestCase $this->assertEquals($flight->dpt_airport_id, $body['dpt_airport_id']); $this->assertEquals($flight->arr_airport_id, $body['arr_airport_id']); - # Distance conversion + // Distance conversion $this->assertHasKeys($body['distance'], ['mi', 'nmi', 'km']); $this->get('/api/flights/INVALID', self::$auth_headers) @@ -114,9 +115,9 @@ class FlightTest extends TestCase $this->user = factory(App\Models\User::class)->create(); $flight = $this->addFlight($this->user); - # search specifically for a flight ID - $query = 'flight_id=' . $flight->id; - $req = $this->get('/api/flights/search?' . $query); + // search specifically for a flight ID + $query = 'flight_id='.$flight->id; + $req = $this->get('/api/flights/search?'.$query); $req->assertStatus(200); } @@ -158,7 +159,7 @@ class FlightTest extends TestCase { $this->user = factory(App\Models\User::class)->create(); factory(App\Models\Flight::class, 20)->create([ - 'airline_id' => $this->user->airline_id + 'airline_id' => $this->user->airline_id, ]); $res = $this->get('/api/flights'); @@ -178,15 +179,15 @@ class FlightTest extends TestCase { $this->user = factory(App\Models\User::class)->create(); factory(App\Models\Flight::class, 20)->create([ - 'airline_id' => $this->user->airline_id + 'airline_id' => $this->user->airline_id, ]); $saved_flight = factory(App\Models\Flight::class)->create([ 'airline_id' => $this->user->airline_id, - 'days' => Days::getDaysMask([ + 'days' => Days::getDaysMask([ Days::SUNDAY, - Days::THURSDAY - ]) + Days::THURSDAY, + ]), ]); $flight = Flight::findByDays([Days::SUNDAY])->first(); @@ -234,9 +235,6 @@ class FlightTest extends TestCase $this->assertNull($flights); } - /** - * - */ public function testDayOfWeekTests(): void { $mask = 127; @@ -326,28 +324,22 @@ class FlightTest extends TestCase $this->assertNull($flights); } - /** - * - */ public function testFlightSearchApi() { $this->user = factory(App\Models\User::class)->create(); $flights = factory(App\Models\Flight::class, 10)->create([ - 'airline_id' => $this->user->airline_id + 'airline_id' => $this->user->airline_id, ]); $flight = $flights->random(); - $query = 'flight_number=' . $flight->flight_number; - $req = $this->get('/api/flights/search?' . $query); + $query = 'flight_number='.$flight->flight_number; + $req = $this->get('/api/flights/search?'.$query); $body = $req->json(); $this->assertEquals($flight->id, $body['data'][0]['id']); } - /** - * - */ public function testAddSubfleet() { $subfleet = factory(App\Models\Subfleet::class)->create(); @@ -360,7 +352,7 @@ class FlightTest extends TestCase $found = $flight->subfleets()->get(); $this->assertCount(1, $found); - # Make sure it hasn't been added twice + // Make sure it hasn't been added twice $fleetSvc->addSubfleetToFlight($subfleet, $flight); $flight->refresh(); $found = $flight->subfleets()->get(); @@ -369,6 +361,7 @@ class FlightTest extends TestCase /** * Add/remove a bid, test the API, etc + * * @throws \App\Services\Exception */ public function testBids() @@ -387,11 +380,11 @@ class FlightTest extends TestCase $this->assertEquals($flight->id, $bid->flight_id); $this->assertTrue($flight->has_bid); - # Refresh + // Refresh $flight = Flight::find($flight->id); $this->assertTrue($flight->has_bid); - # Check the table and make sure the entry is there + // Check the table and make sure the entry is there $bid_retrieved = $this->flightSvc->addBid($flight, $user); $this->assertEquals($bid->id, $bid_retrieved->id); @@ -399,13 +392,13 @@ class FlightTest extends TestCase $bids = $user->bids; $this->assertEquals(1, $bids->count()); - # Query the API and see that the user has the bids - # And pull the flight details for the user/bids + // Query the API and see that the user has the bids + // And pull the flight details for the user/bids $req = $this->get('/api/user', $headers); $req->assertStatus(200); $body = $req->json()['data']; - $this->assertEquals(1, sizeof($body['bids'])); + $this->assertEquals(1, count($body['bids'])); $this->assertEquals($flight->id, $body['bids'][0]['flight_id']); $req = $this->get('/api/users/'.$user->id.'/bids', $headers); @@ -414,21 +407,21 @@ class FlightTest extends TestCase $req->assertStatus(200); $this->assertEquals($flight->id, $body[0]['flight_id']); - # have a second user bid on it + // have a second user bid on it $bid_user2 = $this->flightSvc->addBid($flight, $user2); $this->assertNotNull($bid_user2); $this->assertNotEquals($bid_retrieved->id, $bid_user2->id); - # Now remove the flight and check API + // Now remove the flight and check API $this->flightSvc->removeBid($flight, $user); $flight = Flight::find($flight->id); - # user2 still has a bid on it + // user2 still has a bid on it $this->assertTrue($flight->has_bid); - # Remove it from 2nd user + // Remove it from 2nd user $this->flightSvc->removeBid($flight, $user2); $flight->refresh(); $this->assertFalse($flight->has_bid); @@ -442,7 +435,7 @@ class FlightTest extends TestCase $body = $req->json()['data']; $this->assertEquals($user->id, $body['id']); - $this->assertEquals(0, sizeof($body['bids'])); + $this->assertEquals(0, count($body['bids'])); $req = $this->get('/api/users/'.$user->id.'/bids', $headers); $req->assertStatus(200); @@ -451,24 +444,21 @@ class FlightTest extends TestCase $this->assertCount(0, $body); } - /** - * - */ public function testMultipleBidsSingleFlight() { $this->settingsRepo->store('bids.disable_flight_on_bid', true); $user1 = factory(User::class)->create(); $user2 = factory(User::class)->create([ - 'airline_id' => $user1->airline_id + 'airline_id' => $user1->airline_id, ]); $flight = $this->addFlight($user1); - # Put bid on the flight to block it off + // Put bid on the flight to block it off $this->flightSvc->addBid($flight, $user1); - # Try adding again, should throw an exception + // Try adding again, should throw an exception $this->expectException(\App\Exceptions\BidExists::class); $this->flightSvc->addBid($flight, $user2); } @@ -490,12 +480,12 @@ class FlightTest extends TestCase $this->assertEquals($body['flight_id'], $flight->id); - # Now try to have the second user bid on it - # Should return a 409 error + // Now try to have the second user bid on it + // Should return a 409 error $response = $this->put($uri, $data, [], $user2); $response->assertStatus(409); - # Try now deleting the bid from the user + // Try now deleting the bid from the user $response = $this->delete($uri, $data); $body = $response->json('data'); $this->assertCount(0, $body); @@ -521,13 +511,13 @@ class FlightTest extends TestCase $empty_flight = Flight::find($flight->id); $this->assertNull($empty_flight); - # Make sure no bids exist + // Make sure no bids exist $user_bids = Bid::where('flight_id', $flight->id)->get(); - #$this->assertEquals(0, $user_bid->count()); + //$this->assertEquals(0, $user_bid->count()); - # Query the API and see that the user has the bids - # And pull the flight details for the user/bids + // Query the API and see that the user has the bids + // And pull the flight details for the user/bids $req = $this->get('/api/user', $headers); $req->assertStatus(200); diff --git a/tests/GeoTest.php b/tests/GeoTest.php index 3fadaa1f..2a54f546 100644 --- a/tests/GeoTest.php +++ b/tests/GeoTest.php @@ -19,10 +19,10 @@ class GeoTest extends TestCase * [2017-12-21 00:54:10] dev.INFO: name: SIE - 41.15169x-3.604667 * [2017-12-21 00:54:10] dev.INFO: name: SIE - 52.15527x22.200833 */ - # Start at ATL + // Start at ATL $start_point = [36.58106, 26.375603]; - # These are all SIE + // These are all SIE $potential_points = [ [39.0955, -74.800344], [41.15169, -3.604667], diff --git a/tests/ImporterTest.php b/tests/ImporterTest.php index 92a2061d..df42cb9a 100644 --- a/tests/ImporterTest.php +++ b/tests/ImporterTest.php @@ -1,16 +1,16 @@ create($al); $subfleet = factory(App\Models\Subfleet::class)->create(['type' => 'A32X']); - # Add the economy class + // Add the economy class $fare_economy = factory(App\Models\Fare::class)->create(['code' => 'Y', 'capacity' => 150]); $fare_svc->setForSubfleet($subfleet, $fare_economy); $fare_business = factory(App\Models\Fare::class)->create(['code' => 'B', 'capacity' => 20]); $fare_svc->setForSubfleet($subfleet, $fare_business); - # Add first class + // Add first class $fare_first = factory(App\Models\Fare::class)->create(['code' => 'F', 'capacity' => 10]); $fare_svc->setForSubfleet($subfleet, $fare_first); @@ -60,79 +61,79 @@ class ImporterTest extends TestCase { $tests = [ [ - 'input' => '', + 'input' => '', 'expected' => [], ], [ - 'input' => 'gate', - 'expected' => ['gate'] + 'input' => 'gate', + 'expected' => ['gate'], ], [ - 'input' => 'gate;cost index', + 'input' => 'gate;cost index', 'expected' => [ 'gate', 'cost index', - ] + ], ], [ - 'input' => 'gate=B32;cost index=100', + 'input' => 'gate=B32;cost index=100', 'expected' => [ - 'gate' => 'B32', - 'cost index' => '100' - ] + 'gate' => 'B32', + 'cost index' => '100', + ], ], [ - 'input' => 'Y?price=200&cost=100; F?price=1200', + 'input' => 'Y?price=200&cost=100; F?price=1200', 'expected' => [ 'Y' => [ 'price' => 200, - 'cost' => 100, + 'cost' => 100, ], 'F' => [ - 'price' => 1200 - ] - ] + 'price' => 1200, + ], + ], ], [ - 'input' => 'Y?price&cost; F?price=1200', + 'input' => 'Y?price&cost; F?price=1200', 'expected' => [ 'Y' => [ 'price', 'cost', ], 'F' => [ - 'price' => 1200 - ] - ] + 'price' => 1200, + ], + ], ], [ 'input' => 'Y; F?price=1200', 'expected' => [ - 0 => 'Y', + 0 => 'Y', 'F' => [ - 'price' => 1200 - ] - ] + 'price' => 1200, + ], + ], ], [ 'input' => 'Y?;F?price=1200', 'expected' => [ 'Y' => [], 'F' => [ - 'price' => 1200 - ] - ] + 'price' => 1200, + ], + ], ], [ - 'input' => 'Departure Gate=4;Arrival Gate=C61', + 'input' => 'Departure Gate=4;Arrival Gate=C61', 'expected' => [ 'Departure Gate' => '4', - 'Arrival Gate' => 'C61', - ] + 'Arrival Gate' => 'C61', + ], ], ]; - foreach($tests as $test) { + foreach ($tests as $test) { $parsed = $this->importBaseClass->parseMultiColumnValues($test['input']); $this->assertEquals($test['expected'], $parsed); } @@ -146,12 +147,12 @@ class ImporterTest extends TestCase { $tests = [ [ - 'input' => '', - 'expected' => '' + 'input' => '', + 'expected' => '', ], [ - 'input' => ['gate'], - 'expected' => 'gate', + 'input' => ['gate'], + 'expected' => 'gate', ], [ 'input' => [ @@ -163,7 +164,7 @@ class ImporterTest extends TestCase [ 'input' => [ 'gate' => 'B32', - 'cost index' => '100' + 'cost index' => '100', ], 'expected' => 'gate=B32;cost index=100', ], @@ -174,8 +175,8 @@ class ImporterTest extends TestCase 'cost' => 100, ], 'F' => [ - 'price' => 1200 - ] + 'price' => 1200, + ], ], 'expected' => 'Y?price=200&cost=100;F?price=1200', ], @@ -186,18 +187,18 @@ class ImporterTest extends TestCase 'cost', ], 'F' => [ - 'price' => 1200 - ] + 'price' => 1200, + ], ], 'expected' => 'Y?price&cost;F?price=1200', ], [ - 'input' => [ + 'input' => [ 'Y' => [ 'price', 'cost', ], - 'F' => [] + 'F' => [], ], 'expected' => 'Y?price&cost;F', ], @@ -205,8 +206,8 @@ class ImporterTest extends TestCase 'input' => [ 0 => 'Y', 'F' => [ - 'price' => 1200 - ] + 'price' => 1200, + ], ], 'expected' => 'Y;F?price=1200', ], @@ -284,9 +285,9 @@ class ImporterTest extends TestCase $fareF = \App\Models\Fare::where('code', 'F')->first(); $flight = factory(App\Models\Flight::class)->create([ - 'airline_id' => $airline->id, + 'airline_id' => $airline->id, 'flight_type' => 'J', - 'days' => \App\Models\Enums\Days::getDaysMask([ + 'days' => \App\Models\Enums\Days::getDaysMask([ \App\Models\Enums\Days::TUESDAY, \App\Models\Enums\Days::SUNDAY, ]), @@ -301,14 +302,14 @@ class ImporterTest extends TestCase // Add some custom fields \App\Models\FlightFieldValue::create([ 'flight_id' => $flight->id, - 'name' => 'Departure Gate', - 'value' => '4' + 'name' => 'Departure Gate', + 'value' => '4', ]); \App\Models\FlightFieldValue::create([ 'flight_id' => $flight->id, 'name' => 'Arrival Gate', - 'value' => 'C41' + 'value' => 'C41', ]); // Test the conversion @@ -334,6 +335,7 @@ class ImporterTest extends TestCase /** * Try importing the aicraft in the airports. Should fail + * * @expectedException \Illuminate\Validation\ValidationException */ public function testInvalidFileImport(): void @@ -356,6 +358,7 @@ class ImporterTest extends TestCase /** * Test the importing of expenses + * * @throws \Illuminate\Validation\ValidationException */ public function testExpenseImporter(): void @@ -363,7 +366,7 @@ class ImporterTest extends TestCase $airline = factory(App\Models\Airline::class)->create(['icao' => 'VMS']); $subfleet = factory(App\Models\Subfleet::class)->create(['type' => '744-3X-RB211']); $aircraft = factory(App\Models\Aircraft::class)->create([ - 'subfleet_id' => $subfleet->id, + 'subfleet_id' => $subfleet->id, 'registration' => '001Z', ]); @@ -434,6 +437,7 @@ class ImporterTest extends TestCase /** * Test the flight importer + * * @throws \Illuminate\Validation\ValidationException */ public function testFlightImporter(): void @@ -449,7 +453,7 @@ class ImporterTest extends TestCase // See if it imported $flight = \App\Models\Flight::where([ 'airline_id' => $airline->id, - 'flight_number' => '1972' + 'flight_number' => '1972', ])->first(); $this->assertNotNull($flight); @@ -467,7 +471,7 @@ class ImporterTest extends TestCase $this->assertEquals('Just a flight', $flight->notes); $this->assertEquals(true, $flight->active); - # Test that the days were set properly + // Test that the days were set properly $this->assertTrue($flight->on_day(\App\Models\Enums\Days::MONDAY)); $this->assertTrue($flight->on_day(\App\Models\Enums\Days::FRIDAY)); $this->assertFalse($flight->on_day(\App\Models\Enums\Days::TUESDAY)); @@ -505,6 +509,7 @@ class ImporterTest extends TestCase /** * Test the flight importer + * * @throws \Illuminate\Validation\ValidationException */ public function testFlightImporterEmptyCustomFields(): void @@ -520,7 +525,7 @@ class ImporterTest extends TestCase // See if it imported $flight = \App\Models\Flight::where([ 'airline_id' => $airline->id, - 'flight_number' => '1972' + 'flight_number' => '1972', ])->first(); $this->assertNotNull($flight); @@ -600,6 +605,7 @@ class ImporterTest extends TestCase /** * Test importing the subfleets + * * @throws \Illuminate\Validation\ValidationException */ public function testSubfleetImporter(): void diff --git a/tests/MathTest.php b/tests/MathTest.php index 53fff42f..593b375a 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -4,7 +4,8 @@ use App\Support\Math; class MathTest extends TestCase { - public function setUp() { + public function setUp() + { } /** @@ -25,9 +26,8 @@ class MathTest extends TestCase ['expected' => 88, 'fn' => Math::addPercent('100', '-12%')], ]; - foreach($tests as $test) { + foreach ($tests as $test) { $this->assertEquals($test['expected'], $test['fn']); } } - } diff --git a/tests/MetarTest.php b/tests/MetarTest.php index 85c1bfde..e877d9af 100644 --- a/tests/MetarTest.php +++ b/tests/MetarTest.php @@ -34,8 +34,8 @@ class MetarTest extends TestCase $metar = 'KJFK 042151Z 28026G39KT 10SM FEW055 SCT095 BKN110 BKN230 12/M04 A2958 RMK AO2 PK WND 27045/2128 PRESRR SLP018 T01221044'; - #$m = new Metar($metar); - #$parsed = $m->result; + //$m = new Metar($metar); + //$parsed = $m->result; $parsed = Metar::parse($metar); /* @@ -76,7 +76,6 @@ class MetarTest extends TestCase $this->assertEquals(0.87, $parsed['barometer_in']); $this->assertEquals('AO2 PK WND 27045/2128 PRESRR SLP018 T01221044', $parsed['remarks']); - } public function testMetarTrends() @@ -90,7 +89,6 @@ class MetarTest extends TestCase * Altimeter is 29.70. Remarks: automated station with precipitation discriminator sea level * pressure 1005.6 hectopascals hourly temp 7.8°C dewpoint 6.7°C */ - $parsed = Metar::parse($metar); } diff --git a/tests/PIREPTest.php b/tests/PIREPTest.php index d9f51f28..ba01c565 100644 --- a/tests/PIREPTest.php +++ b/tests/PIREPTest.php @@ -12,7 +12,8 @@ use Carbon\Carbon; class PIREPTest extends TestCase { - protected $pirepSvc, $settingsRepo; + protected $pirepSvc; + protected $settingsRepo; public function setUp() { @@ -48,21 +49,19 @@ class PIREPTest extends TestCase return $saved_route; } - /** - */ public function testAddPirep() { $user = factory(App\Models\User::class)->create(); $route = $this->createNewRoute(); $pirep = factory(App\Models\Pirep::class)->create([ 'user_id' => $user->id, - 'route' => implode(' ', $route) + 'route' => implode(' ', $route), ]); $pirep = $this->pirepSvc->create($pirep, []); $this->pirepSvc->saveRoute($pirep); - /** + /* * Check the initial state info */ $this->assertEquals($pirep->state, PirepState::PENDING); @@ -79,11 +78,11 @@ class PIREPTest extends TestCase $this->assertEquals($new_flight_time, $pirep->pilot->flight_time); $this->assertEquals($pirep->arr_airport_id, $pirep->pilot->curr_airport_id); - # Check the location of the current aircraft + // Check the location of the current aircraft $this->assertEquals($pirep->aircraft->airport_id, $pirep->arr_airport_id); - # Also check via API: - $this->get('/api/fleet/aircraft/' . $pirep->aircraft_id, [], $user) + // Also check via API: + $this->get('/api/fleet/aircraft/'.$pirep->aircraft_id, [], $user) ->assertJson(['data' => ['airport_id' => $pirep->arr_airport_id]]); /** @@ -110,7 +109,7 @@ class PIREPTest extends TestCase $pirep->route = implode(' ', $route); $pirep->save(); - # this should delete the old route from the acars table + // this should delete the old route from the acars table $this->pirepSvc->saveRoute($pirep); $saved_route = $this->getAcarsRoute($pirep); @@ -143,25 +142,22 @@ class PIREPTest extends TestCase $this->assertEquals($pirep->planned_distance['nmi'], $body['planned_distance']['nmi']); } - /** - * - */ public function testGetUserPireps() { $this->user = factory(App\Models\User::class)->create(); $pirep_done = factory(App\Models\Pirep::class)->create([ 'user_id' => $this->user->id, - 'state' => PirepState::ACCEPTED + 'state' => PirepState::ACCEPTED, ]); $pirep_in_progress = factory(App\Models\Pirep::class)->create([ 'user_id' => $this->user->id, - 'state' => PirepState::IN_PROGRESS + 'state' => PirepState::IN_PROGRESS, ]); $pirep_cancelled = factory(App\Models\Pirep::class)->create([ 'user_id' => $this->user->id, - 'state' => PirepState::CANCELLED + 'state' => PirepState::CANCELLED, ]); $pireps = $this->get('/api/user/pireps') @@ -191,17 +187,17 @@ class PIREPTest extends TestCase public function testPilotStatsIncr() { $user = factory(User::class)->create([ - 'airline_id' => 1, - 'flights' => 0, + 'airline_id' => 1, + 'flights' => 0, 'flight_time' => 0, - 'rank_id' => 1, + 'rank_id' => 1, ]); - # Submit two PIREPs + // Submit two PIREPs $pireps = factory(Pirep::class, 2)->create([ 'airline_id' => 1, - 'user_id' => $user->id, - # 360min == 6 hours, rank should bump up + 'user_id' => $user->id, + // 360min == 6 hours, rank should bump up 'flight_time' => 360, ]); @@ -213,33 +209,33 @@ class PIREPTest extends TestCase $pilot = User::find($user->id); $last_pirep = Pirep::where('id', $pilot->last_pirep_id)->first(); - # Make sure rank went up + // Make sure rank went up $this->assertGreaterThan($user->rank_id, $pilot->rank_id); $this->assertEquals($last_pirep->arr_airport_id, $pilot->curr_airport_id); - # - # Submit another PIREP, adding another 6 hours - # it should automatically be accepted - # + // + // Submit another PIREP, adding another 6 hours + // it should automatically be accepted + // $pirep = factory(Pirep::class)->create([ 'airline_id' => 1, - 'user_id' => $user->id, - # 120min == 2 hours, currently at 9 hours - # Rank bumps up at 10 hours + 'user_id' => $user->id, + // 120min == 2 hours, currently at 9 hours + // Rank bumps up at 10 hours 'flight_time' => 120, ]); - # Pilot should be at rank 2, where accept should be automatic + // Pilot should be at rank 2, where accept should be automatic $this->pirepSvc->create($pirep); $this->pirepSvc->submit($pirep); $pilot->refresh(); $latest_pirep = Pirep::where('id', $pilot->last_pirep_id)->first(); - # Make sure PIREP was auto updated + // Make sure PIREP was auto updated $this->assertEquals(PirepState::ACCEPTED, $latest_pirep->state); - # Make sure latest PIREP was updated + // Make sure latest PIREP was updated $this->assertNotEquals($last_pirep->id, $latest_pirep->id); } @@ -250,10 +246,10 @@ class PIREPTest extends TestCase { $user = factory(App\Models\User::class)->create(); $pirep = factory(Pirep::class)->create([ - 'user_id' => $user->id + 'user_id' => $user->id, ]); - # This should find itself... + // This should find itself... $dupe_pirep = $this->pirepSvc->findDuplicate($pirep); $this->assertNotFalse($dupe_pirep); $this->assertEquals($pirep->id, $dupe_pirep->id); @@ -261,20 +257,16 @@ class PIREPTest extends TestCase /** * Create a PIREP outside of the check time interval */ - $minutes = setting('pireps.duplicate_check_time') + 1; $pirep = factory(Pirep::class)->create([ - 'created_at' => Carbon::now()->subMinutes($minutes)->toDateTimeString() + 'created_at' => Carbon::now()->subMinutes($minutes)->toDateTimeString(), ]); - # This should find itself... + // This should find itself... $dupe_pirep = $this->pirepSvc->findDuplicate($pirep); $this->assertFalse($dupe_pirep); } - /** - * - */ public function testCancelViaAPI() { $pirep = $this->createPirep()->toArray(); @@ -283,21 +275,21 @@ class PIREPTest extends TestCase $response = $this->post($uri, $pirep); $pirep_id = $response->json()['data']['id']; - $uri = '/api/pireps/' . $pirep_id . '/acars/position'; + $uri = '/api/pireps/'.$pirep_id.'/acars/position'; $acars = factory(App\Models\Acars::class)->make()->toArray(); $response = $this->post($uri, [ - 'positions' => [$acars] + 'positions' => [$acars], ]); $response->assertStatus(200); - # Cancel it - $uri = '/api/pireps/' . $pirep_id . '/cancel'; + // Cancel it + $uri = '/api/pireps/'.$pirep_id.'/cancel'; $response = $this->delete($uri, $acars); $response->assertStatus(200); - # Should get a 400 when posting an ACARS update - $uri = '/api/pireps/' . $pirep_id . '/acars/position'; + // Should get a 400 when posting an ACARS update + $uri = '/api/pireps/'.$pirep_id.'/acars/position'; $acars = factory(App\Models\Acars::class)->make()->toArray(); $response = $this->post($uri, $acars); @@ -318,14 +310,14 @@ class PIREPTest extends TestCase $flight = factory(App\Models\Flight::class)->create([ 'route_code' => null, - 'route_leg' => null, + 'route_leg' => null, ]); $flightSvc->addBid($flight, $user); $pirep = factory(App\Models\Pirep::class)->create([ - 'user_id' => $user->id, - 'airline_id' => $flight->airline_id, + 'user_id' => $user->id, + 'airline_id' => $flight->airline_id, 'flight_number' => $flight->flight_number, ]); @@ -333,7 +325,7 @@ class PIREPTest extends TestCase $this->pirepSvc->changeState($pirep, PirepState::ACCEPTED); $user_bid = Bid::where([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'flight_id' => $flight->id, ])->first(); diff --git a/tests/SubfleetTest.php b/tests/SubfleetTest.php index 9e8a83fe..e13fd1c0 100644 --- a/tests/SubfleetTest.php +++ b/tests/SubfleetTest.php @@ -3,8 +3,8 @@ class SubfleetTest extends TestCase { - protected $ac_svc, - $ICAO = 'B777'; + protected $ac_svc; + protected $ICAO = 'B777'; public function setUp() { @@ -26,21 +26,21 @@ class SubfleetTest extends TestCase $this->assertEquals($fare->price, $subfleet_fares->get(0)->price); $this->assertEquals($fare->capacity, $subfleet_fares->get(0)->capacity); - # - # set an override now - # + // + // set an override now + // $fare_svc->setForSubfleet($subfleet, $fare, [ - 'price' => 50, 'capacity' => 400 + 'price' => 50, 'capacity' => 400, ]); - # look for them again + // look for them again $subfleet_fares = $fare_svc->getForSubfleet($subfleet); $this->assertCount(1, $subfleet_fares); $this->assertEquals(50, $subfleet_fares[0]->price); $this->assertEquals(400, $subfleet_fares[0]->capacity); - # delete + // delete $fare_svc->delFareFromSubfleet($subfleet, $fare); $this->assertCount(0, $fare_svc->getForSubfleet($subfleet)); } @@ -53,7 +53,7 @@ class SubfleetTest extends TestCase $fare = factory(App\Models\Fare::class)->create(); $fare_svc->setForSubfleet($subfleet, $fare, [ - 'price' => 50, 'capacity' => 400 + 'price' => 50, 'capacity' => 400, ]); $ac_fares = $fare_svc->getForSubfleet($subfleet); @@ -62,12 +62,12 @@ class SubfleetTest extends TestCase $this->assertEquals(50, $ac_fares[0]->price); $this->assertEquals(400, $ac_fares[0]->capacity); - # - # update the override to a different amount and make sure it updates - # + // + // update the override to a different amount and make sure it updates + // $fare_svc->setForSubfleet($subfleet, $fare, [ - 'price' => 150, 'capacity' => 50 + 'price' => 150, 'capacity' => 50, ]); $ac_fares = $fare_svc->getForSubfleet($subfleet); @@ -76,7 +76,7 @@ class SubfleetTest extends TestCase $this->assertEquals(150, $ac_fares[0]->price); $this->assertEquals(50, $ac_fares[0]->capacity); - # delete + // delete $fare_svc->delFareFromSubfleet($subfleet, $fare); $this->assertCount(0, $fare_svc->getForSubfleet($subfleet)); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 689922b4..3ebb9f9d 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -24,7 +24,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase protected $user; protected static $auth_headers = [ - 'x-api-key' => 'testadminapikey' + 'x-api-key' => 'testadminapikey', ]; /** @@ -39,11 +39,12 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Creates the application. Required to be implemented + * * @return \Illuminate\Foundation\Application */ public function createApplication() { - $app = require __DIR__ . '/../bootstrap/app.php'; + $app = require __DIR__.'/../bootstrap/app.php'; $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); return $app; } @@ -51,14 +52,15 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * @param $user * @param array $headers + * * @return array */ - public function headers($user=null, array $headers = []): array + public function headers($user = null, array $headers = []): array { - if($user !== null) { + if ($user !== null) { $headers['x-api-key'] = $user->api_key; } else { - if($this->user !== null) { + if ($this->user !== null) { $headers['x-api-key'] = $this->user->api_key; } } @@ -68,12 +70,14 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Import data from a YML file + * * @param $file */ public function addData($file) { $svc = app(DatabaseService::class); - $file_path = base_path('tests/data/' . $file . '.yml'); + $file_path = base_path('tests/data/'.$file.'.yml'); + try { $svc->seed_from_yaml_file($file_path); } catch (Exception $e) { @@ -82,12 +86,13 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Make sure an object has the list of keys + * * @param $obj * @param array $keys */ - public function assertHasKeys($obj, $keys=[]) + public function assertHasKeys($obj, $keys = []) { - foreach($keys as $key) { + foreach ($keys as $key) { $this->assertArrayHasKey($key, $obj); } } @@ -95,11 +100,14 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * So we can test private/protected methods * http://bit.ly/1mr5hMq + * * @param $object * @param $methodName * @param array $parameters - * @return mixed + * * @throws ReflectionException + * + * @return mixed */ public function invokeMethod(&$object, $methodName, array $parameters = []) { @@ -113,13 +121,15 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Transform any data that's passed in. E.g, make sure that any mutator * classes (e.g, units) are not passed in as the mutator class + * * @param array $data + * * @return array */ protected function transformData(&$data) { - foreach($data as $key => &$value) { - if(is_array($value)) { + foreach ($data as $key => &$value) { + if (is_array($value)) { $this->transformData($value); } @@ -127,7 +137,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase $data[$key] = $value->__toString(); } - if($value instanceof DateTime) { + if ($value instanceof DateTimeImmutable) { $data[$key] = $value->format(DATE_ATOM); } elseif ($value instanceof Carbon) { $data[$key] = $value->toIso8601ZuluString(); @@ -139,16 +149,18 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Override the GET call to inject the user API key + * * @param string $uri - * @param array $headers - * @param null $user + * @param array $headers + * @param null $user + * * @return \Illuminate\Foundation\Testing\TestResponse */ - public function get($uri, array $headers=[], $user=null): \Illuminate\Foundation\Testing\TestResponse + public function get($uri, array $headers = [], $user = null): \Illuminate\Foundation\Testing\TestResponse { $req = parent::get($uri, $this->headers($user, $headers)); - if($req->isClientError() || $req->isServerError()) { - Log::error('GET Error: ' . $uri, $req->json()); + if ($req->isClientError() || $req->isServerError()) { + Log::error('GET Error: '.$uri, $req->json()); } return $req; @@ -156,18 +168,20 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Override the POST calls to inject the user API key + * * @param string $uri - * @param array $data - * @param array $headers - * @param null $user + * @param array $data + * @param array $headers + * @param null $user + * * @return \Illuminate\Foundation\Testing\TestResponse */ - public function post($uri, array $data = [], array $headers = [], $user=null) + public function post($uri, array $data = [], array $headers = [], $user = null) { $data = $this->transformData($data); $req = parent::post($uri, $data, $this->headers($user, $headers)); if ($req->isClientError() || $req->isServerError()) { - Log::error('POST Error: ' . $uri, $req->json()); + Log::error('POST Error: '.$uri, $req->json()); } return $req; @@ -175,17 +189,19 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Override the PUT calls to inject the user API key + * * @param string $uri - * @param array $data - * @param array $headers - * @param null $user + * @param array $data + * @param array $headers + * @param null $user + * * @return \Illuminate\Foundation\Testing\TestResponse */ public function put($uri, array $data = [], array $headers = [], $user = null) { $req = parent::put($uri, $this->transformData($data), $this->headers($user, $headers)); if ($req->isClientError() || $req->isServerError()) { - Log::error('PUT Error: ' . $uri, $req->json()); + Log::error('PUT Error: '.$uri, $req->json()); } return $req; @@ -193,17 +209,19 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase /** * Override the DELETE calls to inject the user API key + * * @param string $uri - * @param array $data - * @param array $headers - * @param null $user + * @param array $data + * @param array $headers + * @param null $user + * * @return \Illuminate\Foundation\Testing\TestResponse */ - public function delete($uri, array $data = [], array $headers = [], $user=null) + public function delete($uri, array $data = [], array $headers = [], $user = null) { $req = parent::delete($uri, $this->transformData($data), $this->headers($user, $headers)); if ($req->isClientError() || $req->isServerError()) { - Log::error('DELETE Error: ' . $uri, $req->json()); + Log::error('DELETE Error: '.$uri, $req->json()); } return $req; diff --git a/tests/TestData.php b/tests/TestData.php index 882e2625..49af97ff 100644 --- a/tests/TestData.php +++ b/tests/TestData.php @@ -1,7 +1,4 @@ createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); $this->user = factory(\App\Models\User::class)->create([ - 'rank_id' => $rank->id + 'rank_id' => $rank->id, ]); // Return a Pirep model $pirep = factory(\App\Models\Pirep::class)->make([ - 'aircraft_id' => $subfleet['aircraft']->random()->id + 'aircraft_id' => $subfleet['aircraft']->random()->id, ]); return $pirep; @@ -30,20 +28,22 @@ trait TestData /** * Create a rank and associate the given subfleet IDs with it - * @param int $hours + * + * @param int $hours * @param array $subfleet_ids + * * @return mixed */ - public function createRank($hours=0, array $subfleet_ids) + public function createRank($hours, array $subfleet_ids) { $attrs = []; - if($hours === null) { + if ($hours === null) { $attrs['hours'] = $hours; } $rank = factory(\App\Models\Rank::class)->create($attrs); - if(!empty($subfleet_ids)) { + if (!empty($subfleet_ids)) { $rank->subfleets()->syncWithoutDetaching($subfleet_ids); } @@ -52,23 +52,25 @@ trait TestData /** * Create a subfleet with a number of aircraft assigned + * * @param null $aircraft_count * @param null $airport_id + * * @return mixed */ - public function createSubfleetWithAircraft($aircraft_count = null, $airport_id=null) + public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null) { $subfleet = factory(\App\Models\Subfleet::class)->create([ 'ground_handling_multiplier' => '100', ]); - if($aircraft_count === null) { + if ($aircraft_count === null) { $aircraft_count = \random_int(2, 10); } $aircraft = factory(\App\Models\Aircraft::class, $aircraft_count)->create([ 'subfleet_id' => $subfleet->id, - 'airport_id' => $airport_id, + 'airport_id' => $airport_id, ]); return [ diff --git a/tests/UserTest.php b/tests/UserTest.php index 0380d2d7..d3955bac 100644 --- a/tests/UserTest.php +++ b/tests/UserTest.php @@ -5,7 +5,8 @@ use App\Services\UserService; class UserTest extends TestCase { - protected $settingsRepo, $userSvc; + protected $settingsRepo; + protected $userSvc; public function setUp() { @@ -20,8 +21,8 @@ class UserTest extends TestCase */ public function testRankSubfleets() { - # Add subfleets and aircraft, but also add another - # set of subfleets + // Add subfleets and aircraft, but also add another + // set of subfleets $subfleetA = $this->createSubfleetWithAircraft(); $this->createSubfleetWithAircraft(); @@ -46,38 +47,37 @@ class UserTest extends TestCase $resp = $this->get('/api/user/fleet', [], $user)->assertStatus(200); $body = $resp->json()['data']; - # Get the subfleet that's been added in + // Get the subfleet that's been added in $subfleet_from_api = $body[0]; $this->assertEquals($subfleet->id, $subfleet_from_api['id']); - # Get all the aircraft from that subfleet + // Get all the aircraft from that subfleet $aircraft_from_api = collect($subfleet_from_api['aircraft'])->pluck('id'); $this->assertEquals($added_aircraft, $aircraft_from_api); /** * Check the user ID call */ - $resp = $this->get('/api/users/' . $user->id . '/fleet', [], $user)->assertStatus(200); + $resp = $this->get('/api/users/'.$user->id.'/fleet', [], $user)->assertStatus(200); $body = $resp->json()['data']; - # Get the subfleet that's been added in + // Get the subfleet that's been added in $subfleet_from_api = $body[0]; $this->assertEquals($subfleet->id, $subfleet_from_api['id']); - # Get all the aircraft from that subfleet + // Get all the aircraft from that subfleet $aircraft_from_api = collect($subfleet_from_api['aircraft'])->pluck('id'); $this->assertEquals($added_aircraft, $aircraft_from_api); } - /** * Flip the setting for getting all of the user's aircraft restricted * by rank. Make sure that they're all returned */ public function testGetAllAircraft() { - # Add subfleets and aircraft, but also add another - # set of subfleets + // Add subfleets and aircraft, but also add another + // set of subfleets $subfleetA = $this->createSubfleetWithAircraft(); $subfleetB = $this->createSubfleetWithAircraft(); @@ -104,13 +104,12 @@ class UserTest extends TestCase $this->assertEquals($added_aircraft, $all_aircraft); - /** * Check via API */ $resp = $this->get('/api/user/fleet', [], $user)->assertStatus(200); - # Get all the aircraft from that subfleet + // Get all the aircraft from that subfleet $body = $resp->json()['data']; $aircraft_from_api = array_merge( collect($body[0]['aircraft'])->pluck('id')->toArray(), @@ -128,8 +127,8 @@ class UserTest extends TestCase */ public function testGetAircraftAllowedFromFlight() { - # Add subfleets and aircraft, but also add another - # set of subfleets + // Add subfleets and aircraft, but also add another + // set of subfleets $airport = factory(App\Models\Airport::class)->create(); $subfleetA = $this->createSubfleetWithAircraft(2, $airport->id); $subfleetB = $this->createSubfleetWithAircraft(2); @@ -137,17 +136,17 @@ class UserTest extends TestCase $rank = $this->createRank(10, [$subfleetA['subfleet']->id]); $user = factory(App\Models\User::class)->create([ 'curr_airport_id' => $airport->id, - 'rank_id' => $rank->id, + 'rank_id' => $rank->id, ]); $flight = factory(App\Models\Flight::class)->create([ - 'airline_id' => $user->airline_id, + 'airline_id' => $user->airline_id, 'dpt_airport_id' => $airport->id, ]); $flight->subfleets()->syncWithoutDetaching([ $subfleetA['subfleet']->id, - $subfleetB['subfleet']->id + $subfleetB['subfleet']->id, ]); /* @@ -158,13 +157,13 @@ class UserTest extends TestCase * Do some sanity checks first */ - # Make sure no flights are filtered out + // Make sure no flights are filtered out $this->settingsRepo->store('pilots.only_flights_from_current', false); - # And restrict the aircraft + // And restrict the aircraft $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); - $response = $this->get('/api/flights/' . $flight->id, [], $user); + $response = $this->get('/api/flights/'.$flight->id, [], $user); $response->assertStatus(200); $this->assertCount(2, $response->json()['data']['subfleets']); @@ -176,7 +175,7 @@ class UserTest extends TestCase /** * Make sure it's filtered out from the single flight call */ - $response = $this->get('/api/flights/' . $flight->id, [], $user); + $response = $this->get('/api/flights/'.$flight->id, [], $user); $response->assertStatus(200); $this->assertCount(1, $response->json()['data']['subfleets']); @@ -191,7 +190,7 @@ class UserTest extends TestCase /** * Filtered from search? */ - $response = $this->get('/api/flights/search?flight_id=' . $flight->id, [], $user); + $response = $this->get('/api/flights/search?flight_id='.$flight->id, [], $user); $response->assertStatus(200); $body = $response->json()['data']; $this->assertCount(1, $body[0]['subfleets']); diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 350ac300..f80bec7e 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -4,7 +4,8 @@ use App\Facades\Utils; class UtilsTest extends TestCase { - public function setUp() { + public function setUp() + { } public function testDates()