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.

Special   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 15
c 1
b 0
f 0
dl 0
loc 36
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 17 5
1
<?php
2
3
namespace eloquentFilter\QueryFilter\Queries;
4
5
use eloquentFilter\QueryFilter\Exceptions\EloquentFilterException;
6
use Illuminate\Database\Eloquent\Builder;
7
8
/**
9
 * Class Special.
10
 */
11
class Special extends BaseClause
12
{
13
    /**
14
     * @var array
15
     */
16
    public static $reserve_param = [
17
        'f_params' => [
18
            'limit',
19
            'orderBy',
20
        ],
21
    ];
22
23
    /**
24
     * @param $query
25
     *
26
     * @throws \Exception
27
     *
28
     * @return Builder
29
     */
30
    public function apply($query): Builder
31
    {
32
        foreach ($this->values as $key => $param_value) {
33
            if (!in_array($key, self::$reserve_param['f_params'])) {
34
                throw new EloquentFilterException("$key is not in f_params array.", 2);
35
            }
36
            if (is_array($param_value)) {
37
                $this->values['orderBy']['field'] = explode(',', $this->values['orderBy']['field']);
38
                foreach ($this->values['orderBy']['field'] as $order_by) {
39
                    $query->orderBy($order_by, $this->values['orderBy']['type']);
40
                }
41
            } else {
42
                $query->limit($param_value);
43
            }
44
        }
45
46
        return $query;
47
    }
48
}
49