Issues (11)

src/Criteria/UserCriteria.php (2 issues)

1
<?php
2
3
namespace Del\Criteria;
4
5
class UserCriteria
6
{
7
    const ORDER_ASC = 'ASC';
8
    const ORDER_DESC = 'DESC';
9
10
    const ORDER_ID = 'id';
11
    const ORDER_EMAIL = 'email';
12
    const ORDER_STATE  = 'state';
13
    const ORDER_REG_DATE = 'registrationDate';
14
    const ORDER_LAST_LOGIN_DATE = 'lastLoginDate';
15
16
    protected $id;
17
    protected $email;
18
    protected $state;
19
    protected $registrationDate;
20
    protected $lastLoginDate;
21
22
    protected $limit;
23
    protected $offset;
24
    protected $order;
25
    protected $orderDirection;
26
27
    /**
28
     * @return bool
29
     */
30 1
    public function hasOffset()
31
    {
32 1
        return $this->offset !== null;
33
    }
34
35
    /**
36
     * @param $code
37
     * @return $this
38
     */
39 2
    public function setOffset($code)
40
    {
41 2
        $this->offset = $code;
42 2
        return $this;
43
    }
44
45
    /**
46
     * @return mixed
47
     */
48 1
    public function getOffset()
49
    {
50 1
        return $this->offset;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56 1
    public function hasLimit()
57
    {
58 1
        return $this->limit !== null;
59
    }
60
61
    /**
62
     * @param $code
63
     * @return $this
64
     */
65 2
    public function setLimit($code)
66
    {
67 2
        $this->limit = $code;
68 2
        return $this;
69
    }
70
71
    /**
72
     * @return mixed
73
     */
74 1
    public function getLimit()
75
    {
76 1
        return $this->limit;
77
    }
78
79
    /**
80
     * @return bool
81
     */
82 1
    public function hasOrder()
83
    {
84 1
        return $this->order !== null;
85
    }
86
87
    /**
88
     * @param $code
89
     * @return $this
90
     */
91 1
    public function setOrder($order)
92
    {
93 1
        $this->order = $order;
94 1
        return $this;
95
    }
96
97
    /**
98
     * @return mixed
99
     */
100 1
    public function getOrder()
101
    {
102 1
        return $this->order;
103
    }
104
105
    /**
106
     * @return mixed
107
     */
108 1
    public function getOrderDirection()
109
    {
110 1
        return $this->orderDirection;
111
    }
112
113
    /**
114
     * @param mixed $orderDirection
115
     * @return Criteria
0 ignored issues
show
The type Del\Criteria\Criteria 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...
116
     */
117 1
    public function setOrderDirection($orderDirection)
118
    {
119 1
        $this->orderDirection = $orderDirection;
120 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Del\Criteria\UserCriteria which is incompatible with the documented return type Del\Criteria\Criteria.
Loading history...
121
    }
122
123
    /**
124
     * @return bool
125
     */
126 1
    public function hasOrderDirection()
127
    {
128 1
        return $this->orderDirection !== null;
129
    }
130
131
    /**
132
     * @param $page
133
     * @param $limit
134
     */
135 1
    public function setPagination($page, $limit)
136
    {
137 1
        $offset = ($limit * $page) - $limit;
138 1
        $this->setLimit($limit);
139 1
        $this->setOffset($offset);
140
    }
141
142
    /**
143
     * @return int
144
     */
145 1
    public function getId(): int
146
    {
147 1
        return $this->id;
148
    }
149
150
    /**
151
     * @param $id
152
     */
153 2
    public function setId(int $id): void
154
    {
155 2
        $this->id = $id;
156
    }
157
158
    /**
159
     * @return bool
160
     */
161 1
    public function hasId(): bool
162
    {
163 1
        return $this->id != null;
164
    }
165
166
    /**
167
     * @return mixed
168
     */
169 1
    public function getEmail(): string
170
    {
171 1
        return $this->email;
172
    }
173
174
    /**
175
     * @param string $email
176
     */
177 14
    public function setEmail($email): void
178
    {
179 14
        $this->email = $email;
180
    }
181
182
    /**
183
     * @return bool
184
     */
185 1
    public function hasEmail(): bool
186
    {
187 1
        return $this->email != null;
188
    }
189
190
    /**
191
     * @return int
192
     */
193 1
    public function getState(): int
194
    {
195 1
        return $this->state;
196
    }
197
198
    /**
199
     * @param mixed $state
200
     */
201 3
    public function setState(int $state): void
202
    {
203 3
        $this->state = $state;
204
    }
205
206
    /**
207
     * @return bool
208
     */
209 1
    public function hasState(): bool
210
    {
211 1
        return $this->state != null;
212
    }
213
214
    /**
215
     * @return string
216
     */
217 1
    public function getRegistrationDate(): string
218
    {
219 1
        return $this->registrationDate;
220
    }
221
222
    /**
223
     * @param string $registrationDate
224
     */
225 3
    public function setRegistrationDate(string $registrationDate): void
226
    {
227 3
        $this->registrationDate = $registrationDate;
228
    }
229
230
    /**
231
     * @return bool
232
     */
233 1
    public function hasRegistrationDate(): bool
234
    {
235 1
        return $this->registrationDate != null;
236
    }
237
238
    /**
239
     * @return string
240
     */
241 1
    public function getLastLoginDate(): string
242
    {
243 1
        return $this->lastLoginDate;
244
    }
245
246
    /**
247
     * @param string $lastLoginDate
248
     */
249 3
    public function setLastLoginDate(string $lastLoginDate): void
250
    {
251 3
        $this->lastLoginDate = $lastLoginDate;
252
    }
253
254
    /**
255
     * @return bool
256
     */
257 1
    public function hasLastLoginDate(): bool
258
    {
259 1
        return $this->lastLoginDate != null;
260
    }
261
}
262