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.
Passed
Pull Request — master (#170)
by
unknown
02:50
created

Filters::setRel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Mado\QueryBundle\Filters;
4
5
6
use Mado\QueryBundle\Dictionary;
7
use Mado\QueryBundle\Queries\QueryBuilderOptions;
8
9
class Filters implements FiltersInterface
10
{
11
    private $discriminatorCounter = 1;
12
13
    private $route = '';
14
    private $routeParams = '';
15
    private $id = '';
16
17
    private $andFilters = [];
18
    private $orFilters = [];
19
20
    private $sorting = [];
21
22
    private $printing = [];
23
    private $rel = '';
24
    private $page = '';
25
    private $select = '';
26
    private $limit = '';
27
28
    protected function __construct()
29
    {
30
    }
31
32
    public static function emptyFilter()
33
    {
34
        return new self();
35
    }
36
37
    public function addAndFilter(string $field, string $operator, string $value, bool $replaceIfExist = false)
38
    {
39
        Dictionary::isValidOperator($operator);
40
41
        $key = $field . '|' . $operator;
42
        while ($replaceIfExist === false && isset($this->andFilters[$key])) {
43
            $key = $field . '|' . $operator . '|' . $this->getDiscriminator();
44
        }
45
46
        $this->andFilters[$key] = $value;
47
48
        return $this;
49
    }
50
51
    public function addOrFilter(string $field, string $operator, string $value, bool $replaceIfExist = false)
52
    {
53
        Dictionary::isValidOperator($operator);
54
55
        $key = $field . '|' . $operator;
56
        while ($replaceIfExist === false && isset($this->orFilters[$key])) {
57
            $key = $field . '|' . $operator . '|' . $this->getDiscriminator();
58
        }
59
60
        $this->orFilters[$key] = $value;
61
62
        return $this;
63
    }
64
65
    protected function getDiscriminator()
66
    {
67
        return $this->discriminatorCounter++;
68
    }
69
70
    protected function setId($id)
71
    {
72
        $this->id = $id;
73
    }
74
75
    protected function setRoute(string $route)
76
    {
77
        $this->route = $route;
78
    }
79
80
    protected function setRouteParams(array $routeParams)
81
    {
82
        $this->routeParams = $routeParams;
83
    }
84
85
    protected function setAndFilters(array $andFilters)
86
    {
87
        $this->andFilters = $andFilters;
88
    }
89
90
    protected function setOrFilters(array $orFilters)
91
    {
92
        $this->orFilters = $orFilters;
93
    }
94
95
    protected function setSorting(array $sorting)
96
    {
97
        $this->sorting = $sorting;
98
    }
99
100
    protected function setPrinting(array $printing)
101
    {
102
        $this->printing = $printing;
103
    }
104
105
    protected function setRel(string $rel)
106
    {
107
        $this->rel = $rel;
108
    }
109
110
    protected function setPage(string $page)
111
    {
112
        $this->page = $page;
113
    }
114
115
    protected function setSelect(string $select)
116
    {
117
        $this->select = $select;
118
    }
119
120
    protected function setLimit(string $limit)
121
    {
122
        $this->limit = $limit;
123
    }
124
125
    public function getQueryBuilderOptions(): QueryBuilderOptions
126
    {
127
        return QueryBuilderOptions::fromArray([
128
            '_route'        => $this->route,
129
            '_route_params' => $this->routeParams,
130
            'id'            => $this->id,
131
            'page'          => $this->page,
132
            'limit'         => $this->limit,
133
            'filters'       => $this->andFilters,
134
            'orFilters'     => $this->orFilters,
135
            'sorting'       => $this->sorting,
136
            'rel'           => $this->rel,
137
            'select'        => $this->select,
138
            'printing'      => $this->printing,
139
        ]);
140
    }
141
}
142