Filterable::scopeFilter()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
namespace HChamran\LaravelFilter\Traits;
4
5
use HChamran\LaravelFilter\Contracts\QueryFilter;
6
7
/**
8
 * @method static filter(string $string)
9
 */
10
trait Filterable
11
{
12
    /**
13
     * @param $query
14
     * @param QueryFilter $filter
15
     * @return \Illuminate\Database\Eloquent\Builder
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Builder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
     */
17
    public function scopeFilter($query, $filter)
18
    {
19
        if (is_string($filter))
0 ignored issues
show
introduced by
The condition is_string($filter) is always false.
Loading history...
20
            return getInstanceFilter($filter)->builder($query);
21
        elseif ($filter instanceof QueryFilter)
0 ignored issues
show
introduced by
$filter is always a sub-type of HChamran\LaravelFilter\Contracts\QueryFilter.
Loading history...
22
            return $filter->builder($query);
23
    }
24
}