Skip to content

Commit

Permalink
Updated to use collection count (#324)
Browse files Browse the repository at this point in the history
* Updated to use collection count

* Apply fixes from StyleCI (#325)

Co-authored-by: Roshan Gautam <[email protected]>

Co-authored-by: Roshan Gautam <[email protected]>
Co-authored-by: Roshan Gautam <[email protected]>
  • Loading branch information
3 people authored Mar 22, 2022
1 parent 41c588b commit 60cb88f
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function down()
}

/**
* @param bool $toFloat
* @param bool $toFloat
*/
private function migrateDurationValues(bool $toFloat = true)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/ListSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ListSchedule extends Command
/**
* Create a new command instance.
*
* @param Schedule $schedule
* @param Schedule $schedule
* @return void
*/
public function __construct(Schedule $schedule)
Expand Down
6 changes: 4 additions & 2 deletions src/Contracts/TaskInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,30 @@ public function find($id);

/**
* Returns all tasks.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function findAll();

/**
* Returns all active tasks.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function findAllActive();

/**
* Creates a new task with the given data.
*
* @param array $input
* @param array $input
* @return \Studio\Totem\Task
*/
public function store(array $input);

/**
* Updates the given task with the given data.
*
* @param array $input
* @param array $input
* @param \Studio\Totem\Task $task
* @return \Studio\Totem\Task
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Events/Creating.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Creating implements ShouldBroadcast
/**
* Create a new event instance.
*
* @param array $input
* @param array $input
*/
public function __construct(array $input)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Events/Deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class Deleted extends Event
/**
* Create a new event instance.
*
* @param array $input
* @param Task $task
* @param array $input
* @param Task $task
*/
public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Events/Executed.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Executed extends BroadcastingEvent
/**
* Executed constructor.
*
* @param Task $task
* @param string $started
* @param Task $task
* @param string $started
*/
public function __construct(Task $task, $started, $output)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Events/TaskEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TaskEvent extends Event
/**
* Constructor.
*
* @param Task $task
* @param Task $task
*/
public function __construct(Task $task)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Events/Updating.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Updating extends BroadcastingEvent
/**
* Create a new event instance.
*
* @param array $input
* @param Task $task
* @param array $input
* @param Task $task
*/
public function __construct(array $input, Task $task)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/ActiveTasksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ActiveTasksController extends Controller
private $tasks;

/**
* @param TaskInterface $tasks
* @param TaskInterface $tasks
*/
public function __construct(TaskInterface $tasks)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/ExecuteTasksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ExecuteTasksController extends Controller
private $tasks;

/**
* @param TaskInterface $tasks
* @param TaskInterface $tasks
*/
public function __construct(TaskInterface $tasks)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/ExportTasksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class ExportTasksController extends Controller

/**
* ExportTasksController constructor.
* @param TaskInterface $tasks
*
* @param TaskInterface $tasks
*/
public function __construct(TaskInterface $tasks)
{
Expand Down
7 changes: 5 additions & 2 deletions src/Http/Controllers/ImportTasksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class ImportTasksController extends Controller

/**
* ImportTasksController constructor.
* @param TaskInterface $tasks
*
* @param TaskInterface $tasks
*/
public function __construct(TaskInterface $tasks)
{
Expand All @@ -25,7 +26,9 @@ public function __construct(TaskInterface $tasks)

/**
* Import tasks from a json file.
* @param \Studio\Totem\Http\Requests\ImportRequest $request
*
* @param \Studio\Totem\Http\Requests\ImportRequest $request
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function index(ImportRequest $request)
Expand Down
4 changes: 3 additions & 1 deletion src/Http/Requests/ImportRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function messages()
*
* @param array|mixed $keys
* @return array
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function all($keys = null)
Expand All @@ -68,6 +69,7 @@ public function all($keys = null)
* Get the validated data from the request.
*
* @return array
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function validated()
Expand All @@ -84,7 +86,7 @@ public function validated()
/**
* * Handle a failed validation attempt.
*
* @param Validator $validator
* @param Validator $validator
*/
protected function failedValidation(Validator $validator)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Listeners/BuildCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function handle(Event $event)
/**
* Rebuild Cache.
*
* @param Event $event
* @param Event $event
*/
protected function build(Event $event)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Listeners/BustCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function handle(Event $event)
/**
* Clear Cache.
*
* @param Event $event
* @param Event $event
*/
protected function clear(Event $event)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners/BustCacheImmediately.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BustCacheImmediately
/**
* Create the event listener.
*
* @param Container $app
* @param Container $app
*/
public function __construct(Container $app)
{
Expand All @@ -35,7 +35,7 @@ public function handle(Event $event)
/**
* Clear Cache.
*
* @param Event $event
* @param Event $event
*/
protected function clear(Event $event)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class Listener implements ShouldQueue
/**
* Create the event listener.
*
* @param Container $app
* @param TaskInterface $tasks
* @param Container $app
* @param TaskInterface $tasks
*/
public function __construct(Container $app, TaskInterface $tasks)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Repositories/EloquentTaskRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function builder(): Builder
/**
* Find a task by id.
*
* @param int|Task $id
* @param int|Task $id
* @return int|Task
*/
public function find($id)
Expand Down Expand Up @@ -87,7 +87,7 @@ public function findAllActive()
/**
* Create a new task.
*
* @param array $input
* @param array $input
* @return bool|Task
*/
public function store(array $input)
Expand All @@ -108,8 +108,8 @@ public function store(array $input)
/**
* Update the given task.
*
* @param array $input
* @param Task $task
* @param array $input
* @param Task $task
* @return bool|int|Task
*/
public function update(array $input, $task)
Expand All @@ -130,7 +130,7 @@ public function update(array $input, $task)
/**
* Delete the given task.
*
* @param int|Task $id
* @param int|Task $id
* @return bool
*/
public function destroy($id)
Expand Down
4 changes: 2 additions & 2 deletions src/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function autoCleanup()
Result::query()
->whereIn('id', $rowsToDelete)
->delete();
} while ($rowsToDelete > 0);
} while ($rowsToDelete->count() > 0);
} else {
do {
$rowsToDelete = $this->results()
Expand All @@ -221,7 +221,7 @@ public function autoCleanup()
Result::query()
->whereIn('id', $rowsToDelete)
->delete();
} while ($rowsToDelete > 0);
} while ($rowsToDelete->count() > 0);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Totem.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Totem
* Determine if the given request can access the Totem dashboard.
*
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public static function check($request)
Expand All @@ -36,7 +35,6 @@ public static function check($request)
* Set the callback that should be used to authenticate Totem users.
*
* @param \Closure $callback
*
* @return static
*/
public static function auth(Closure $callback)
Expand Down
7 changes: 3 additions & 4 deletions src/Traits/FrontendSortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
trait FrontendSortable
{
/**
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param array $sortableColumns
* @param array $defaultSort
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param array $sortableColumns
* @param array $defaultSort
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeSortableBy(Builder $builder, array $sortableColumns, array $defaultSort = ['name' => 'asc']): Builder
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ViewDashboardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public function view_dashboard_multiple_tasks_with_multiple_results()
}

/**
* @param int $task_count
* @param int $result_count
* @param int $task_count
* @param int $result_count
* @return mixed
*/
private function _get_task_with_results($task_count = 1, $result_count = 1)
Expand Down

0 comments on commit 60cb88f

Please sign in to comment.