Completed
Push — master ( fa521d...b54f87 )
by Beniamin
03:19
created

QueryClauses::guessQueryType()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A QueryClauses::addSelect() 0 6 1
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\QueryBuilder;
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
     * @param string $clause
64
     *
65
     * @return $this
66
     */
67 22
    public function addSelect($clause)
68
    {
69 22
        $this->selectClauses[] = $clause;
70
71 22
        return $this;
72
    }
73
74
    /**
75
     * @param string $clause
76
     *
77
     * @return $this
78
     */
79 7
    public function andWhere($clause)
80
    {
81 7
        $this->whereClauses[] = $clause;
82
83 7
        return $this;
84
    }
85
86
    /**
87
     * @param string $clause
88
     *
89
     * @return $this
90
     */
91 1
    public function andHaving($clause)
92
    {
93 1
        $this->havingClauses[] = $clause;
94
95 1
        return $this;
96
    }
97
98
    /**
99
     * @param string $clause
100
     *
101
     * @return $this
102
     */
103 2
    public function addOrderBy($clause)
104
    {
105 2
        $this->orderByClauses[] = $clause;
106
107 2
        return $this;
108
    }
109
110
    /**
111
     * @param string $clause
112
     *
113
     * @return $this
114
     */
115 4
    public function addSet($clause)
116
    {
117 4
        $this->setClauses[] = $clause;
118
119 4
        return $this;
120
    }
121
122
    /**
123
     * @param string $clause
124
     *
125
     * @return $this
126
     */
127 3
    public function addGroupBy($clause)
128
    {
129 3
        $this->groupByClauses[] = $clause;
130
131 3
        return $this;
132
    }
133
134
    /**
135
     * @param string $clause
136
     *
137
     * @return $this
138
     */
139 2
    public function setLimit($clause)
140
    {
141 2
        $this->limitClause = $clause;
142
143 2
        return $this;
144
    }
145
146
    /**
147
     * @param int    $hint
148
     * @param mixed $value
149
     *
150
     * @return $this
151
     */
152 1
    public function addQueryHint($hint, $value = null)
153
    {
154 1
        $this->queryHints[$hint] = $value;
155
156 1
        return $this;
157
    }
158
159
    /**
160
     * @return array
161
     */
162 26
    public function getSelectClauses()
163
    {
164 26
        return $this->selectClauses;
165
    }
166
167
    /**
168
     * @return array
169
     */
170 26
    public function getWhereClauses()
171
    {
172 26
        return $this->whereClauses;
173
    }
174
175
    /**
176
     * @return array
177
     */
178 26
    public function getOrderByClauses()
179
    {
180 26
        return $this->orderByClauses;
181
    }
182
183
    /**
184
     * @return array
185
     */
186 4
    public function getSetClauses()
187
    {
188 4
        return $this->setClauses;
189
    }
190
191
    /**
192
     * @return array
193
     */
194 22
    public function getGroupByClauses()
195
    {
196 22
        return $this->groupByClauses;
197
    }
198
199
    /**
200
     * @return array
201
     */
202 22
    public function getHavingClauses()
203
    {
204 22
        return $this->havingClauses;
205
    }
206
207
    /**
208
     * @return string
209
     */
210 26
    public function getLimitClause()
211
    {
212 26
        return $this->limitClause;
213
    }
214
215
    /**
216
     * @return array
217
     */
218 4
    public function getQueryHints()
219
    {
220 4
        return $this->queryHints;
221
    }
222
}