Query::orderBy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Prozorov\Repositories;
6
7
class Query
8
{
9
    /**
10
     * @var integer $limit
11
     */
12
    protected $limit = 20;
13
14
    /**
15
     * @var integer $offset
16
     */
17
    protected $offset = 0;
18
19
    /**
20
     * @var mixed $select
21
     */
22
    protected $select = null;
23
24
    /**
25
     * @var bool $withMeta
26
     */
27
    protected $withMeta = false;
28
29
    /**
30
     * @var bool $countTotal
31
     */
32
    protected $countTotal = false;
33
34
    /**
35
     * @var array $orderBy
36
     */
37
    protected $orderBy;
38
39
    /**
40
     * @var array $filter
41
     */
42
    protected $filter;
43
44
    /**
45
     * Get $countTotal
46
     *
47
     * @return  bool
48
     */ 
49
    public function isCountTotal(): bool
50
    {
51
        return $this->countTotal;
52
    }
53
54
    /**
55
     * Set $countTotal
56
     *
57
     * @return  self
58
     */ 
59
    public function countTotal()
60
    {
61
        $this->countTotal = true;
62
63
        return $this;
64
    }
65
66
    /**
67
     * Get $withMeta
68
     *
69
     * @return  bool
70
     */ 
71
    public function isWithMeta()
72
    {
73
        return $this->withMeta;
74
    }
75
76
    /**
77
     * Set $withMeta
78
     *
79
     * @return  self
80
     */ 
81
    public function withMeta()
82
    {
83
        $this->withMeta = true;
84
85
        return $this;
86
    }
87
88
    /**
89
     * Get $select
90
     *
91
     * @return  mixed
92
     */ 
93
    public function getSelect()
94
    {
95
        return $this->select;
96
    }
97
98
    /**
99
     * Set $select
100
     *
101
     * @param  mixed  $select
102
     *
103
     * @return  self
104
     */ 
105
    public function select($select)
106
    {
107
        $this->select = $select;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Get $offset
114
     *
115
     * @return  integer
116
     */ 
117
    public function getOffset(): int
118
    {
119
        return $this->offset;
120
    }
121
122
    /**
123
     * Set $offset
124
     *
125
     * @param  integer  $offset
126
     *
127
     * @return  self
128
     */ 
129
    public function offset(int $offset)
130
    {
131
        $this->offset = $offset;
132
133
        return $this;
134
    }
135
136
    /**
137
     * Get $limit
138
     *
139
     * @return  integer
140
     */ 
141
    public function getLimit(): int
142
    {
143
        return $this->limit;
144
    }
145
146
    /**
147
     * Set $limit
148
     *
149
     * @param  integer  $limit
150
     *
151
     * @return  self
152
     */ 
153
    public function limit(int $limit)
154
    {
155
        $this->limit = $limit;
156
157
        return $this;
158
    }
159
160
    /**
161
     * Get $orderBy
162
     *
163
     * @return  array
164
     */ 
165
    public function getOrderBy()
166
    {
167
        return $this->orderBy;
168
    }
169
170
    /**
171
     * Set $orderBy
172
     *
173
     * @param  array  $orderBy  $orderBy
174
     *
175
     * @return  self
176
     */ 
177
    public function orderBy(array $orderBy)
178
    {
179
        $this->orderBy = $orderBy;
180
181
        return $this;
182
    }
183
184
    /**
185
     * Get $filter
186
     *
187
     * @return  array
188
     */ 
189 6
    public function getWhere()
190
    {
191 6
        return $this->filter;
192
    }
193
194
    /**
195
     * Set $filter
196
     *
197
     * @param  array  $filter  $filter
198
     *
199
     * @return  self
200
     */ 
201 5
    public function where(array $filter)
202
    {
203 5
        $this->filter = $filter;
204
205 5
        return $this;
206
    }
207
}
208