for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zing\QueryBuilder\Concerns;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
trait WithSorts
{
/**
* 排序逻辑.
*
* @param array $inputs
* @param array $sorts
* @return mixed
*/
protected function applySort($inputs, $sorts)
$inputs
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
protected function applySort(/** @scrutinizer ignore-unused */ $inputs, $sorts)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
foreach (['desc', 'asc'] as $direction) {
$this->when($this->request->input($direction),
when()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$this->/** @scrutinizer ignore-call */
when($this->request->input($direction),
function (Builder $query, $descAttribute) use ($sorts, $direction) {
if (array_key_exists($descAttribute, $sorts)) {
$descAttribute = Arr::get($sorts, $descAttribute);
}
return $query->orderBy($descAttribute, $direction);
);
return $this;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.