Completed
Push — master ( 372908...46391f )
by Derek Stephen
05:54
created

EntryCriteria::hasDateRange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Del\Expenses\Criteria;
4
5
use DateTime;
6
use Del\Common\Criteria as CommonCriteria;
7
8
9
class EntryCriteria extends CommonCriteria
10
{
11
    const ORDER_AMOUNT          = 'amount';
12
    const ORDER_CATEGORY        = 'category';
13
    const ORDER_DATE            = 'date';
14
    const ORDER_DESCRIPTION     = 'description';
15
    const ORDER_ID              = 'id';
16
    const ORDER_NOTE            = 'note';
17
    const ORDER_TYPE            = 'type';
18
    const ORDER_USERID          = 'userId';
19
20
    protected $id;
21
    protected $userId;
22
    protected $date;
23
    protected $dateRange;
24
    protected $amount;
25
    protected $category;
26
    protected $description;
27
    protected $note;
28
    protected $type;
29
30
    /**
31
     * @return int
32
     */
33 3
    public function getId()
34
    {
35 3
        return $this->id;
36
    }
37
38
    /**
39
     * @param $id
40
     * @return $this
41
     */
42 3
    public function setId($id)
43
    {
44 3
        $this->id = (int) $id;
45 3
        return $this;
46
    }
47
48
    /**
49
     * @return bool
50
     */
51 4
    public function hasId()
52
    {
53 4
        return $this->id != null;
54
    }
55
56
    /**
57
     * @return int
58
     */
59 1
    public function getUserId()
60
    {
61 1
        return $this->userId;
62
    }
63
64
    /**
65
     * @param $id
66
     * @return $this
67
     */
68 1
    public function setUserId($id)
69
    {
70 1
        $this->userId = (int) $id;
71 1
        return $this;
72
    }
73
74
    /**
75
     * @return bool
76
     */
77 4
    public function hasUserId()
78
    {
79 4
        return $this->userId != null;
80
    }
81
82
    /**
83
     * @return mixed
84
     */
85 1
    public function getDate()
86
    {
87 1
        return $this->date;
88
    }
89
90
    /**
91
     * @param mixed $date
92
     * @return EntryCriteria
93
     */
94 1
    public function setDate($date)
95
    {
96 1
        $this->date = $date;
97 1
        return $this;
98
    }
99
100
    /**
101
     * @return bool
102
     */
103 4
    public function hasDateRange()
104
    {
105 4
        return $this->dateRange != null;
106
    }
107
108
    /**
109
     * @return mixed
110
     */
111 1
    public function getDateRange()
112
    {
113 1
        return $this->dateRange;
114
    }
115
116
    /**
117
     * @param string $fromDate
118
     * @param string $toDate
119
     * @return $this
120
     */
121 1
    public function setDateRange($fromDate, $toDate)
122
    {
123 1
        $this->dateRange = [
124 1
            $fromDate, $toDate
125 1
        ];
126 1
        return $this;
127
    }
128
129
    /**
130
     * @return bool
131
     */
132 4
    public function hasDate()
133
    {
134 4
        return $this->date != null;
135
    }
136
137
    /**
138
     * @return mixed
139
     */
140 1
    public function getAmount()
141
    {
142 1
        return $this->amount;
143
    }
144
145
    /**
146
     * @param mixed $amount
147
     * @return EntryCriteria
148
     */
149 1
    public function setAmount($amount)
150
    {
151 1
        $this->amount = $amount;
152 1
        return $this;
153
    }
154
155
    /**
156
     * @return bool
157
     */
158 4
    public function hasAmount()
159
    {
160 4
        return $this->amount != null;
161
    }
162
163
    /**
164
     * @return mixed
165
     */
166 1
    public function getCategory()
167
    {
168 1
        return $this->category;
169
    }
170
171
    /**
172
     * @param mixed $category
173
     * @return EntryCriteria
174
     */
175 1
    public function setCategory($category)
176
    {
177 1
        $this->category = $category;
178 1
        return $this;
179
    }
180
181
    /**
182
     * @return bool
183
     */
184 4
    public function hasCategory()
185
    {
186 4
        return $this->category != null;
187
    }
188
189
    /**
190
     * @return mixed
191
     */
192 1
    public function getDescription()
193
    {
194 1
        return $this->description;
195
    }
196
197
    /**
198
     * @param mixed $description
199
     * @return EntryCriteria
200
     */
201 1
    public function setDescription($description)
202
    {
203 1
        $this->description = $description;
204 1
        return $this;
205
    }
206
207
    /**
208
     * @return bool
209
     */
210 4
    public function hasDescription()
211
    {
212 4
        return $this->description != null;
213
    }
214
215
    /**
216
     * @return mixed
217
     */
218 1
    public function getNote()
219
    {
220 1
        return $this->note;
221
    }
222
223
    /**
224
     * @param mixed $note
225
     * @return EntryCriteria
226
     */
227 1
    public function setNote($note)
228
    {
229 1
        $this->note = $note;
230 1
        return $this;
231
    }
232
233
    /**
234
     * @return bool
235
     */
236 4
    public function hasNote()
237
    {
238 4
        return $this->note != null;
239
    }
240
241
    /**
242
     * @return mixed
243
     */
244 1
    public function getType()
245
    {
246 1
        return $this->type;
247
    }
248
249
    /**
250
     * @param mixed $type
251
     * @return EntryCriteria
252
     */
253 1
    public function setType($type)
254
    {
255 1
        $this->type = $type;
256 1
        return $this;
257
    }
258
259
    /**
260
     * @return bool
261
     */
262 4
    public function hasType()
263
    {
264 4
        return $this->type != null;
265
    }
266
267
268
}