Apply fixes from StyleCI

This commit is contained in:
Nabeel Shahzad
2018-08-26 16:40:04 +00:00
committed by StyleCI Bot
parent 20f46adbc4
commit 9596d88b48
407 changed files with 4032 additions and 3286 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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
*/

View File

@@ -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']);

View File

@@ -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) {