@@ -16,7 +16,7 @@ |
||
16 | 16 | * @param $className |
17 | 17 | */ |
18 | 18 | spl_autoload_register( |
19 | - function ($className) { |
|
19 | + function($className) { |
|
20 | 20 | if (strpos($className, 'O2System\Database\\') === false) { |
21 | 21 | return; |
22 | 22 | } |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | // No connection resource? Check if there is a failover else throw an error |
229 | 229 | if ( ! $this->handle) { |
230 | 230 | // Check if there is a failover set |
231 | - if ( ! empty($this->config[ 'failover' ]) && is_array($this->config[ 'failover' ])) { |
|
231 | + if ( ! empty($this->config['failover']) && is_array($this->config['failover'])) { |
|
232 | 232 | // Go over all the failovers |
233 | - foreach ($this->config[ 'failover' ] as $failover) { |
|
233 | + foreach ($this->config['failover'] as $failover) { |
|
234 | 234 | |
235 | 235 | // Try to connect |
236 | 236 | $this->platformConnectHandler($failover = new Config($failover)); |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getPlatformInfo() |
303 | 303 | { |
304 | - if (isset($this->queriesResultCache[ 'platformInfo' ])) { |
|
305 | - return $this->queriesResultCache[ 'platformInfo' ]; |
|
304 | + if (isset($this->queriesResultCache['platformInfo'])) { |
|
305 | + return $this->queriesResultCache['platformInfo']; |
|
306 | 306 | } |
307 | 307 | |
308 | - return $this->queriesResultCache[ 'platformInfo' ] = $this->platformGetPlatformInfoHandler(); |
|
308 | + return $this->queriesResultCache['platformInfo'] = $this->platformGetPlatformInfoHandler(); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // ------------------------------------------------------------------------ |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | */ |
474 | 474 | final public function hasDatabase($databaseName) |
475 | 475 | { |
476 | - if (empty($this->queriesResultCache[ 'databaseNames' ])) { |
|
476 | + if (empty($this->queriesResultCache['databaseNames'])) { |
|
477 | 477 | $this->getDatabases(); |
478 | 478 | } |
479 | 479 | |
480 | - return (bool)in_array($databaseName, $this->queriesResultCache[ 'databaseNames' ]); |
|
480 | + return (bool)in_array($databaseName, $this->queriesResultCache['databaseNames']); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | //-------------------------------------------------------------------- |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | */ |
506 | 506 | public function hasCollection($collection) |
507 | 507 | { |
508 | - if (empty($this->queriesResultCache[ 'collectionNames' ])) { |
|
508 | + if (empty($this->queriesResultCache['collectionNames'])) { |
|
509 | 509 | $this->getCollections(); |
510 | 510 | } |
511 | 511 | |
512 | - return (bool)in_array($collection, $this->queriesResultCache[ 'collectionNames' ]); |
|
512 | + return (bool)in_array($collection, $this->queriesResultCache['collectionNames']); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | // ------------------------------------------------------------------------ |
@@ -537,11 +537,11 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function hasKey($key, $collection) |
539 | 539 | { |
540 | - if (empty($this->queriesResultCache[ 'collectionKeys' ][ $collection ])) { |
|
540 | + if (empty($this->queriesResultCache['collectionKeys'][$collection])) { |
|
541 | 541 | $this->getKeys($collection); |
542 | 542 | } |
543 | 543 | |
544 | - return (bool)in_array($key, $this->queriesResultCache[ 'collectionKeys' ][ $collection ]); |
|
544 | + return (bool)in_array($key, $this->queriesResultCache['collectionKeys'][$collection]); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // ------------------------------------------------------------------------ |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function hasIndex($index, $collection) |
574 | 574 | { |
575 | - if (empty($this->queriesResultCache[ 'collectionIndexes' ][ $collection ])) { |
|
575 | + if (empty($this->queriesResultCache['collectionIndexes'][$collection])) { |
|
576 | 576 | $this->getIndexes($collection); |
577 | 577 | } |
578 | 578 | |
579 | - return (bool)in_array($index, $this->queriesResultCache[ 'collectionIndexes' ][ $collection ]); |
|
579 | + return (bool)in_array($index, $this->queriesResultCache['collectionIndexes'][$collection]); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | // ------------------------------------------------------------------------ |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); |
102 | 102 | $result = current($cursor->toArray()); |
103 | 103 | |
104 | - $this->queriesResultCache[ 'databaseNames' ] = []; |
|
104 | + $this->queriesResultCache['databaseNames'] = []; |
|
105 | 105 | |
106 | - if ( ! empty($result[ 'databases' ])) { |
|
107 | - foreach ($result[ 'databases' ] as $database) { |
|
108 | - if ( ! in_array($database[ 'name' ], ['admin', 'local'])) { |
|
109 | - $this->queriesResultCache[ 'databaseNames' ][] = $database[ 'name' ]; |
|
106 | + if ( ! empty($result['databases'])) { |
|
107 | + foreach ($result['databases'] as $database) { |
|
108 | + if ( ! in_array($database['name'], ['admin', 'local'])) { |
|
109 | + $this->queriesResultCache['databaseNames'][] = $database['name']; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - return $this->queriesResultCache[ 'databaseNames' ]; |
|
114 | + return $this->queriesResultCache['databaseNames']; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // ------------------------------------------------------------------------ |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | |
132 | 132 | $result = new \IteratorIterator($cursor); |
133 | 133 | |
134 | - $this->queriesResultCache[ 'collectionNames' ] = []; |
|
134 | + $this->queriesResultCache['collectionNames'] = []; |
|
135 | 135 | |
136 | 136 | foreach ($result as $collection) { |
137 | - if ($collection[ 'type' ] === 'collection') { |
|
138 | - $this->queriesResultCache[ 'collectionNames' ][] = $collection[ 'name' ]; |
|
137 | + if ($collection['type'] === 'collection') { |
|
138 | + $this->queriesResultCache['collectionNames'][] = $collection['name']; |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - return $this->queriesResultCache[ 'collectionNames' ]; |
|
142 | + return $this->queriesResultCache['collectionNames']; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | // ------------------------------------------------------------------------ |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | |
160 | 160 | $result = current($cursor->toArray()); |
161 | 161 | |
162 | - $this->queriesResultCache[ 'collectionKeys' ][ $collection ] = []; |
|
162 | + $this->queriesResultCache['collectionKeys'][$collection] = []; |
|
163 | 163 | |
164 | 164 | foreach (get_object_vars($result) as $key => $value) { |
165 | - $this->queriesResultCache[ 'collectionKeys' ][ $collection ][] = $key; |
|
165 | + $this->queriesResultCache['collectionKeys'][$collection][] = $key; |
|
166 | 166 | } |
167 | 167 | |
168 | - return $this->queriesResultCache[ 'collectionKeys' ][ $collection ]; |
|
168 | + return $this->queriesResultCache['collectionKeys'][$collection]; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // ------------------------------------------------------------------------ |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | |
187 | 187 | $result = new \IteratorIterator($cursor); |
188 | 188 | |
189 | - $this->queriesResultCache[ 'collectionIndexes' ][ $collection ] = []; |
|
189 | + $this->queriesResultCache['collectionIndexes'][$collection] = []; |
|
190 | 190 | |
191 | 191 | foreach ($result as $index) { |
192 | - $this->queriesResultCache[ 'collectionIndexes' ][ $collection ][] = $index[ 'name' ]; |
|
192 | + $this->queriesResultCache['collectionIndexes'][$collection][] = $index['name']; |
|
193 | 193 | } |
194 | 194 | |
195 | - return $this->queriesResultCache[ 'collectionIndexes' ][ $collection ]; |
|
195 | + return $this->queriesResultCache['collectionIndexes'][$collection]; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // ------------------------------------------------------------------------ |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | protected function platformGetPlatformInfoHandler() |
236 | 236 | { |
237 | 237 | $metadata = $this->server->getInfo(); |
238 | - $metadata[ 'latency' ] = $this->server->getLatency(); |
|
239 | - $metadata[ 'type' ] = $this->server->getType(); |
|
240 | - $metadata[ 'tags' ] = $this->server->getTags(); |
|
238 | + $metadata['latency'] = $this->server->getLatency(); |
|
239 | + $metadata['type'] = $this->server->getType(); |
|
240 | + $metadata['tags'] = $this->server->getTags(); |
|
241 | 241 | |
242 | 242 | return new SplArrayObject([ |
243 | 243 | 'name' => $this->getPlatform(), |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | { |
299 | 299 | $this->parseQueryStatement($queryStatement); |
300 | 300 | |
301 | - if (isset($options[ 'method' ])) { |
|
301 | + if (isset($options['method'])) { |
|
302 | 302 | |
303 | - $method = $options[ 'method' ]; |
|
304 | - unset($options[ 'method' ]); |
|
303 | + $method = $options['method']; |
|
304 | + unset($options['method']); |
|
305 | 305 | |
306 | 306 | $options = array_merge(['safe' => true, 'ordered' => true], $options); |
307 | 307 | $bulk = new \MongoDb\Driver\BulkWrite($options); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $projection = []; |
386 | 386 | |
387 | 387 | foreach ($queryBuilderCache->select as $field) { |
388 | - $projection[ $field ] = 1; |
|
388 | + $projection[$field] = 1; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | $queryStatement->addOption('projection', $projection); |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | if (count($queryBuilderCache->whereIn)) { |
396 | 396 | foreach ($queryBuilderCache->whereIn as $field => $clause) { |
397 | 397 | if (count($queryBuilderCache->orWhereIn)) { |
398 | - $queryBuilderCache->orWhere[ $field ] = ['$in' => $clause]; |
|
398 | + $queryBuilderCache->orWhere[$field] = ['$in' => $clause]; |
|
399 | 399 | } else { |
400 | - $queryBuilderCache->where[ $field ] = ['$in' => $clause]; |
|
400 | + $queryBuilderCache->where[$field] = ['$in' => $clause]; |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | } |
@@ -405,44 +405,44 @@ discard block |
||
405 | 405 | // Filter Where Not In |
406 | 406 | if (count($queryBuilderCache->whereNotIn)) { |
407 | 407 | foreach ($queryBuilderCache->whereNotIn as $field => $clause) { |
408 | - $queryBuilderCache->where[ $field ] = ['$nin' => $clause]; |
|
408 | + $queryBuilderCache->where[$field] = ['$nin' => $clause]; |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
412 | 412 | // Filter Or Where In |
413 | 413 | if (count($queryBuilderCache->orWhereIn)) { |
414 | 414 | foreach ($queryBuilderCache->orWhereIn as $field => $clause) { |
415 | - $queryBuilderCache->orWhere[ $field ] = ['$in' => $clause]; |
|
415 | + $queryBuilderCache->orWhere[$field] = ['$in' => $clause]; |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Filter Or Where Not In |
420 | 420 | if (count($queryBuilderCache->orWhereNotIn)) { |
421 | 421 | foreach ($queryBuilderCache->orWhereNotIn as $field => $clause) { |
422 | - $queryBuilderCache->orWhere[ $field ] = ['$nin' => $clause]; |
|
422 | + $queryBuilderCache->orWhere[$field] = ['$nin' => $clause]; |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | 426 | // Filter Where Between |
427 | 427 | if (count($queryBuilderCache->between)) { |
428 | 428 | foreach ($queryBuilderCache->between as $field => $clause) { |
429 | - $queryBuilderCache->where[ $field ] = ['$gte' => $clause[ 'start' ], '$lte' => $clause[ 'end' ]]; |
|
429 | + $queryBuilderCache->where[$field] = ['$gte' => $clause['start'], '$lte' => $clause['end']]; |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
433 | 433 | // Filter Or Where Between |
434 | 434 | if (count($queryBuilderCache->orBetween)) { |
435 | 435 | foreach ($queryBuilderCache->orBetween as $field => $clause) { |
436 | - $queryBuilderCache->orWhere[ $field ] = ['$gte' => $clause[ 'start' ], '$lte' => $clause[ 'end' ]]; |
|
436 | + $queryBuilderCache->orWhere[$field] = ['$gte' => $clause['start'], '$lte' => $clause['end']]; |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | 440 | // Filter Where Not Between |
441 | 441 | if (count($queryBuilderCache->notBetween)) { |
442 | 442 | foreach ($queryBuilderCache->notBetween as $field => $clause) { |
443 | - $queryBuilderCache->where[ $field ][ '$not' ] = [ |
|
444 | - '$gte' => $clause[ 'start' ], |
|
445 | - '$lte' => $clause[ 'end' ], |
|
443 | + $queryBuilderCache->where[$field]['$not'] = [ |
|
444 | + '$gte' => $clause['start'], |
|
445 | + '$lte' => $clause['end'], |
|
446 | 446 | ]; |
447 | 447 | } |
448 | 448 | } |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | // Filter Or Where Not Between |
451 | 451 | if (count($queryBuilderCache->orNotBetween)) { |
452 | 452 | foreach ($queryBuilderCache->orNotBetween as $field => $clause) { |
453 | - $queryBuilderCache->orWhere[ $field ][ '$not' ] = [ |
|
454 | - '$gte' => $clause[ 'start' ], |
|
455 | - '$lte' => $clause[ 'end' ], |
|
453 | + $queryBuilderCache->orWhere[$field]['$not'] = [ |
|
454 | + '$gte' => $clause['start'], |
|
455 | + '$lte' => $clause['end'], |
|
456 | 456 | ]; |
457 | 457 | } |
458 | 458 | } |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $sort = []; |
493 | 493 | foreach ($queryBuilderCache->orderBy as $field => $direction) { |
494 | 494 | $direction = $direction === 'ASC' ? 1 : -1; |
495 | - $sort[ $field ] = $direction; |
|
495 | + $sort[$field] = $direction; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | $queryStatement->addOption('sort', $sort); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | if ($field === '_id') { |
122 | 122 | foreach ($values as $key => $value) { |
123 | - $values[ $key ] = new \MongoDb\BSON\ObjectID($value); |
|
123 | + $values[$key] = new \MongoDb\BSON\ObjectID($value); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $newQueryBuilderCache->store('from', $collection); |
188 | 188 | $newQueryBuilderCache->store('where', ['_id' => $document->_id]); |
189 | 189 | $document = $document->getArrayCopy(); |
190 | - unset($document[ '_id' ]); |
|
190 | + unset($document['_id']); |
|
191 | 191 | |
192 | 192 | $newQueryBuilderCache->store('sets', array_merge($document, $sets)); |
193 | 193 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $document = $this->get()->first(); |
226 | 226 | $documentIds[] = $document->_id; |
227 | 227 | $document = $document->getArrayCopy(); |
228 | - unset($document[ '_id' ]); |
|
228 | + unset($document['_id']); |
|
229 | 229 | |
230 | 230 | $documents[] = array_merge($document, $sets); |
231 | 231 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | if ( ! preg_match('/^([adObis]):/', $string, $matches)) { |
215 | 215 | return false; |
216 | 216 | } |
217 | - switch ($matches[ 1 ]) { |
|
217 | + switch ($matches[1]) { |
|
218 | 218 | case 'a' : |
219 | 219 | case 'O' : |
220 | 220 | case 's' : |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | |
250 | 250 | foreach ($fields as $fieldName => $fieldValue) { |
251 | 251 | if ($this->isJSON($fieldValue)) { |
252 | - $fields[ $fieldName ] = new Columns\DataJSON(json_decode($fieldValue, true)); |
|
252 | + $fields[$fieldName] = new Columns\DataJSON(json_decode($fieldValue, true)); |
|
253 | 253 | } elseif ($this->isSerialized($fieldValue)) { |
254 | - $fields[ $fieldName ] = new Columns\DataSerialize(unserialize($fieldValue)); |
|
254 | + $fields[$fieldName] = new Columns\DataSerialize(unserialize($fieldValue)); |
|
255 | 255 | } else { |
256 | - $fields[ $fieldName ] = $fieldValue; |
|
256 | + $fields[$fieldName] = $fieldValue; |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function offsetGet($offset) |
325 | 325 | { |
326 | - if (isset($this->columns[ $offset ])) { |
|
326 | + if (isset($this->columns[$offset])) { |
|
327 | 327 | |
328 | - $data = $this->columns[ $offset ]; |
|
328 | + $data = $this->columns[$offset]; |
|
329 | 329 | |
330 | 330 | if ($this->isJSON($data)) { |
331 | 331 | return new Columns\DataJSON(json_decode($data, true)); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function offsetSet($offset, $value) |
362 | 362 | { |
363 | - $this->columns[ $offset ] = $value; |
|
363 | + $this->columns[$offset] = $value; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // ------------------------------------------------------------------------ |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function offsetExists($offset) |
403 | 403 | { |
404 | - return isset($this->columns[ $offset ]); |
|
404 | + return isset($this->columns[$offset]); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | // ------------------------------------------------------------------------ |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function offsetUnset($field) |
424 | 424 | { |
425 | - unset($this->columns[ $field ]); |
|
425 | + unset($this->columns[$field]); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | // ------------------------------------------------------------------------ |
@@ -203,7 +203,7 @@ |
||
203 | 203 | */ |
204 | 204 | public function setError($errorCode, $errorMessage) |
205 | 205 | { |
206 | - $this->error[ $errorCode ] = $errorMessage; |
|
206 | + $this->error[$errorCode] = $errorMessage; |
|
207 | 207 | |
208 | 208 | return $this; |
209 | 209 | } |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function getDatabases() |
127 | 127 | { |
128 | - $this->queriesResultCache[ 'databaseNames' ][] = pathinfo($this->database, PATHINFO_FILENAME); |
|
128 | + $this->queriesResultCache['databaseNames'][] = pathinfo($this->database, PATHINFO_FILENAME); |
|
129 | 129 | |
130 | - return $this->queriesResultCache[ 'databaseNames' ]; |
|
130 | + return $this->queriesResultCache['databaseNames']; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // ------------------------------------------------------------------------ |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getTables($prefixLimit = false) |
146 | 146 | { |
147 | - if (empty($this->queriesResultCache[ 'tableNames' ])) { |
|
147 | + if (empty($this->queriesResultCache['tableNames'])) { |
|
148 | 148 | |
149 | 149 | $sqlStatement = 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\''; |
150 | 150 | |
151 | - if ($prefixLimit !== false && $this->config[ 'tablePrefix' ] !== '') { |
|
152 | - $sqlStatement .= ' AND "NAME" LIKE \'' . $this->escapeLikeString($this->config[ 'tablePrefix' ]) . "%' "; |
|
151 | + if ($prefixLimit !== false && $this->config['tablePrefix'] !== '') { |
|
152 | + $sqlStatement .= ' AND "NAME" LIKE \'' . $this->escapeLikeString($this->config['tablePrefix']) . "%' "; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $result = $this->query($sqlStatement); |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | foreach ($result as $row) { |
159 | 159 | // Do we know from which column to get the table name? |
160 | 160 | if ( ! isset($key)) { |
161 | - if (isset($row[ 'table_name' ])) { |
|
161 | + if (isset($row['table_name'])) { |
|
162 | 162 | $key = 'table_name'; |
163 | - } elseif (isset($row[ 'TABLE_NAME' ])) { |
|
163 | + } elseif (isset($row['TABLE_NAME'])) { |
|
164 | 164 | $key = 'TABLE_NAME'; |
165 | 165 | } else { |
166 | 166 | /* We have no other choice but to just get the first element's key. |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - $this->queriesResultCache[ 'tableNames' ][] = $row->offsetGet($key); |
|
176 | + $this->queriesResultCache['tableNames'][] = $row->offsetGet($key); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - return $this->queriesResultCache[ 'tableNames' ]; |
|
181 | + return $this->queriesResultCache['tableNames']; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // ------------------------------------------------------------------------ |
@@ -195,24 +195,24 @@ discard block |
||
195 | 195 | { |
196 | 196 | $table = $this->prefixTable($table); |
197 | 197 | |
198 | - if (empty($this->queriesResultCache[ 'tableColumns' ][ $table ])) { |
|
198 | + if (empty($this->queriesResultCache['tableColumns'][$table])) { |
|
199 | 199 | $result = $this->query('PRAGMA TABLE_INFO(' . $this->protectIdentifiers($table, true, null, false) . ')'); |
200 | 200 | |
201 | 201 | if ($result->count()) { |
202 | 202 | foreach ($result as $row) { |
203 | 203 | // Do we know from where to get the column's name? |
204 | 204 | if ( ! isset($key)) { |
205 | - if (isset($row[ 'name' ])) { |
|
205 | + if (isset($row['name'])) { |
|
206 | 206 | $key = 'name'; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | - $this->queriesResultCache[ 'tableColumns' ][ $table ][ $row->offsetGet($key) ] = $row; |
|
210 | + $this->queriesResultCache['tableColumns'][$table][$row->offsetGet($key)] = $row; |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - return $this->queriesResultCache[ 'tableColumns' ][ $table ]; |
|
215 | + return $this->queriesResultCache['tableColumns'][$table]; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | // ------------------------------------------------------------------------ |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | if (false !== ($result = $this->handle->query($queryStatement->getSqlFinalStatement()))) { |
333 | 333 | $i = 0; |
334 | 334 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { |
335 | - $rows[ $i ] = $row; |
|
335 | + $rows[$i] = $row; |
|
336 | 336 | $i++; |
337 | 337 | } |
338 | 338 | } else { |
@@ -139,11 +139,11 @@ |
||
139 | 139 | $columns = []; |
140 | 140 | |
141 | 141 | foreach ($values as $key => $value) { |
142 | - $ids[] = $value[ $index ]; |
|
142 | + $ids[] = $value[$index]; |
|
143 | 143 | |
144 | 144 | foreach (array_keys($value) as $field) { |
145 | 145 | if ($field !== $index) { |
146 | - $columns[ $field ][] = 'WHEN ' . $index . ' = ' . $value[ $index ] . ' THEN ' . $value[ $field ]; |
|
146 | + $columns[$field][] = 'WHEN ' . $index . ' = ' . $value[$index] . ' THEN ' . $value[$field]; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function addFilter($field, $value) |
184 | 184 | { |
185 | - $this->filter[ $field ] = $value; |
|
185 | + $this->filter[$field] = $value; |
|
186 | 186 | |
187 | 187 | return $this; |
188 | 188 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function addOption($option, $value) |
235 | 235 | { |
236 | - $this->options[ $option ] = $value; |
|
236 | + $this->options[$option] = $value; |
|
237 | 237 | |
238 | 238 | return $this; |
239 | 239 | } |