Completed
Push — master ( b54f87...bde51f )
by Beniamin
04:50
created

QueryClauses::getHavingClauses()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder;
13
14
/**
15
 * @author Beniamin Jonatan Šimko <[email protected]>
16
 */
17
class QueryClauses
18
{
19
    const QUERY_SELECT = 1;
20
    const QUERY_UPDATE = 2;
21
22
    /**
23
     * @var array $selectClauses
24
     */
25
    private $selectClauses = [];
26
27
    /**
28
     * @var array $whereClauses
29
     */
30
    private $whereClauses = [];
31
32
    /**
33
     * @var array $orderByClauses
34
     */
35
    private $orderByClauses = [];
36
37
    /**
38
     * @var array $setClauses
39
     */
40
    private $setClauses = [];
41
42
    /**
43
     * @var array $groupByClauses
44
     */
45
    private $groupByClauses = [];
46
47
    /**
48
     * @var array $havingClauses
49
     */
50
    private $havingClauses = [];
51
52
    /**
53
     * @var string $limitClause
54
     */
55
    private $limitClause;
56
57
    /**
58
     * @var array $queryHints
59
     */
60
    private $queryHints = [];
61
62
    /**
63
     * @var array $insertColumns
64
     */
65
    private $insertColumns = [];
66
67
    /**
68
     * @var array $insertValues
69
     */
70
    private $insertValues = [];
71
72
    /**
73
     * @param string $clause
74
     *
75
     * @return $this
76
     */
77
    public function addSelect($clause)
78
    {
79
        $this->selectClauses[] = $clause;
80
81
        return $this;
82
    }
83
84
    /**
85
     * @param string $clause
86
     *
87
     * @return $this
88
     */
89
    public function andWhere($clause)
90
    {
91
        $this->whereClauses[] = $clause;
92
93
        return $this;
94
    }
95
96
    /**
97
     * @param string $clause
98
     *
99
     * @return $this
100
     */
101
    public function andHaving($clause)
102
    {
103
        $this->havingClauses[] = $clause;
104
105
        return $this;
106
    }
107
108
    /**
109
     * @param string $clause
110
     *
111
     * @return $this
112
     */
113
    public function addOrderBy($clause)
114
    {
115
        $this->orderByClauses[] = $clause;
116
117
        return $this;
118
    }
119
120
    /**
121
     * @param string $clause
122
     *
123
     * @return $this
124
     */
125
    public function addSet($clause)
126
    {
127
        $this->setClauses[] = $clause;
128
129
        return $this;
130
    }
131
132
    /**
133
     * @param string $clause
134
     *
135
     * @return $this
136
     */
137
    public function addGroupBy($clause)
138
    {
139
        $this->groupByClauses[] = $clause;
140
141
        return $this;
142
    }
143
144
    /**
145
     * @param string $clause
146
     *
147
     * @return $this
148
     */
149
    public function setLimit($clause)
150
    {
151
        $this->limitClause = $clause;
152
153
        return $this;
154
    }
155
156
    /**
157
     * @param int    $hint
158
     * @param mixed $value
159
     *
160
     * @return $this
161
     */
162
    public function addQueryHint($hint, $value = null)
163
    {
164
        $this->queryHints[$hint] = $value;
165
166
        return $this;
167
    }
168
169
    /**
170
     * @param array $columns
171
     *
172
     * @return $this
173
     */
174
    public function setInsertColumns(array $columns = [])
175
    {
176
        $this->insertColumns = $columns;
177
178
        return $this;
179
    }
180
181
    /**
182
     * @param $value
183
     *
184
     * @return $this
185
     */
186
    public function addInsertValue($value)
187
    {
188
        $this->insertValues[] = $value;
189
190
        return $this;
191
    }
192
193
    /**
194
     * @return array
195
     */
196
    public function getSelectClauses()
197
    {
198
        return $this->selectClauses;
199
    }
200
201
    /**
202
     * @return array
203
     */
204
    public function getWhereClauses()
205
    {
206
        return $this->whereClauses;
207
    }
208
209
    /**
210
     * @return array
211
     */
212
    public function getOrderByClauses()
213
    {
214
        return $this->orderByClauses;
215
    }
216
217
    /**
218
     * @return array
219
     */
220
    public function getSetClauses()
221
    {
222
        return $this->setClauses;
223
    }
224
225
    /**
226
     * @return array
227
     */
228
    public function getGroupByClauses()
229
    {
230
        return $this->groupByClauses;
231
    }
232
233
    /**
234
     * @return array
235
     */
236
    public function getHavingClauses()
237
    {
238
        return $this->havingClauses;
239
    }
240
241
    /**
242
     * @return string
243
     */
244
    public function getLimitClause()
245
    {
246
        return $this->limitClause;
247
    }
248
249
    /**
250
     * @return array
251
     */
252
    public function getQueryHints()
253
    {
254
        return $this->queryHints;
255
    }
256
257
    /**
258
     * @return array
259
     */
260
    public function getInsertValues()
261
    {
262
        return $this->insertValues;
263
    }
264
}