Code cleanup from inspection results

This commit is contained in:
Nabeel Shahzad
2018-08-26 13:50:08 -05:00
parent 0f3424f41e
commit e95b3eb366
76 changed files with 226 additions and 268 deletions

View File

@@ -45,8 +45,6 @@ class AircraftController extends Controller
*
* @param Request $request
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index(Request $request)
@@ -101,6 +99,8 @@ class AircraftController extends Controller
* Display the specified Aircraft.
*
* @param mixed $id
*
* @return mixed
*/
public function show($id)
{
@@ -120,6 +120,8 @@ class AircraftController extends Controller
* Show the form for editing the specified Aircraft.
*
* @param mixed $id
*
* @return mixed
*/
public function edit($id)
{
@@ -143,6 +145,8 @@ class AircraftController extends Controller
* @param mixed $id
*
* @throws \Prettus\Validator\Exceptions\ValidatorException
*
* @return mixed
*/
public function update($id, UpdateAircraftRequest $request)
{
@@ -164,6 +168,8 @@ class AircraftController extends Controller
* Remove the specified Aircraft from storage.
*
* @param mixed $id
*
* @return mixed
*/
public function destroy($id)
{
@@ -187,7 +193,7 @@ class AircraftController extends Controller
*
* @throws \League\Csv\Exception
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @return mixed
*/
public function export(Request $request)
{
@@ -207,7 +213,7 @@ class AircraftController extends Controller
*
* @throws \Illuminate\Validation\ValidationException
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return mixed
*/
public function import(Request $request)
{
@@ -254,7 +260,7 @@ class AircraftController extends Controller
*
* @throws \Exception
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return mixed
*/
public function expenses($id, Request $request)
{

View File

@@ -45,7 +45,7 @@ class DashboardController extends Controller
* 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
* @throws \GuzzleHttp\Exception\GuzzleException
*/
protected function checkNewVersion()
{
@@ -65,7 +65,10 @@ class DashboardController extends Controller
/**
* Show the admin dashboard
*
* @throws \RuntimeException
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function index(Request $request)
{

View File

@@ -100,7 +100,7 @@ class FlightController extends Controller
}
Log::info('PIREP Custom Fields', $custom_fields);
$this->flightSvc->updateCustomFields($flight->id, $custom_fields);
$this->flightSvc->updateCustomFields($flight, $custom_fields);
}
/**
@@ -483,6 +483,9 @@ class FlightController extends Controller
* Get all the fares that haven't been assigned to a given subfleet
*
* @param mixed $flight
*
* @return mixed
* @return array
*/
protected function getAvailFares($flight)
{

View File

@@ -129,6 +129,7 @@ class PirepFieldController extends Controller
*
* @param mixed $id
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function update($id, UpdatePirepFieldRequest $request)

View File

@@ -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,6 +269,7 @@ class SubfleetController extends Controller
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @throws \League\Csv\CannotInsertRecord
*/
public function export(Request $request)
{

View File

@@ -15,7 +15,6 @@ use App\Models\Pirep;
use App\Repositories\AcarsRepository;
use App\Repositories\PirepRepository;
use App\Services\GeoService;
use App\Services\PirepService;
use Auth;
use Carbon\Carbon;
use Illuminate\Http\Request;
@@ -29,7 +28,6 @@ class AcarsController extends Controller
private $acarsRepo;
private $geoSvc;
private $pirepRepo;
private $pirepSvc;
/**
* AcarsController constructor.
@@ -37,18 +35,15 @@ class AcarsController extends Controller
* @param AcarsRepository $acarsRepo
* @param GeoService $geoSvc
* @param PirepRepository $pirepRepo
* @param PirepService $pirepSvc
*/
public function __construct(
AcarsRepository $acarsRepo,
GeoService $geoSvc,
PirepRepository $pirepRepo,
PirepService $pirepSvc
PirepRepository $pirepRepo
) {
$this->geoSvc = $geoSvc;
$this->acarsRepo = $acarsRepo;
$this->pirepRepo = $pirepRepo;
$this->pirepSvc = $pirepSvc;
}
/**

View File

@@ -222,6 +222,7 @@ class PirepController extends Controller
$pirep = new Pirep($attrs);
// See if this user is at the current airport
/** @noinspection NotOptimalIfConditionsInspection */
if (setting('pilots.only_flights_from_current')
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
throw new UserNotAtAirport();
@@ -234,6 +235,7 @@ class PirepController extends Controller
}
// See if this aircraft is at the departure airport
/** @noinspection NotOptimalIfConditionsInspection */
if (setting('pireps.only_aircraft_at_dpt_airport')
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
throw new AircraftNotAtAirport();

View File

@@ -29,7 +29,6 @@ class UserController extends Controller
private $flightRepo;
private $flightSvc;
private $pirepRepo;
private $subfleetRepo;
private $userRepo;
private $userSvc;
@@ -39,7 +38,6 @@ class UserController extends Controller
* @param FlightRepository $flightRepo
* @param FlightService $flightSvc
* @param PirepRepository $pirepRepo
* @param SubfleetRepository $subfleetRepo
* @param UserRepository $userRepo
* @param UserService $userSvc
*/
@@ -47,14 +45,12 @@ class UserController extends Controller
FlightRepository $flightRepo,
FlightService $flightSvc,
PirepRepository $pirepRepo,
SubfleetRepository $subfleetRepo,
UserRepository $userRepo,
UserService $userSvc
) {
$this->flightRepo = $flightRepo;
$this->flightSvc = $flightSvc;
$this->pirepRepo = $pirepRepo;
$this->subfleetRepo = $subfleetRepo;
$this->userRepo = $userRepo;
$this->userSvc = $userSvc;
}

View File

@@ -28,6 +28,9 @@ class AirportController extends Controller
* Show the airport
*
* @param mixed $id
*
* @return mixed
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
*/
public function show($id, Request $request)
{

View File

@@ -54,7 +54,10 @@ class DownloadController extends Controller
/**
* Show the application dashboard.
*
* @param mixed $id
* @param string $id
*
* @return mixed
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\StreamedResponse
*/
public function show($id)
{

View File

@@ -284,6 +284,7 @@ class PirepController extends Controller
}
// is the aircraft in the right place?
/** @noinspection NotOptimalIfConditionsInspection */
if (setting('pireps.only_aircraft_at_dpt_airport')
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
return $this->flashError(
@@ -356,7 +357,7 @@ class PirepController extends Controller
// set the custom fields
foreach ($pirep->fields as $field) {
if ($field->slug == null) {
if ($field->slug === null) {
$field->slug = str_slug($field->name);
}