Skip to content

Commit

Permalink
Merge pull request #262 from nabeelio/analysis-Xl4mPr
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
nabeelio authored Aug 26, 2018
2 parents e95b3eb + 3c32f2d commit e593550
Show file tree
Hide file tree
Showing 38 changed files with 59 additions and 49 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/AcarsReplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function handle(): void
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 {
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ComposerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function handle()
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');
Expand Down
1 change: 1 addition & 0 deletions app/Console/Commands/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Services/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -145,7 +145,7 @@ protected function error($message)
protected function info($message)
{
if (\is_array($message)) {
/** @noinspection ForgottenDebugOutputInspection */
/* @noinspection ForgottenDebugOutputInspection */
print_r($message);
} else {
$this->log->writeln('<info>'.$message.'</info>');
Expand Down
7 changes: 5 additions & 2 deletions app/Facades/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static function generateApiKey(): string

/**
* @param string $minutes
*
* @return array
*/
public static function minutesToTimeParts($minutes): array
Expand All @@ -102,8 +103,9 @@ public static function minutesToTimeString($minutes): string
*
* @param int $seconds
*
* @return array['h', 'm', 's']
* @throws \Exception
*
* @return array['h', 'm', 's']
*/
public static function secondsToTimeParts($seconds): array
{
Expand All @@ -126,8 +128,9 @@ public static function secondsToTimeParts($seconds): array
* @param int $seconds
* @param bool $incl_sec
*
* @return string
* @throws \Exception
*
* @return string
*/
public static function secondsToTimeString($seconds, $incl_sec = false): string
{
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ protected function checkNewVersion()
* Show the admin dashboard
*
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index(Request $request)
{
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/Admin/PirepFieldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ public function edit($id)
*
* @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)
{
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Admin/SubfleetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ protected function getAvailRanks($subfleet)
* Get all the fares that haven't been assigned to a given subfleet
*
* @param mixed $subfleet
*
* @return array
*/
protected function getAvailFares($subfleet)
Expand Down Expand Up @@ -268,8 +269,9 @@ public function destroy($id)
*
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @throws \League\Csv\CannotInsertRecord
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function export(Request $request)
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/PirepController.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function prefile(PrefileRequest $request)
$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();
Expand All @@ -235,7 +235,7 @@ public function prefile(PrefileRequest $request)
}

// 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();
Expand Down
11 changes: 5 additions & 6 deletions app/Http/Controllers/Api/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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;
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Frontend/PirepController.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function store(CreatePirepRequest $request)
}

// 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(
Expand Down
1 change: 0 additions & 1 deletion app/Http/Resources/AcarsLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class AcarsLog extends Resource
{

}
1 change: 0 additions & 1 deletion app/Http/Resources/AcarsRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class AcarsRoute extends Resource
{

}
1 change: 0 additions & 1 deletion app/Http/Resources/Aircraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class Aircraft extends Resource
{

}
1 change: 0 additions & 1 deletion app/Http/Resources/Airport.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class Airport extends Resource
{

}
1 change: 0 additions & 1 deletion app/Http/Resources/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
*/
class Response extends Resource
{

}
2 changes: 1 addition & 1 deletion app/Interfaces/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getFromReq($request, $attrs_or_validations, $addtl_fields = null
$fields[$field] = $request->input($field);
}
} else {
/** @noinspection NestedPositiveIfStatementsInspection */
/* @noinspection NestedPositiveIfStatementsInspection */
if (array_key_exists($field, $request)) {
$fields[$field] = $request[$field];
}
Expand Down
1 change: 1 addition & 0 deletions app/Models/Observers/AircraftObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AircraftObserver
{
/**
* @param Aircraft $aircraft
*
* @throws \Exception
*/
public function creating(Aircraft $aircraft): void
Expand Down
6 changes: 0 additions & 6 deletions app/Models/Pirep.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ public function getBlockOffTimeAttribute()
if (array_key_exists('block_off_time', $this->attributes)) {
return new Carbon($this->attributes['block_off_time']);
}

return null;
}

/**
Expand All @@ -182,8 +180,6 @@ public function getBlockOnTimeAttribute()
if (array_key_exists('block_on_time', $this->attributes)) {
return new Carbon($this->attributes['block_on_time']);
}

return null;
}

/**
Expand All @@ -196,8 +192,6 @@ public function getSubmittedAtAttribute()
if (array_key_exists('submitted_at', $this->attributes)) {
return new Carbon($this->attributes['submitted_at']);
}

return null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function register(): void
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);
}
Expand Down
1 change: 1 addition & 0 deletions app/Repositories/SettingRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function retrieve($key)
*
* @param mixed $key
* @param mixed $value
*
* @return null
*/
public function save($key, $value)
Expand Down
2 changes: 1 addition & 1 deletion app/Services/DatabaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ 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)) {
/** @noinspection NestedPositiveIfStatementsInspection */
/* @noinspection NestedPositiveIfStatementsInspection */
if (!array_key_exists('id', $row)) {
$row['id'] = Uuid::generate()->string;
}
Expand Down
3 changes: 1 addition & 2 deletions app/Services/Finance/PirepFinanceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;
Expand Down Expand Up @@ -284,7 +283,7 @@ public function payExpensesEventsForPirep(Pirep $pirep): void
.$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;
Expand Down
2 changes: 1 addition & 1 deletion app/Services/FlightService.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function addBid(Flight $flight, User $user)
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');
}
Expand Down
3 changes: 2 additions & 1 deletion app/Services/ImportExport/AircraftImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ protected function getSubfleet($type)
* @param array $row
* @param int $index
*
* @return bool
* @throws \Exception
*
* @return bool
*/
public function import(array $row, $index): bool
{
Expand Down
9 changes: 5 additions & 4 deletions app/Services/PirepService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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;
Expand All @@ -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,
Expand Down Expand Up @@ -196,6 +195,7 @@ public function create(Pirep $pirep, array $field_values = []): Pirep
* Submit the PIREP. Figure out its default state
*
* @param Pirep $pirep
*
* @throws \Exception
*/
public function submit(Pirep $pirep)
Expand Down Expand Up @@ -302,8 +302,9 @@ public function changeState(Pirep $pirep, int $new_state)
/**
* @param Pirep $pirep
*
* @return Pirep
* @throws \Exception
*
* @return Pirep
*/
public function accept(Pirep $pirep): Pirep
{
Expand Down
3 changes: 2 additions & 1 deletion app/Support/ICAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class ICAO
*
* @param null $country
*
* @return string
* @throws \Exception
*
* @return string
*/
public static function createHexCode($country = null)
{
Expand Down
5 changes: 3 additions & 2 deletions app/Support/Metar.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function parse_all(): array
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';
Expand Down Expand Up @@ -567,6 +567,7 @@ private function set_error($text)
* Decodes TAF code if present.
*
* @param mixed $part
*
* @return bool
*/
private function get_taf($part)
Expand Down Expand Up @@ -772,7 +773,7 @@ private function get_visibility($part)
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
Expand Down
Loading

0 comments on commit e593550

Please sign in to comment.