1 | <?php |
||
21 | abstract class AbstractQuery |
||
22 | { |
||
23 | /** |
||
24 | * |
||
25 | * Data to be bound to the query. |
||
26 | * |
||
27 | * @var array |
||
28 | * |
||
29 | */ |
||
30 | protected $bind_values = array(); |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | * The list of WHERE conditions. |
||
35 | * |
||
36 | * @var array |
||
37 | * |
||
38 | */ |
||
39 | protected $where = array(); |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | * ORDER BY these columns. |
||
44 | * |
||
45 | * @var array |
||
46 | * |
||
47 | */ |
||
48 | protected $order_by = array(); |
||
49 | |||
50 | /** |
||
51 | * |
||
52 | * The list of flags. |
||
53 | * |
||
54 | * @var array |
||
55 | * |
||
56 | */ |
||
57 | protected $flags = array(); |
||
58 | |||
59 | /** |
||
60 | * |
||
61 | * A helper for quoting identifier names. |
||
62 | * |
||
63 | * @var Quoter |
||
64 | * |
||
65 | */ |
||
66 | protected $quoter; |
||
67 | |||
68 | /** |
||
69 | * |
||
70 | * Constructor. |
||
71 | * |
||
72 | * @param Quoter $quoter A helper for quoting identifier names. |
||
73 | * |
||
74 | */ |
||
75 | 407 | public function __construct(QuoterInterface $quoter, $builder) |
|
80 | |||
81 | /** |
||
82 | * |
||
83 | * Returns this query object as an SQL statement string. |
||
84 | * |
||
85 | * @return string |
||
86 | * |
||
87 | */ |
||
88 | 243 | public function __toString() |
|
92 | |||
93 | /** |
||
94 | * |
||
95 | * Returns this query object as an SQL statement string. |
||
96 | * |
||
97 | * @return string |
||
98 | * |
||
99 | */ |
||
100 | 69 | public function getStatement() |
|
104 | |||
105 | /** |
||
106 | * |
||
107 | * Builds this query object into a string. |
||
108 | * |
||
109 | * @return string |
||
110 | * |
||
111 | */ |
||
112 | abstract protected function build(); |
||
113 | |||
114 | /** |
||
115 | * |
||
116 | * Returns the prefix to use when quoting identifier names. |
||
117 | * |
||
118 | * @return string |
||
119 | * |
||
120 | */ |
||
121 | 257 | public function getQuoteNamePrefix() |
|
125 | |||
126 | /** |
||
127 | * |
||
128 | * Returns the suffix to use when quoting identifier names. |
||
129 | * |
||
130 | * @return string |
||
131 | * |
||
132 | */ |
||
133 | 257 | public function getQuoteNameSuffix() |
|
137 | |||
138 | /** |
||
139 | * |
||
140 | * Binds multiple values to placeholders; merges with existing values. |
||
141 | * |
||
142 | * @param array $bind_values Values to bind to placeholders. |
||
143 | * |
||
144 | * @return $this |
||
145 | * |
||
146 | */ |
||
147 | 31 | public function bindValues(array $bind_values) |
|
156 | |||
157 | /** |
||
158 | * |
||
159 | * Binds a single value to the query. |
||
160 | * |
||
161 | * @param string $name The placeholder name or number. |
||
162 | * |
||
163 | * @param mixed $value The value to bind to the placeholder. |
||
164 | * |
||
165 | * @return $this |
||
166 | * |
||
167 | */ |
||
168 | 136 | public function bindValue($name, $value) |
|
173 | |||
174 | /** |
||
175 | * |
||
176 | * Gets the values to bind to placeholders. |
||
177 | * |
||
178 | * @return array |
||
179 | * |
||
180 | */ |
||
181 | 126 | public function getBindValues() |
|
185 | |||
186 | /** |
||
187 | * |
||
188 | * Reset all values bound to named placeholders. |
||
189 | * |
||
190 | * @return $this |
||
191 | * |
||
192 | */ |
||
193 | 15 | public function resetBindValues() |
|
198 | |||
199 | /** |
||
200 | * |
||
201 | * Sets or unsets specified flag. |
||
202 | * |
||
203 | * @param string $flag Flag to set or unset |
||
204 | * |
||
205 | * @param bool $enable Flag status - enabled or not (default true) |
||
206 | * |
||
207 | * @return null |
||
208 | * |
||
209 | */ |
||
210 | 43 | protected function setFlag($flag, $enable = true) |
|
218 | |||
219 | /** |
||
220 | * |
||
221 | * Returns true if the specified flag was enabled by setFlag(). |
||
222 | * |
||
223 | * @param string $flag Flag to check |
||
224 | * |
||
225 | * @return bool |
||
226 | * |
||
227 | */ |
||
228 | 10 | protected function hasFlag($flag) |
|
232 | |||
233 | /** |
||
234 | * |
||
235 | * Reset all query flags. |
||
236 | * |
||
237 | * @return $this |
||
238 | * |
||
239 | */ |
||
240 | 20 | public function resetFlags() |
|
245 | |||
246 | /** |
||
247 | * |
||
248 | * Adds conditions and binds values to a clause. |
||
249 | * |
||
250 | * @param string $clause The clause to work with, typically 'where' or |
||
251 | * 'having'. |
||
252 | * |
||
253 | * @param string $andor Add the condition using this operator, typically |
||
254 | * 'AND' or 'OR'. |
||
255 | * |
||
256 | * @param string $cond The WHERE condition. |
||
257 | * |
||
258 | * @param array $bind arguments to bind to placeholders |
||
259 | * |
||
260 | * @return null |
||
261 | * |
||
262 | */ |
||
263 | 70 | protected function addClauseCondWithBind($clause, $andor, $cond, $bind) |
|
275 | |||
276 | /** |
||
277 | * |
||
278 | * Rebuilds a condition string, replacing sequential placeholders with |
||
279 | * named placeholders, and binding the sequential values to the named |
||
280 | * placeholders. |
||
281 | * |
||
282 | * @param string $cond The condition with sequential placeholders. |
||
283 | * |
||
284 | * @param array $bind_values The values to bind to the sequential |
||
285 | * placeholders under their named versions. |
||
286 | * |
||
287 | * @return string The rebuilt condition string. |
||
288 | * |
||
289 | */ |
||
290 | 120 | protected function rebuildCondAndBindValues($cond, array $bind_values) |
|
313 | |||
314 | /** |
||
315 | * |
||
316 | * Adds a column order to the query. |
||
317 | * |
||
318 | * @param array $spec The columns and direction to order by. |
||
319 | * |
||
320 | * @return $this |
||
321 | * |
||
322 | */ |
||
323 | 9 | protected function addOrderBy(array $spec) |
|
330 | } |
||
331 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..