Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
e95b3eb366
commit
3c32f2d89d
@@ -249,7 +249,7 @@ class AcarsReplay extends Command
|
||||
if ($this->option('write-all')) {
|
||||
$this->info('In "dump-all" mode, just writing it all in');
|
||||
} else {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (!$manual_mode) {
|
||||
$this->info('Going to send updates every 10s');
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ class ComposerCommand extends Command
|
||||
protected function postUpdate(): void
|
||||
{
|
||||
if (config('app.env') === 'dev') {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
||||
Artisan::call('ide-helper:generate');
|
||||
Artisan::call('ide-helper:meta');
|
||||
|
||||
@@ -16,6 +16,7 @@ class Version extends Command
|
||||
* Create the version number that gets written out
|
||||
*
|
||||
* @param mixed $cfg
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
protected function createVersionNumber($cfg)
|
||||
|
||||
@@ -56,7 +56,7 @@ class Importer
|
||||
* CONSTANTS
|
||||
*/
|
||||
public const BATCH_READ_ROWS = 300;
|
||||
public const SUBFLEET_NAME = 'Imported Aircraft';
|
||||
public const SUBFLEET_NAME = 'Imported Aircraft';
|
||||
|
||||
/**
|
||||
* Importer constructor.
|
||||
@@ -145,7 +145,7 @@ class Importer
|
||||
protected function info($message)
|
||||
{
|
||||
if (\is_array($message)) {
|
||||
/** @noinspection ForgottenDebugOutputInspection */
|
||||
/* @noinspection ForgottenDebugOutputInspection */
|
||||
print_r($message);
|
||||
} else {
|
||||
$this->log->writeln('<info>'.$message.'</info>');
|
||||
|
||||
@@ -81,6 +81,7 @@ class Utils extends Facade
|
||||
|
||||
/**
|
||||
* @param string $minutes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function minutesToTimeParts($minutes): array
|
||||
@@ -102,8 +103,9 @@ class Utils extends Facade
|
||||
*
|
||||
* @param int $seconds
|
||||
*
|
||||
* @return array['h', 'm', 's']
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return array['h', 'm', 's']
|
||||
*/
|
||||
public static function secondsToTimeParts($seconds): array
|
||||
{
|
||||
@@ -126,8 +128,9 @@ class Utils extends Facade
|
||||
* @param int $seconds
|
||||
* @param bool $incl_sec
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function secondsToTimeString($seconds, $incl_sec = false): string
|
||||
{
|
||||
|
||||
@@ -66,9 +66,11 @@ class DashboardController extends Controller
|
||||
* Show the admin dashboard
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
||||
@@ -129,8 +129,9 @@ class PirepFieldController extends Controller
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update($id, UpdatePirepFieldRequest $request)
|
||||
{
|
||||
|
||||
@@ -90,6 +90,7 @@ class SubfleetController extends Controller
|
||||
* Get all the fares that haven't been assigned to a given subfleet
|
||||
*
|
||||
* @param mixed $subfleet
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAvailFares($subfleet)
|
||||
@@ -268,8 +269,9 @@ class SubfleetController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
* @throws \League\Csv\CannotInsertRecord
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*/
|
||||
public function export(Request $request)
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ class PirepController extends Controller
|
||||
$pirep = new Pirep($attrs);
|
||||
|
||||
// See if this user is at the current airport
|
||||
/** @noinspection NotOptimalIfConditionsInspection */
|
||||
/* @noinspection NotOptimalIfConditionsInspection */
|
||||
if (setting('pilots.only_flights_from_current')
|
||||
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
|
||||
throw new UserNotAtAirport();
|
||||
@@ -235,7 +235,7 @@ class PirepController extends Controller
|
||||
}
|
||||
|
||||
// See if this aircraft is at the departure airport
|
||||
/** @noinspection NotOptimalIfConditionsInspection */
|
||||
/* @noinspection NotOptimalIfConditionsInspection */
|
||||
if (setting('pireps.only_aircraft_at_dpt_airport')
|
||||
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
|
||||
throw new AircraftNotAtAirport();
|
||||
|
||||
@@ -12,7 +12,6 @@ use App\Models\Enums\PirepState;
|
||||
use App\Repositories\Criteria\WhereCriteria;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Repositories\PirepRepository;
|
||||
use App\Repositories\SubfleetRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\FlightService;
|
||||
use App\Services\UserService;
|
||||
@@ -35,11 +34,11 @@ class UserController extends Controller
|
||||
/**
|
||||
* UserController constructor.
|
||||
*
|
||||
* @param FlightRepository $flightRepo
|
||||
* @param FlightService $flightSvc
|
||||
* @param PirepRepository $pirepRepo
|
||||
* @param UserRepository $userRepo
|
||||
* @param UserService $userSvc
|
||||
* @param FlightRepository $flightRepo
|
||||
* @param FlightService $flightSvc
|
||||
* @param PirepRepository $pirepRepo
|
||||
* @param UserRepository $userRepo
|
||||
* @param UserService $userSvc
|
||||
*/
|
||||
public function __construct(
|
||||
FlightRepository $flightRepo,
|
||||
|
||||
@@ -284,7 +284,7 @@ class PirepController extends Controller
|
||||
}
|
||||
|
||||
// is the aircraft in the right place?
|
||||
/** @noinspection NotOptimalIfConditionsInspection */
|
||||
/* @noinspection NotOptimalIfConditionsInspection */
|
||||
if (setting('pireps.only_aircraft_at_dpt_airport')
|
||||
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
|
||||
return $this->flashError(
|
||||
|
||||
@@ -10,5 +10,4 @@ use Illuminate\Http\Resources\Json\Resource;
|
||||
*/
|
||||
class AcarsLog extends Resource
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -10,5 +10,4 @@ use Illuminate\Http\Resources\Json\Resource;
|
||||
*/
|
||||
class AcarsRoute extends Resource
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -6,5 +6,4 @@ use Illuminate\Http\Resources\Json\Resource;
|
||||
|
||||
class Aircraft extends Resource
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -6,5 +6,4 @@ use Illuminate\Http\Resources\Json\Resource;
|
||||
|
||||
class Airport extends Resource
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -9,5 +9,4 @@ use Illuminate\Http\Resources\Json\Resource;
|
||||
*/
|
||||
class Response extends Resource
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
|
||||
$fields[$field] = $request->input($field);
|
||||
}
|
||||
} else {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (array_key_exists($field, $request)) {
|
||||
$fields[$field] = $request[$field];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ class AircraftObserver
|
||||
{
|
||||
/**
|
||||
* @param Aircraft $aircraft
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function creating(Aircraft $aircraft): void
|
||||
|
||||
@@ -168,8 +168,6 @@ class Pirep extends Model
|
||||
if (array_key_exists('block_off_time', $this->attributes)) {
|
||||
return new Carbon($this->attributes['block_off_time']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,8 +180,6 @@ class Pirep extends Model
|
||||
if (array_key_exists('block_on_time', $this->attributes)) {
|
||||
return new Carbon($this->attributes['block_on_time']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,8 +192,6 @@ class Pirep extends Model
|
||||
if (array_key_exists('submitted_at', $this->attributes)) {
|
||||
return new Carbon($this->attributes['submitted_at']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
if ($this->app->environment() === 'dev') {
|
||||
// Only load the IDE helper if it's included. This lets use distribute the
|
||||
// package without any dev dependencies
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ class SettingRepository extends Repository implements CacheableInterface
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function save($key, $value)
|
||||
|
||||
@@ -70,7 +70,7 @@ class DatabaseService extends Service
|
||||
// see if this table uses a UUID as the PK
|
||||
// if no ID is specified
|
||||
if (\in_array($table, $this->uuid_tables, true)) {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (!array_key_exists('id', $row)) {
|
||||
$row['id'] = Uuid::generate()->string;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ use App\Models\Pirep;
|
||||
use App\Repositories\ExpenseRepository;
|
||||
use App\Repositories\JournalRepository;
|
||||
use App\Services\FareService;
|
||||
use App\Services\PirepService;
|
||||
use App\Support\Math;
|
||||
use App\Support\Money;
|
||||
use Log;
|
||||
@@ -284,7 +283,7 @@ class PirepFinanceService extends Service
|
||||
.$expense->name.'", A='.$expense->amount);
|
||||
|
||||
// If an airline_id is filled, then see if it matches
|
||||
/** @noinspection NotOptimalIfConditionsInspection */
|
||||
/* @noinspection NotOptimalIfConditionsInspection */
|
||||
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;
|
||||
|
||||
@@ -237,7 +237,7 @@ class FlightService extends Service
|
||||
throw new BidExists('A bid already exists for this flight');
|
||||
}
|
||||
} else {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
if ($flight->has_bid === true) {
|
||||
Log::info('Bid exists, flight='.$flight->id.'; no entry in bids table, cleaning up');
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ class AircraftImporter extends ImportExport
|
||||
* @param array $row
|
||||
* @param int $index
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function import(array $row, $index): bool
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ use App\Models\Navdata;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\PirepFieldValue;
|
||||
use App\Models\User;
|
||||
use App\Repositories\PirepRepository;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Log;
|
||||
@@ -35,8 +34,8 @@ class PirepService extends Service
|
||||
/**
|
||||
* PirepService constructor.
|
||||
*
|
||||
* @param GeoService $geoSvc
|
||||
* @param UserService $pilotSvc
|
||||
* @param GeoService $geoSvc
|
||||
* @param UserService $pilotSvc
|
||||
*/
|
||||
public function __construct(
|
||||
GeoService $geoSvc,
|
||||
@@ -196,6 +195,7 @@ class PirepService extends Service
|
||||
* Submit the PIREP. Figure out its default state
|
||||
*
|
||||
* @param Pirep $pirep
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function submit(Pirep $pirep)
|
||||
@@ -302,8 +302,9 @@ class PirepService extends Service
|
||||
/**
|
||||
* @param Pirep $pirep
|
||||
*
|
||||
* @return Pirep
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return Pirep
|
||||
*/
|
||||
public function accept(Pirep $pirep): Pirep
|
||||
{
|
||||
|
||||
@@ -13,8 +13,9 @@ class ICAO
|
||||
*
|
||||
* @param null $country
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function createHexCode($country = null)
|
||||
{
|
||||
|
||||
@@ -438,7 +438,7 @@ class Metar implements \ArrayAccess
|
||||
if (array_key_exists('cavok', $this->result) && $this->result['cavok']) {
|
||||
$this->result['category'] = 'VFR';
|
||||
} else {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
/* @noinspection NestedPositiveIfStatementsInspection */
|
||||
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';
|
||||
@@ -567,6 +567,7 @@ class Metar implements \ArrayAccess
|
||||
* Decodes TAF code if present.
|
||||
*
|
||||
* @param mixed $part
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function get_taf($part)
|
||||
@@ -772,7 +773,7 @@ class Metar implements \ArrayAccess
|
||||
if ($found[1] === 'CAVOK' || $found[1] === '9999') {
|
||||
$this->set_result_value('visibility', new Distance(10000, 'm'));
|
||||
$this->set_result_value('visibility_report', 'Greater than 10 km');
|
||||
/** @noinspection NotOptimalIfConditionsInspection */
|
||||
/* @noinspection NotOptimalIfConditionsInspection */
|
||||
if ($found[1] === 'CAVOK') {
|
||||
$this->set_result_value('cavok', true);
|
||||
$this->method += 4; // can skip the next 4 methods: visibility_min, runway_vr, present_weather, clouds
|
||||
|
||||
@@ -14,19 +14,20 @@ class TimezonelistExtended extends Timezonelist
|
||||
* @param string $continent
|
||||
* @param bool $htmlencode
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function formatTimezone($timezone, $continent, $htmlencode = true)
|
||||
{
|
||||
$time = new \DateTimeImmutable(null, new DateTimeZone($timezone));
|
||||
$offset = $time->format('P');
|
||||
if ($htmlencode) {
|
||||
$offset = str_replace(['-', '+'], array(' − ', ' + '), $offset);
|
||||
$offset = str_replace(['-', '+'], [' − ', ' + '], $offset);
|
||||
}
|
||||
$timezone = substr($timezone, \strlen($continent) + 1);
|
||||
$timezone = str_replace(['St_', '_'], array('St. ', ' '), $timezone);
|
||||
$timezone = str_replace(['St_', '_'], ['St. ', ' '], $timezone);
|
||||
|
||||
return '(GMT/UTC'.$offset.')'.self::WHITESPACE_SEP.$timezone;
|
||||
}
|
||||
|
||||
@@ -556,6 +556,7 @@ class AcarsTest extends TestCase
|
||||
|
||||
/**
|
||||
* Test publishing multiple, batched updates
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testMultipleAcarsPositionUpdates()
|
||||
|
||||
@@ -137,6 +137,7 @@ class ApiTest extends TestCase
|
||||
|
||||
/**
|
||||
* Test getting the subfleets
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testGetSubfleets()
|
||||
|
||||
@@ -123,6 +123,7 @@ class FlightTest extends TestCase
|
||||
|
||||
/**
|
||||
* Get the flight's route
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testFlightRoute()
|
||||
|
||||
@@ -35,6 +35,7 @@ class GeoTest extends TestCase
|
||||
|
||||
/**
|
||||
* Make sure the departure airports/sid/star are all filtered out
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testGetCoords()
|
||||
|
||||
@@ -228,6 +228,7 @@ class ImporterTest extends TestCase
|
||||
|
||||
/**
|
||||
* Test exporting all the flights to a file
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function testAircraftExporter(): void
|
||||
|
||||
@@ -122,5 +122,4 @@ class MetarTest extends TestCase
|
||||
$this->assertEquals('VFR', $metar['category']);
|
||||
$this->assertNotNull($metar);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ class PIREPTest extends TestCase
|
||||
]);
|
||||
|
||||
$pirep = $this->pirepSvc->create($pirep, []);
|
||||
|
||||
try {
|
||||
$this->pirepSvc->saveRoute($pirep);
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -8,8 +8,9 @@ class RegistrationTest extends TestCase
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRegistration()
|
||||
{
|
||||
|
||||
@@ -56,8 +56,9 @@ trait TestData
|
||||
* @param null $aircraft_count
|
||||
* @param null $airport_id
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user