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

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository;
/**
* Class AwardRepository
* @package App\Repositories
*/
class AwardRepository extends Repository implements CacheableInterface
{

View File

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

View File

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

View File

@@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository;
/**
* Class FareRepository
* @package App\Repositories
*/
class FareRepository extends Repository implements CacheableInterface
{

View File

@@ -7,7 +7,6 @@ use App\Models\FlightField;
/**
* Class FlightFieldRepository
* @package App\Repositories
*/
class FlightFieldRepository extends Repository
{

View File

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

View File

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

View File

@@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository;
/**
* Class NavdataRepository
* @package App\Repositories
*/
class NavdataRepository extends Repository implements CacheableInterface
{

View File

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

View File

@@ -7,7 +7,6 @@ use App\Models\PirepField;
/**
* Class PirepFieldRepository
* @package App\Repositories
*/
class PirepFieldRepository extends Repository
{

View File

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

View File

@@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository;
/**
* Class RankRepository
* @package App\Repositories
*/
class RankRepository extends Repository implements CacheableInterface
{

View File

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

View File

@@ -9,7 +9,6 @@ use Prettus\Repository\Traits\CacheableRepository;
/**
* Class SubfleetRepository
* @package App\Repositories
*/
class SubfleetRepository extends Repository implements CacheableInterface
{

View File

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