GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 46d3c7...307a35 )
by Mahdi
01:07
created

Filterable::getNamespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Mjedari\Larafilter\Traits;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Mjedari\Larafilter\Facades\LaraFilter;
7
8
/**
9
 * @property array $filters
10
 * @method static Builder filter()
11
 * @method static Builder filterThrough(array $filters)
12
 */
13
trait Filterable
14
{
15
    public function scopeFilter(Builder $query)
16
    {
17
        $this->handel($query, static::$filters);
18
    }
19
20
    public function scopeFilterThrough(Builder $query, array $filters)
21
    {
22
        $this->handel($query, $filters);
23
    }
24
25
    protected function handel($query, $modelFilters)
0 ignored issues
show
Unused Code introduced by
The parameter $modelFilters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        $queryFilters = request()->query();
28
        return collect($queryFilters)->map(function ($filter, $value) use ($query) {
29
            // Reject if model doesn't has the filter
30
            $normalizedFilters = LaraFilter::normalizeFilters(self::$filters);
31
            if (! $normalizedFilters->get($value)) {
32
                return false;
33
            }
34
            $class = $normalizedFilters->get($value);
35
36
            return (new $class())->apply($query);
37
        });
38
    }
39
40
}
41