GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 7b036e...114130 )
by
unknown
02:35
created
src/NoSql/Datastructures/QueryStatement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/NoSql/Datastructures/QueryBuilderCache.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function &__get($property)
82 82
     {
83
-        return $this->vars[ $property ];
83
+        return $this->vars[$property];
84 84
     }
85 85
 
86 86
     // ------------------------------------------------------------------------
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
     public function store($index, $value)
97 97
     {
98 98
         if (array_key_exists($index, $this->vars)) {
99
-            if (is_array($this->vars[ $index ])) {
99
+            if (is_array($this->vars[$index])) {
100 100
                 if (is_array($value)) {
101
-                    $this->vars[ $index ] = array_merge($this->vars[ $index ], $value);
101
+                    $this->vars[$index] = array_merge($this->vars[$index], $value);
102 102
                 } else {
103
-                    array_push($this->vars[ $index ], $value);
103
+                    array_push($this->vars[$index], $value);
104 104
                 }
105
-            } elseif (is_bool($this->vars[ $index ])) {
106
-                $this->vars[ $index ] = (bool)$value;
105
+            } elseif (is_bool($this->vars[$index])) {
106
+                $this->vars[$index] = (bool)$value;
107 107
             } else {
108
-                $this->vars[ $index ] = $value;
108
+                $this->vars[$index] = $value;
109 109
             }
110 110
         }
111 111
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     protected function resetRun(array $cacheKeys)
214 214
     {
215 215
         foreach ($cacheKeys as $cacheKey => $cacheDefaultValue) {
216
-            $this->vars[ $cacheKey ] = $cacheDefaultValue;
216
+            $this->vars[$cacheKey] = $cacheDefaultValue;
217 217
         }
218 218
     }
219 219
 
Please login to merge, or discard this patch.
src/Connections.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function &loadConnection($connectionOffset)
50 50
     {
51
-        $loadConnection[ $connectionOffset ] = false;
51
+        $loadConnection[$connectionOffset] = false;
52 52
 
53 53
         if ( ! $this->exists($connectionOffset) and $this->config->offsetExists($connectionOffset)) {
54 54
 
55 55
             $connectionConfig = $this->config->offsetGet($connectionOffset);
56 56
 
57 57
             if (is_array($connectionConfig)) {
58
-                new DataStructures\Config($this->config[ $connectionOffset ]);
58
+                new DataStructures\Config($this->config[$connectionOffset]);
59 59
             }
60 60
 
61 61
             $this->createConnection($connectionOffset, $connectionConfig);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         ];
91 91
 
92 92
         if (array_key_exists($connectionConfig->driver, $driverMaps)) {
93
-            if (class_exists($driverClassName = $driverMaps[ $connectionConfig->driver ])) {
93
+            if (class_exists($driverClassName = $driverMaps[$connectionConfig->driver])) {
94 94
                 $driverInstance = new $driverClassName($connectionConfig);
95 95
                 $this->register($driverInstance, $connectionOffset);
96 96
             }
Please login to merge, or discard this patch.
src/DataObjects/Result/Info.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
             'pages'  => 0,
43 43
         ], $total));
44 44
 
45
-        if (isset($total[ 'limit' ])) {
46
-            $this->limit = $total[ 'limit' ];
45
+        if (isset($total['limit'])) {
46
+            $this->limit = $total['limit'];
47 47
         }
48 48
 
49 49
         $this->setLimit($this->limit);
Please login to merge, or discard this patch.
src/DataObjects/Result.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $this->rows = new \SplFixedArray($this->numRows);
86 86
 
87 87
         foreach ($rows as $key => $row) {
88
-            $this->rows[ $key ] = new Result\Row($row);
88
+            $this->rows[$key] = new Result\Row($row);
89 89
         }
90 90
     }
91 91
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $this->seek(0);
111 111
 
112 112
         if ($this->count()) {
113
-            return $this->rows[ $this->position ];
113
+            return $this->rows[$this->position];
114 114
         }
115 115
 
116 116
         return new Row();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             $position = $this->count();
141 141
         }
142 142
 
143
-        if (isset($this->rows[ $position ])) {
143
+        if (isset($this->rows[$position])) {
144 144
             $this->position = $position;
145 145
         }
146 146
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $this->seek($this->count() - 1);
179 179
 
180 180
         if ($this->count()) {
181
-            return $this->rows[ $this->position ];
181
+            return $this->rows[$this->position];
182 182
         }
183 183
 
184 184
         return new Row();
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $this->seek($this->position);
201 201
 
202 202
         if ($this->count()) {
203
-            return $this->rows[ $this->position ];
203
+            return $this->rows[$this->position];
204 204
         }
205 205
 
206 206
         return new Row();
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     public function valid()
271 271
     {
272 272
         if ($this->count()) {
273
-            return isset($this->rows[ $this->position ]);
273
+            return isset($this->rows[$this->position]);
274 274
         }
275 275
 
276 276
         return false;
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function offsetExists($offset)
343 343
     {
344
-        return (bool)isset($this->rows[ $offset ]);
344
+        return (bool)isset($this->rows[$offset]);
345 345
     }
346 346
 
347 347
     // ------------------------------------------------------------------------
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function offsetGet($offset)
364 364
     {
365
-        if (isset($this->rows[ $offset ])) {
366
-            return $this->rows[ $offset ];
365
+        if (isset($this->rows[$offset])) {
366
+            return $this->rows[$offset];
367 367
         }
368 368
 
369 369
         return false;
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     public function offsetSet($offset, $value)
392 392
     {
393 393
         if ($value instanceof Row) {
394
-            $this->rows[ $offset ] = $value;
394
+            $this->rows[$offset] = $value;
395 395
         }
396 396
     }
397 397
 
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
      */
414 414
     public function offsetUnset($offset)
415 415
     {
416
-        if (isset($this->rows[ $offset ])) {
417
-            unset($this->rows[ $offset ]);
416
+        if (isset($this->rows[$offset])) {
417
+            unset($this->rows[$offset]);
418 418
         }
419 419
     }
420 420
 
Please login to merge, or discard this patch.
src/Sql/Abstracts/AbstractConnection.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
         // No connection resource? Check if there is a failover else throw an error
266 266
         if ( ! $this->handle) {
267 267
             // Check if there is a failover set
268
-            if ( ! empty($this->config[ 'failover' ]) && is_array($this->config[ 'failover' ])) {
268
+            if ( ! empty($this->config['failover']) && is_array($this->config['failover'])) {
269 269
                 // Go over all the failovers
270
-                foreach ($this->config[ 'failover' ] as $failover) {
270
+                foreach ($this->config['failover'] as $failover) {
271 271
 
272 272
                     // Try to connect
273 273
                     $this->platformConnectHandler($failover = new Config($failover));
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function getPlatformInfo()
340 340
     {
341
-        if (isset($this->queriesResultCache[ 'platformInfo' ])) {
342
-            return $this->queriesResultCache[ 'platformInfo' ];
341
+        if (isset($this->queriesResultCache['platformInfo'])) {
342
+            return $this->queriesResultCache['platformInfo'];
343 343
         }
344 344
 
345
-        return $this->queriesResultCache[ 'platformInfo' ] = $this->platformGetPlatformInfoHandler();
345
+        return $this->queriesResultCache['platformInfo'] = $this->platformGetPlatformInfoHandler();
346 346
     }
347 347
 
348 348
     //--------------------------------------------------------------------
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
      */
529 529
     final public function hasDatabase($databaseName)
530 530
     {
531
-        if (empty($this->queriesResultCache[ 'databaseNames' ])) {
531
+        if (empty($this->queriesResultCache['databaseNames'])) {
532 532
             $this->getDatabases();
533 533
         }
534 534
 
535
-        return (bool)in_array($databaseName, $this->queriesResultCache[ 'databaseNames' ]);
535
+        return (bool)in_array($databaseName, $this->queriesResultCache['databaseNames']);
536 536
     }
537 537
 
538 538
     //--------------------------------------------------------------------
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
      */
559 559
     final public function setTablePrefix($tablePrefix)
560 560
     {
561
-        return $this->config[ 'tablePrefix' ] = $tablePrefix;
561
+        return $this->config['tablePrefix'] = $tablePrefix;
562 562
     }
563 563
 
564 564
     // ------------------------------------------------------------------------
@@ -577,11 +577,11 @@  discard block
 block discarded – undo
577 577
     {
578 578
         $table = $this->prefixTable($table);
579 579
 
580
-        if (empty($this->queriesResultCache[ 'tableNames' ])) {
580
+        if (empty($this->queriesResultCache['tableNames'])) {
581 581
             $this->getTables();
582 582
         }
583 583
 
584
-        return (bool)in_array($table, $this->queriesResultCache[ 'tableNames' ]);
584
+        return (bool)in_array($table, $this->queriesResultCache['tableNames']);
585 585
     }
586 586
 
587 587
     // ------------------------------------------------------------------------
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
      */
596 596
     final public function prefixTable($tableName)
597 597
     {
598
-        $tablePrefix = $this->config[ 'tablePrefix' ];
598
+        $tablePrefix = $this->config['tablePrefix'];
599 599
 
600 600
         if (empty($tablePrefix)) {
601 601
             return $tableName;
@@ -635,11 +635,11 @@  discard block
 block discarded – undo
635 635
     {
636 636
         $table = $this->prefixTable($table);
637 637
 
638
-        if (empty($this->queriesResultCache[ 'tableColumns' ][ $table ])) {
638
+        if (empty($this->queriesResultCache['tableColumns'][$table])) {
639 639
             $this->getColumns($table);
640 640
         }
641 641
 
642
-        return (bool)isset($this->queriesResultCache[ 'tableColumns' ][ $table ][ $column ]);
642
+        return (bool)isset($this->queriesResultCache['tableColumns'][$table][$column]);
643 643
     }
644 644
 
645 645
     // ------------------------------------------------------------------------
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
         $queryStatement->setLastInsertId($this->getLastInsertId());
685 685
 
686 686
         if ( ! array_key_exists($queryStatement->getKey(), $this->queriesCache)) {
687
-            $this->queriesCache[ $queryStatement->getKey() ] = $queryStatement;
687
+            $this->queriesCache[$queryStatement->getKey()] = $queryStatement;
688 688
         }
689 689
 
690 690
         if ($queryStatement->hasErrors()) {
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
         $queryStatement->addHit(1);
852 852
 
853 853
         if ( ! array_key_exists($queryStatement->getKey(), $this->queriesCache)) {
854
-            $this->queriesCache[ $queryStatement->getKey() ] = $queryStatement;
854
+            $this->queriesCache[$queryStatement->getKey()] = $queryStatement;
855 855
         }
856 856
 
857 857
         if ($queryStatement->hasErrors()) {
@@ -891,8 +891,8 @@  discard block
 block discarded – undo
891 891
     {
892 892
         $hasSqlBinders = strpos($sqlStatement, ':') !== false;
893 893
 
894
-        if (empty($binds) || empty($this->config[ 'bindMarker' ]) ||
895
-            (strpos($sqlStatement, $this->config[ 'bindMarker' ]) === false &&
894
+        if (empty($binds) || empty($this->config['bindMarker']) ||
895
+            (strpos($sqlStatement, $this->config['bindMarker']) === false &&
896 896
                 $hasSqlBinders === false)
897 897
         ) {
898 898
             return $sqlStatement;
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
         }
914 914
 
915 915
         // We'll need marker length later
916
-        $markerLength = strlen($this->config[ 'bindMarker' ]);
916
+        $markerLength = strlen($this->config['bindMarker']);
917 917
 
918 918
         if ($hasSqlBinders) {
919 919
             $sqlStatement = $this->replaceNamedBinds($sqlStatement, $sqlBinds);
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             } elseif (strpos($bindReplace, ' AND ') !== false) {
954 954
                 $escapedValue = $bindReplace;
955 955
             } else {
956
-                $escapedValue = preg_quote(trim($escapedValue, $this->config[ 'escapeCharacter' ]));
956
+                $escapedValue = preg_quote(trim($escapedValue, $this->config['escapeCharacter']));
957 957
             }
958 958
 
959 959
             if (preg_match("/\(.+?\)/", $bindSearch)) {
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
     {
1019 1019
         if (is_array($string)) {
1020 1020
             foreach ($string as $key => $value) {
1021
-                $string[ $key ] = $this->escapeString($value, $like);
1021
+                $string[$key] = $this->escapeString($value, $like);
1022 1022
             }
1023 1023
 
1024 1024
             return $string;
@@ -1029,11 +1029,11 @@  discard block
 block discarded – undo
1029 1029
         // escape LIKE condition wildcards
1030 1030
         if ($like === true) {
1031 1031
             $string = str_replace(
1032
-                [$this->config[ 'likeEscapeCharacter' ], '%', '_'],
1032
+                [$this->config['likeEscapeCharacter'], '%', '_'],
1033 1033
                 [
1034
-                    $this->config[ 'likeEscapeCharacter' ] . $this->config[ 'likeEscapeCharacter' ],
1035
-                    $this->config[ 'likeEscapeCharacter' ] . '%',
1036
-                    $this->config[ 'likeEscapeCharacter' ] . '_',
1034
+                    $this->config['likeEscapeCharacter'] . $this->config['likeEscapeCharacter'],
1035
+                    $this->config['likeEscapeCharacter'] . '%',
1036
+                    $this->config['likeEscapeCharacter'] . '_',
1037 1037
                 ],
1038 1038
                 $string
1039 1039
             );
@@ -1080,10 +1080,10 @@  discard block
 block discarded – undo
1080 1080
         // Make sure not to replace a chunk inside a string that happens to match the bind marker
1081 1081
         if ($chunk = preg_match_all("/'[^']*'/i", $sqlStatement, $matches)) {
1082 1082
             $chunk = preg_match_all(
1083
-                '/' . preg_quote($this->config[ 'bindMarker' ], '/') . '/i',
1083
+                '/' . preg_quote($this->config['bindMarker'], '/') . '/i',
1084 1084
                 str_replace(
1085
-                    $matches[ 0 ],
1086
-                    str_replace($this->config[ 'bindMarker' ], str_repeat(' ', $markerLength), $matches[ 0 ]),
1085
+                    $matches[0],
1086
+                    str_replace($this->config['bindMarker'], str_repeat(' ', $markerLength), $matches[0]),
1087 1087
                     $sqlStatement,
1088 1088
                     $chunk
1089 1089
                 ),
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
         } // Number of binds must match bindMarkers in the string.
1099 1099
         else {
1100 1100
             if (($chunk = preg_match_all(
1101
-                    '/' . preg_quote($this->config[ 'bindMarker' ], '/') . '/i',
1101
+                    '/' . preg_quote($this->config['bindMarker'], '/') . '/i',
1102 1102
                     $sqlStatement,
1103 1103
                     $matches,
1104 1104
                     PREG_OFFSET_CAPTURE
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
 
1111 1111
         do {
1112 1112
             $chunk--;
1113
-            $escapedValue = $this->escape($sqlBinds[ $chunk ]);
1113
+            $escapedValue = $this->escape($sqlBinds[$chunk]);
1114 1114
             if (is_array($escapedValue)) {
1115 1115
                 $escapedValue = '(' . implode(',', $escapedValue) . ')';
1116 1116
             }
1117
-            $sqlStatement = substr_replace($sqlStatement, $escapedValue, $matches[ 0 ][ $chunk ][ 1 ], $markerLength);
1117
+            $sqlStatement = substr_replace($sqlStatement, $escapedValue, $matches[0][$chunk][1], $markerLength);
1118 1118
         } while ($chunk !== 0);
1119 1119
 
1120 1120
         return $sqlStatement;
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
         if (is_array($item)) {
1299 1299
             $escapedArray = [];
1300 1300
             foreach ($item as $key => $value) {
1301
-                $escapedArray[ $this->protectIdentifiers($key) ] = $this->protectIdentifiers(
1301
+                $escapedArray[$this->protectIdentifiers($key)] = $this->protectIdentifiers(
1302 1302
                     $value,
1303 1303
                     $prefixSingle,
1304 1304
                     $protectIdentifiers,
@@ -1356,11 +1356,11 @@  discard block
 block discarded – undo
1356 1356
             //
1357 1357
             // NOTE: The ! empty() condition prevents this method
1358 1358
             //       from breaking when Query Builder isn't enabled.
1359
-            if ( ! empty($aliasedTables) AND in_array($parts[ 0 ], $aliasedTables)) {
1359
+            if ( ! empty($aliasedTables) AND in_array($parts[0], $aliasedTables)) {
1360 1360
                 if ($protectIdentifiers === true) {
1361 1361
                     foreach ($parts as $key => $val) {
1362
-                        if ( ! in_array($val, $this->config[ 'reservedIdentifiers' ])) {
1363
-                            $parts[ $key ] = $this->escapeIdentifiers($val);
1362
+                        if ( ! in_array($val, $this->config['reservedIdentifiers'])) {
1363
+                            $parts[$key] = $this->escapeIdentifiers($val);
1364 1364
                         }
1365 1365
                     }
1366 1366
 
@@ -1375,12 +1375,12 @@  discard block
 block discarded – undo
1375 1375
                 // We now add the table prefix based on some logic.
1376 1376
                 // Do we have 4 segments (hostname.database.table.column)?
1377 1377
                 // If so, we add the table prefix to the column name in the 3rd segment.
1378
-                if (isset($parts[ 3 ])) {
1378
+                if (isset($parts[3])) {
1379 1379
                     $i = 2;
1380 1380
                 }
1381 1381
                 // Do we have 3 segments (database.table.column)?
1382 1382
                 // If so, we add the table prefix to the column name in 2nd position
1383
-                elseif (isset($parts[ 2 ])) {
1383
+                elseif (isset($parts[2])) {
1384 1384
                     $i = 1;
1385 1385
                 }
1386 1386
                 // Do we have 2 segments (table.column)?
@@ -1396,15 +1396,15 @@  discard block
 block discarded – undo
1396 1396
                 }
1397 1397
 
1398 1398
                 // Verify table prefix and replace if necessary
1399
-                if ($this->swapTablePrefix !== '' && strpos($parts[ $i ], $this->swapTablePrefix) === 0) {
1400
-                    $parts[ $i ] = preg_replace(
1399
+                if ($this->swapTablePrefix !== '' && strpos($parts[$i], $this->swapTablePrefix) === 0) {
1400
+                    $parts[$i] = preg_replace(
1401 1401
                         '/^' . $this->swapTablePrefix . '(\S+?)/',
1402 1402
                         $this->config->tablePrefix . '\\1',
1403
-                        $parts[ $i ]
1403
+                        $parts[$i]
1404 1404
                     );
1405 1405
                 } // We only add the table prefix if it does not already exist
1406
-                elseif (strpos($parts[ $i ], $this->config->tablePrefix) !== 0) {
1407
-                    $parts[ $i ] = $this->config->tablePrefix . $parts[ $i ];
1406
+                elseif (strpos($parts[$i], $this->config->tablePrefix) !== 0) {
1407
+                    $parts[$i] = $this->config->tablePrefix . $parts[$i];
1408 1408
                 }
1409 1409
 
1410 1410
                 // Put the parts back together
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
         // In some cases, especially 'from', we end up running through
1422 1422
         // protect_identifiers twice. This algorithm won't work when
1423 1423
         // it contains the escapeChar so strip it out.
1424
-        $item = trim($item, $this->config[ 'escapeCharacter' ]);
1424
+        $item = trim($item, $this->config['escapeCharacter']);
1425 1425
 
1426 1426
         // Is there a table prefix? If not, no need to insert it
1427 1427
         if ($this->config->tablePrefix !== '') {
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
             }
1439 1439
         }
1440 1440
 
1441
-        if ($protectIdentifiers === true && ! in_array($item, $this->config[ 'reservedIdentifiers' ])) {
1441
+        if ($protectIdentifiers === true && ! in_array($item, $this->config['reservedIdentifiers'])) {
1442 1442
             $item = $this->escapeIdentifiers($item);
1443 1443
         }
1444 1444
 
@@ -1460,22 +1460,22 @@  discard block
 block discarded – undo
1460 1460
      */
1461 1461
     final public function escapeIdentifiers($item)
1462 1462
     {
1463
-        if ($this->config[ 'escapeCharacter' ] === '' OR empty($item) OR in_array(
1463
+        if ($this->config['escapeCharacter'] === '' OR empty($item) OR in_array(
1464 1464
                 $item,
1465
-                $this->config[ 'reservedIdentifiers' ]
1465
+                $this->config['reservedIdentifiers']
1466 1466
             )
1467 1467
         ) {
1468 1468
             return $item;
1469 1469
         } elseif (is_array($item)) {
1470 1470
             foreach ($item as $key => $value) {
1471
-                $item[ $key ] = $this->escapeIdentifiers($value);
1471
+                $item[$key] = $this->escapeIdentifiers($value);
1472 1472
             }
1473 1473
 
1474 1474
             return $item;
1475 1475
         } // Avoid breaking functions and literal values inside queries
1476 1476
         elseif (ctype_digit(
1477 1477
                 $item
1478
-            ) OR $item[ 0 ] === "'" OR ($this->config[ 'escapeCharacter' ] !== '"' && $item[ 0 ] === '"') OR
1478
+            ) OR $item[0] === "'" OR ($this->config['escapeCharacter'] !== '"' && $item[0] === '"') OR
1479 1479
             strpos($item, '(') !== false
1480 1480
         ) {
1481 1481
             return $item;
@@ -1484,31 +1484,31 @@  discard block
 block discarded – undo
1484 1484
         static $pregEscapeCharacters = [];
1485 1485
 
1486 1486
         if (empty($pregEscapeCharacters)) {
1487
-            if (is_array($this->config[ 'escapeCharacter' ])) {
1487
+            if (is_array($this->config['escapeCharacter'])) {
1488 1488
                 $pregEscapeCharacters = [
1489
-                    preg_quote($this->config[ 'escapeCharacter' ][ 0 ], '/'),
1490
-                    preg_quote($this->config[ 'escapeCharacter' ][ 1 ], '/'),
1491
-                    $this->config[ 'escapeCharacter' ][ 0 ],
1492
-                    $this->config[ 'escapeCharacter' ][ 1 ],
1489
+                    preg_quote($this->config['escapeCharacter'][0], '/'),
1490
+                    preg_quote($this->config['escapeCharacter'][1], '/'),
1491
+                    $this->config['escapeCharacter'][0],
1492
+                    $this->config['escapeCharacter'][1],
1493 1493
                 ];
1494 1494
             } else {
1495
-                $pregEscapeCharacters[ 0 ]
1496
-                    = $pregEscapeCharacters[ 1 ] = preg_quote($this->config[ 'escapeCharacter' ], '/');
1497
-                $pregEscapeCharacters[ 2 ] = $pregEscapeCharacters[ 3 ] = $this->config[ 'escapeCharacter' ];
1495
+                $pregEscapeCharacters[0]
1496
+                    = $pregEscapeCharacters[1] = preg_quote($this->config['escapeCharacter'], '/');
1497
+                $pregEscapeCharacters[2] = $pregEscapeCharacters[3] = $this->config['escapeCharacter'];
1498 1498
             }
1499 1499
         }
1500 1500
 
1501
-        foreach ($this->config[ 'reservedIdentifiers' ] as $id) {
1501
+        foreach ($this->config['reservedIdentifiers'] as $id) {
1502 1502
             if (strpos($item, '.' . $id) !== false) {
1503 1503
                 return preg_replace(
1504 1504
                     '/'
1505
-                    . $pregEscapeCharacters[ 0 ]
1505
+                    . $pregEscapeCharacters[0]
1506 1506
                     . '?([^'
1507
-                    . $pregEscapeCharacters[ 1 ]
1507
+                    . $pregEscapeCharacters[1]
1508 1508
                     . '\.]+)'
1509
-                    . $pregEscapeCharacters[ 1 ]
1509
+                    . $pregEscapeCharacters[1]
1510 1510
                     . '?\./i',
1511
-                    $pregEscapeCharacters[ 2 ] . '$1' . $pregEscapeCharacters[ 3 ] . '.',
1511
+                    $pregEscapeCharacters[2] . '$1' . $pregEscapeCharacters[3] . '.',
1512 1512
                     $item
1513 1513
                 );
1514 1514
             }
@@ -1516,13 +1516,13 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
         return preg_replace(
1518 1518
             '/'
1519
-            . $pregEscapeCharacters[ 0 ]
1519
+            . $pregEscapeCharacters[0]
1520 1520
             . '?([^'
1521
-            . $pregEscapeCharacters[ 1 ]
1521
+            . $pregEscapeCharacters[1]
1522 1522
             . '\.]+)'
1523
-            . $pregEscapeCharacters[ 1 ]
1523
+            . $pregEscapeCharacters[1]
1524 1524
             . '?(\.)?/i',
1525
-            $pregEscapeCharacters[ 2 ] . '$1' . $pregEscapeCharacters[ 3 ] . '$2',
1525
+            $pregEscapeCharacters[2] . '$1' . $pregEscapeCharacters[3] . '$2',
1526 1526
             $item
1527 1527
         );
1528 1528
     }
Please login to merge, or discard this patch.
src/Sql/Abstracts/AbstractQueryBuilder.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function __construct(AbstractConnection &$conn)
103 103
     {
104
-        $this->conn =& $conn;
104
+        $this->conn = & $conn;
105 105
         $this->builderCache = new QueryBuilderCache();
106 106
         $this->cacheMode = $this->conn->getConfig('cacheEnable');
107 107
     }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $alias = empty($alias)
283 283
             ? strtolower($type) . '_' . $field
284 284
             : $alias;
285
-        $sqlStatement = sprintf($SqlAggregateFunctions[ $type ], $field)
285
+        $sqlStatement = sprintf($SqlAggregateFunctions[$type], $field)
286 286
             . ' AS '
287 287
             . $this->conn->escapeIdentifiers($alias);
288 288
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 
338 338
                         for ($i = 0; $i < $countFieldAlias; $i++) {
339 339
                             if ($i == 0) {
340
-                                $fieldAlias[ $i ] = $fieldAlias[ $i ] . "'+";
340
+                                $fieldAlias[$i] = $fieldAlias[$i] . "'+";
341 341
                             } elseif ($i == ($countFieldAlias - 1)) {
342
-                                $fieldAlias[ $i ] = "'+" . $fieldAlias[ $i ];
342
+                                $fieldAlias[$i] = "'+" . $fieldAlias[$i];
343 343
                             } else {
344
-                                $fieldAlias[ $i ] = "'+" . $fieldAlias[ $i ] . "'+";
344
+                                $fieldAlias[$i] = "'+" . $fieldAlias[$i] . "'+";
345 345
                             }
346 346
                         }
347 347
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
         $this->select(
495 495
             sprintf(
496
-                $SqlScalarFunctions[ $type ],
496
+                $SqlScalarFunctions[$type],
497 497
                 $field,
498 498
                 $this->conn->escapeIdentifiers($alias)
499 499
             )
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 
699 699
             if (is_array($field)) {
700 700
                 $fieldName = key($field);
701
-                $fieldAlias = $field[ $fieldName ];
701
+                $fieldAlias = $field[$fieldName];
702 702
             } elseif (strpos($field, ' AS ') !== false) {
703 703
                 $xField = explode(' AS ', $field);
704 704
                 $xField = array_map('trim', $xField);
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
     public function dateDiff(array $fields, $alias)
906 906
     {
907 907
         $dateTimeStart = key($fields);
908
-        $dateTimeEnd = $fields[ $dateTimeStart ];
908
+        $dateTimeEnd = $fields[$dateTimeStart];
909 909
 
910 910
         if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dateTimeStart)) {
911 911
             $dateTimeStart = $this->conn->escape($dateTimeStart);
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
             // Split multiple conditions
1089 1089
             if (preg_match_all('/\sAND\s|\sOR\s/i', $condition, $joints, PREG_OFFSET_CAPTURE)) {
1090 1090
                 $conditions = [];
1091
-                $joints = $joints[ 0 ];
1091
+                $joints = $joints[0];
1092 1092
                 array_unshift($joints, ['', 0]);
1093 1093
 
1094 1094
                 for ($i = count($joints) - 1, $pos = strlen($condition); $i >= 0; $i--) {
1095
-                    $joints[ $i ][ 1 ] += strlen($joints[ $i ][ 0 ]); // offset
1096
-                    $conditions[ $i ] = substr($condition, $joints[ $i ][ 1 ], $pos - $joints[ $i ][ 1 ]);
1097
-                    $pos = $joints[ $i ][ 1 ] - strlen($joints[ $i ][ 0 ]);
1098
-                    $joints[ $i ] = $joints[ $i ][ 0 ];
1095
+                    $joints[$i][1] += strlen($joints[$i][0]); // offset
1096
+                    $conditions[$i] = substr($condition, $joints[$i][1], $pos - $joints[$i][1]);
1097
+                    $pos = $joints[$i][1] - strlen($joints[$i][0]);
1098
+                    $joints[$i] = $joints[$i][0];
1099 1099
                 }
1100 1100
             } else {
1101 1101
                 $conditions = [$condition];
@@ -1104,17 +1104,17 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
             $condition = ' ON ';
1106 1106
             for ($i = 0, $c = count($conditions); $i < $c; $i++) {
1107
-                $operator = $this->getOperator($conditions[ $i ]);
1108
-                $condition .= $joints[ $i ];
1107
+                $operator = $this->getOperator($conditions[$i]);
1108
+                $condition .= $joints[$i];
1109 1109
                 $condition .= preg_match(
1110 1110
                     "/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . "(.*)/i",
1111
-                    $conditions[ $i ],
1111
+                    $conditions[$i],
1112 1112
                     $match
1113 1113
                 )
1114
-                    ? $match[ 1 ] . $this->conn->protectIdentifiers(
1115
-                        $match[ 2 ]
1116
-                    ) . $operator . $this->conn->protectIdentifiers($match[ 3 ])
1117
-                    : $conditions[ $i ];
1114
+                    ? $match[1] . $this->conn->protectIdentifiers(
1115
+                        $match[2]
1116
+                    ) . $operator . $this->conn->protectIdentifiers($match[3])
1117
+                    : $conditions[$i];
1118 1118
             }
1119 1119
         }
1120 1120
 
@@ -1178,23 +1178,23 @@  discard block
 block discarded – undo
1178 1178
                 : '';
1179 1179
 
1180 1180
             $operator = [
1181
-                '\s*(?:<|>|!)?=\s*',             // =, <=, >=, !=
1182
-                '\s*<>?\s*',                     // <, <>
1183
-                '\s*>\s*',                       // >
1184
-                '\s+IS NULL',                    // IS NULL
1185
-                '\s+IS NOT NULL',                // IS NOT NULL
1186
-                '\s+EXISTS\s*\(.*\)',        // EXISTS(Sql)
1187
-                '\s+NOT EXISTS\s*\(.*\)',    // NOT EXISTS(Sql)
1188
-                '\s+BETWEEN\s+',                 // BETWEEN value AND value
1189
-                '\s+IN\s*\(.*\)',            // IN(list)
1190
-                '\s+NOT IN\s*\(.*\)',        // NOT IN (list)
1191
-                '\s+LIKE\s+\S.*(' . $likeEscapeString . ')?',    // LIKE 'expr'[ ESCAPE '%s']
1181
+                '\s*(?:<|>|!)?=\s*', // =, <=, >=, !=
1182
+                '\s*<>?\s*', // <, <>
1183
+                '\s*>\s*', // >
1184
+                '\s+IS NULL', // IS NULL
1185
+                '\s+IS NOT NULL', // IS NOT NULL
1186
+                '\s+EXISTS\s*\(.*\)', // EXISTS(Sql)
1187
+                '\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(Sql)
1188
+                '\s+BETWEEN\s+', // BETWEEN value AND value
1189
+                '\s+IN\s*\(.*\)', // IN(list)
1190
+                '\s+NOT IN\s*\(.*\)', // NOT IN (list)
1191
+                '\s+LIKE\s+\S.*(' . $likeEscapeString . ')?', // LIKE 'expr'[ ESCAPE '%s']
1192 1192
                 '\s+NOT LIKE\s+\S.*(' . $likeEscapeString . ')?' // NOT LIKE 'expr'[ ESCAPE '%s']
1193 1193
             ];
1194 1194
         }
1195 1195
 
1196 1196
         return preg_match('/' . implode('|', $operator) . '/i', $string, $match)
1197
-            ? $match[ 0 ]
1197
+            ? $match[0]
1198 1198
             : false;
1199 1199
     }
1200 1200
 
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
                 $fieldName = substr(
1265 1265
                         $fieldName,
1266 1266
                         0,
1267
-                        $match[ 0 ][ 1 ]
1268
-                    ) . ($match[ 1 ][ 0 ] === '='
1267
+                        $match[0][1]
1268
+                    ) . ($match[1][0] === '='
1269 1269
                         ? ' IS NULL'
1270 1270
                         : ' IS NOT NULL');
1271 1271
             } elseif ($fieldValue instanceof AbstractQueryBuilder) {
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
     public function bind($field, $value)
1322 1322
     {
1323 1323
         if ( ! array_key_exists($field, $this->builderCache->binds)) {
1324
-            $this->builderCache->binds[ $field ] = $value;
1324
+            $this->builderCache->binds[$field] = $value;
1325 1325
 
1326 1326
             return $field;
1327 1327
         }
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
             ++$count;
1333 1333
         }
1334 1334
 
1335
-        $this->builderCache->binds[ $field . '_' . $count ] = $value;
1335
+        $this->builderCache->binds[$field . '_' . $count] = $value;
1336 1336
 
1337 1337
         return $field . '_' . $count;
1338 1338
     }
@@ -1865,8 +1865,8 @@  discard block
 block discarded – undo
1865 1865
 
1866 1866
             // Do we have a seed value?
1867 1867
             $fields = ctype_digit((string)$fields)
1868
-                ? sprintf($this->SqlOrderByRandomKeywords[ 1 ], $fields)
1869
-                : $this->SqlOrderByRandomKeywords[ 0 ];
1868
+                ? sprintf($this->SqlOrderByRandomKeywords[1], $fields)
1869
+                : $this->SqlOrderByRandomKeywords[0];
1870 1870
         } elseif (empty($fields)) {
1871 1871
             return $this;
1872 1872
         } elseif ($direction !== '') {
@@ -1894,8 +1894,8 @@  discard block
 block discarded – undo
1894 1894
                         PREG_OFFSET_CAPTURE
1895 1895
                     ))
1896 1896
                     ? [
1897
-                        'field'     => ltrim(substr($fields, 0, $match[ 0 ][ 1 ])),
1898
-                        'direction' => ' ' . $match[ 1 ][ 0 ],
1897
+                        'field'     => ltrim(substr($fields, 0, $match[0][1])),
1898
+                        'direction' => ' ' . $match[1][0],
1899 1899
                         'escape'    => true,
1900 1900
                     ]
1901 1901
                     : ['field' => trim($fields), 'direction' => $direction, 'escape' => true];
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
         if (count($this->builderCache->sets)) {
2315 2315
             $sqlStatement = $this->platformInsertStatement(
2316 2316
                 $this->conn->protectIdentifiers(
2317
-                    $this->builderCache->from[ 0 ],
2317
+                    $this->builderCache->from[0],
2318 2318
                     true,
2319 2319
                     $escape,
2320 2320
                     false
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
         foreach ($field as $key => $value) {
2364 2364
             if ($key === 'birthday' || $key === 'date') {
2365 2365
                 if (is_array($value)) {
2366
-                    $value = $value[ 'year' ] . '-' . $value[ 'month' ] . '-' . $value[ 'date' ];
2366
+                    $value = $value['year'] . '-' . $value['month'] . '-' . $value['date'];
2367 2367
                 } elseif (is_object($value)) {
2368 2368
                     $value = $value->year . '-' . $value->month . '-' . $value->date;
2369 2369
                 }
@@ -2371,9 +2371,9 @@  discard block
 block discarded – undo
2371 2371
                 $value = call_user_func_array($this->arrayObjectConversionMethod, [$value]);
2372 2372
             }
2373 2373
 
2374
-            $this->builderCache->binds[ $key ] = $value;
2375
-            $this->builderCache->sets[ $this->conn->protectIdentifiers($key, false,
2376
-                $escape) ] = ':' . $key;
2374
+            $this->builderCache->binds[$key] = $value;
2375
+            $this->builderCache->sets[$this->conn->protectIdentifiers($key, false,
2376
+                $escape)] = ':' . $key;
2377 2377
         }
2378 2378
 
2379 2379
         return $this;
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
         foreach (get_object_vars($object) as $key => $value) {
2401 2401
             // There are some built in keys we need to ignore for this conversion
2402 2402
             if ( ! is_object($value) && ! is_array($value) && $key !== '_parent_name') {
2403
-                $array[ $key ] = $value;
2403
+                $array[$key] = $value;
2404 2404
             }
2405 2405
         }
2406 2406
 
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
         $affectedRows = 0;
2449 2449
         for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
2450 2450
             $Sql = $this->platformInsertBatchStatement(
2451
-                $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false),
2451
+                $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false),
2452 2452
                 $this->builderCache->keys,
2453 2453
                 array_slice($this->builderCache->sets, $i, $batchSize)
2454 2454
             );
@@ -2549,8 +2549,8 @@  discard block
 block discarded – undo
2549 2549
             // There are some built in keys we need to ignore for this conversion
2550 2550
             if ($field !== '_parent_name') {
2551 2551
                 $i = 0;
2552
-                foreach ($out[ $field ] as $data) {
2553
-                    $array[ $i++ ][ $field ] = $data;
2552
+                foreach ($out[$field] as $data) {
2553
+                    $array[$i++][$field] = $data;
2554 2554
                 }
2555 2555
             }
2556 2556
         }
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
         if (count($this->builderCache->sets)) {
2602 2602
             $sqlStatement = $this->platformReplaceStatement(
2603 2603
                 $this->conn->protectIdentifiers(
2604
-                    $this->builderCache->from[ 0 ],
2604
+                    $this->builderCache->from[0],
2605 2605
                     true,
2606 2606
                     $escape,
2607 2607
                     false
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
         $affectedRows = 0;
2665 2665
         for ($i = 0, $total = count($sets); $i < $total; $i += $batchSize) {
2666 2666
             $Sql = $this->platformReplaceStatement(
2667
-                $this->conn->protectIdentifiers($this->builderCache->from[ 0 ], true, $escape, false),
2667
+                $this->conn->protectIdentifiers($this->builderCache->from[0], true, $escape, false),
2668 2668
                 $this->builderCache->keys,
2669 2669
                 array_slice($this->builderCache->sets, $i, $batchSize)
2670 2670
             );
@@ -2716,7 +2716,7 @@  discard block
 block discarded – undo
2716 2716
         if (count($this->builderCache->sets) && count($this->builderCache->from)) {
2717 2717
             $sqlStatement = $this->platformUpdateStatement(
2718 2718
                 $this->conn->protectIdentifiers(
2719
-                    $this->builderCache->from[ 0 ],
2719
+                    $this->builderCache->from[0],
2720 2720
                     true,
2721 2721
                     $escape,
2722 2722
                     false
@@ -2777,7 +2777,7 @@  discard block
 block discarded – undo
2777 2777
         $affectedRows = 0;
2778 2778
         for ($i = 0, $total = count($this->builderCache->sets); $i < $total; $i += $batchSize) {
2779 2779
             $Sql = $this->platformUpdateBatchStatement(
2780
-                $this->builderCache->from[ 0 ],
2780
+                $this->builderCache->from[0],
2781 2781
                 array_slice($this->builderCache->sets, $i, $batchSize),
2782 2782
                 $this->conn->protectIdentifiers($index, false, $escape, false)
2783 2783
             );
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
                 $affectedRows += $this->conn->getAffectedRows();
2790 2790
             }
2791 2791
 
2792
-            $this->builderCache[ 'where' ] = [];
2792
+            $this->builderCache['where'] = [];
2793 2793
         }
2794 2794
 
2795 2795
         if ( ! $this->testMode) {
@@ -2833,7 +2833,7 @@  discard block
 block discarded – undo
2833 2833
 
2834 2834
                 $bind = $this->bind($key, $value);
2835 2835
 
2836
-                $cleanSets[ $this->conn->protectIdentifiers($key, false, $escape) ] = ':' . $bind;
2836
+                $cleanSets[$this->conn->protectIdentifiers($key, false, $escape)] = ':' . $bind;
2837 2837
             }
2838 2838
 
2839 2839
             if ($indexSet === false) {
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
 
2885 2885
         $sqlStatement = $this->platformDeleteStatement(
2886 2886
             $this->conn->protectIdentifiers(
2887
-                $this->builderCache->from[ 0 ],
2887
+                $this->builderCache->from[0],
2888 2888
                 true,
2889 2889
                 $this->conn->isProtectIdentifiers,
2890 2890
                 false
@@ -3063,10 +3063,10 @@  discard block
 block discarded – undo
3063 3063
                 // The reason we protect identifiers here rather than in the select() function
3064 3064
                 // is because until the user calls the from() function we don't know if there are aliases
3065 3065
                 foreach ($this->builderCache->select as $selectKey => $selectField) {
3066
-                    $noEscape = isset($this->builderCache->noEscape [ $selectKey ])
3067
-                        ? $this->builderCache->noEscape [ $selectKey ]
3066
+                    $noEscape = isset($this->builderCache->noEscape [$selectKey])
3067
+                        ? $this->builderCache->noEscape [$selectKey]
3068 3068
                         : null;
3069
-                    $this->builderCache->select [ $selectKey ] = $this->conn->protectIdentifiers(
3069
+                    $this->builderCache->select [$selectKey] = $this->conn->protectIdentifiers(
3070 3070
                         $selectField,
3071 3071
                         false,
3072 3072
                         $noEscape
@@ -3185,28 +3185,28 @@  discard block
 block discarded – undo
3185 3185
         if (count($this->builderCache->{$cacheKey}) > 0) {
3186 3186
             for ($i = 0, $c = count($this->builderCache->{$cacheKey}); $i < $c; $i++) {
3187 3187
                 // Is this condition already compiled?
3188
-                if (is_string($this->builderCache->{$cacheKey}[ $i ])) {
3188
+                if (is_string($this->builderCache->{$cacheKey}[$i])) {
3189 3189
                     continue;
3190
-                } elseif ($this->builderCache->{$cacheKey}[ $i ][ 'escape' ] === false) {
3191
-                    $this->builderCache->{$cacheKey}[ $i ]
3192
-                        = $this->builderCache->{$cacheKey}[ $i ][ 'condition' ];
3190
+                } elseif ($this->builderCache->{$cacheKey}[$i]['escape'] === false) {
3191
+                    $this->builderCache->{$cacheKey}[$i]
3192
+                        = $this->builderCache->{$cacheKey}[$i]['condition'];
3193 3193
                     continue;
3194 3194
                 }
3195 3195
 
3196 3196
                 // Split multiple conditions
3197 3197
                 $conditions = preg_split(
3198 3198
                     '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i',
3199
-                    $this->builderCache->{$cacheKey}[ $i ][ 'condition' ],
3199
+                    $this->builderCache->{$cacheKey}[$i]['condition'],
3200 3200
                     -1,
3201 3201
                     PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
3202 3202
                 );
3203 3203
 
3204 3204
                 for ($ci = 0, $cc = count($conditions); $ci < $cc; $ci++) {
3205
-                    if (($op = $this->getOperator($conditions[ $ci ])) === false
3205
+                    if (($op = $this->getOperator($conditions[$ci])) === false
3206 3206
                         OR
3207 3207
                         ! preg_match(
3208 3208
                             '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
3209
-                            $conditions[ $ci ],
3209
+                            $conditions[$ci],
3210 3210
                             $matches
3211 3211
                         )
3212 3212
                     ) {
@@ -3222,16 +3222,16 @@  discard block
 block discarded – undo
3222 3222
                     //  5 => ')'        /* optional */
3223 3223
                     // );
3224 3224
 
3225
-                    if ( ! empty($matches[ 4 ])) {
3225
+                    if ( ! empty($matches[4])) {
3226 3226
                         //$this->isLiteral($matches[4]) OR $matches[4] = $this->protectIdentifiers(trim($matches[4]));
3227
-                        $matches[ 4 ] = ' ' . $matches[ 4 ];
3227
+                        $matches[4] = ' ' . $matches[4];
3228 3228
                     }
3229 3229
 
3230
-                    $conditions[ $ci ] = $matches[ 1 ] . $this->conn->protectIdentifiers(trim($matches[ 2 ]))
3231
-                        . ' ' . trim($matches[ 3 ]) . $matches[ 4 ] . $matches[ 5 ];
3230
+                    $conditions[$ci] = $matches[1] . $this->conn->protectIdentifiers(trim($matches[2]))
3231
+                        . ' ' . trim($matches[3]) . $matches[4] . $matches[5];
3232 3232
                 }
3233 3233
 
3234
-                $this->builderCache->{$cacheKey}[ $i ] = implode('', $conditions);
3234
+                $this->builderCache->{$cacheKey}[$i] = implode('', $conditions);
3235 3235
             }
3236 3236
 
3237 3237
             if ($cacheKey === 'having') {
@@ -3270,17 +3270,17 @@  discard block
 block discarded – undo
3270 3270
         if (count($this->builderCache->groupBy) > 0) {
3271 3271
             for ($i = 0, $c = count($this->builderCache->groupBy); $i < $c; $i++) {
3272 3272
                 // Is it already compiled?
3273
-                if (is_string($this->builderCache->groupBy[ $i ])) {
3273
+                if (is_string($this->builderCache->groupBy[$i])) {
3274 3274
                     continue;
3275 3275
                 }
3276 3276
 
3277
-                $this->builderCache->groupBy[ $i ] = ($this->builderCache->groupBy[ $i ][ 'escape' ]
3277
+                $this->builderCache->groupBy[$i] = ($this->builderCache->groupBy[$i]['escape']
3278 3278
                     === false OR
3279 3279
                     $this->isLiteral(
3280
-                        $this->builderCache->groupBy[ $i ][ 'field' ]
3280
+                        $this->builderCache->groupBy[$i]['field']
3281 3281
                     ))
3282
-                    ? $this->builderCache->groupBy[ $i ][ 'field' ]
3283
-                    : $this->conn->protectIdentifiers($this->builderCache->groupBy[ $i ][ 'field' ]);
3282
+                    ? $this->builderCache->groupBy[$i]['field']
3283
+                    : $this->conn->protectIdentifiers($this->builderCache->groupBy[$i]['field']);
3284 3284
             }
3285 3285
 
3286 3286
             return "\n" . sprintf(
@@ -3325,7 +3325,7 @@  discard block
 block discarded – undo
3325 3325
                 : ["'"];
3326 3326
         }
3327 3327
 
3328
-        return in_array($string[ 0 ], $stringArray, true);
3328
+        return in_array($string[0], $stringArray, true);
3329 3329
     }
3330 3330
 
3331 3331
     //--------------------------------------------------------------------
@@ -3383,18 +3383,18 @@  discard block
 block discarded – undo
3383 3383
     {
3384 3384
         if (is_array($this->builderCache->orderBy) && count($this->builderCache->orderBy) > 0) {
3385 3385
             for ($i = 0, $c = count($this->builderCache->orderBy); $i < $c; $i++) {
3386
-                if ($this->builderCache->orderBy[ $i ][ 'escape' ] !== false
3386
+                if ($this->builderCache->orderBy[$i]['escape'] !== false
3387 3387
                     && ! $this->isLiteral(
3388
-                        $this->builderCache->orderBy[ $i ][ 'field' ]
3388
+                        $this->builderCache->orderBy[$i]['field']
3389 3389
                     )
3390 3390
                 ) {
3391
-                    $this->builderCache->orderBy[ $i ][ 'field' ] = $this->conn->protectIdentifiers(
3392
-                        $this->builderCache->orderBy[ $i ][ 'field' ]
3391
+                    $this->builderCache->orderBy[$i]['field'] = $this->conn->protectIdentifiers(
3392
+                        $this->builderCache->orderBy[$i]['field']
3393 3393
                     );
3394 3394
                 }
3395 3395
 
3396
-                $this->builderCache->orderBy[ $i ] = $this->builderCache->orderBy[ $i ][ 'field' ]
3397
-                    . $this->builderCache->orderBy[ $i ][ 'direction' ];
3396
+                $this->builderCache->orderBy[$i] = $this->builderCache->orderBy[$i]['field']
3397
+                    . $this->builderCache->orderBy[$i]['direction'];
3398 3398
             }
3399 3399
 
3400 3400
             return $this->builderCache->orderBy = "\n" . sprintf(
Please login to merge, or discard this patch.
src/Sql/Drivers/MySql/Connection.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getDatabases()
127 127
     {
128
-        if (empty($this->queriesResultCache[ 'databaseNames' ])) {
128
+        if (empty($this->queriesResultCache['databaseNames'])) {
129 129
             $result = $this->query('SHOW DATABASES');
130 130
 
131 131
             if ($result->count()) {
132 132
                 foreach ($result as $row) {
133 133
 
134 134
                     if ( ! isset($key)) {
135
-                        if (isset($row[ 'database' ])) {
135
+                        if (isset($row['database'])) {
136 136
                             $key = 'database';
137
-                        } elseif (isset($row[ 'Database' ])) {
137
+                        } elseif (isset($row['Database'])) {
138 138
                             $key = 'Database';
139
-                        } elseif (isset($row[ 'DATABASE' ])) {
139
+                        } elseif (isset($row['DATABASE'])) {
140 140
                             $key = 'DATABASE';
141 141
                         } else {
142 142
                             /* We have no other choice but to just get the first element's key.
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
                         }
150 150
                     }
151 151
 
152
-                    $this->queriesResultCache[ 'databaseNames' ][] = $row->offsetGet($key);
152
+                    $this->queriesResultCache['databaseNames'][] = $row->offsetGet($key);
153 153
                 }
154 154
             }
155 155
         }
156 156
 
157
-        return $this->queriesResultCache[ 'databaseNames' ];
157
+        return $this->queriesResultCache['databaseNames'];
158 158
     }
159 159
 
160 160
     // ------------------------------------------------------------------------
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function getTables($prefixLimit = false)
174 174
     {
175
-        if (empty($this->queriesResultCache[ 'tableNames' ])) {
175
+        if (empty($this->queriesResultCache['tableNames'])) {
176 176
 
177
-            $sqlStatement = 'SHOW TABLES FROM ' . $this->escapeIdentifiers($this->config[ 'database' ]);
177
+            $sqlStatement = 'SHOW TABLES FROM ' . $this->escapeIdentifiers($this->config['database']);
178 178
 
179
-            if ($prefixLimit !== false && $this->config[ 'tablePrefix' ] !== '') {
180
-                $sqlStatement .= " LIKE '" . $this->escapeLikeString($this->config[ 'tablePrefix' ]) . "%'";
179
+            if ($prefixLimit !== false && $this->config['tablePrefix'] !== '') {
180
+                $sqlStatement .= " LIKE '" . $this->escapeLikeString($this->config['tablePrefix']) . "%'";
181 181
             }
182 182
 
183 183
             $result = $this->query($sqlStatement);
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
                 foreach ($result as $row) {
187 187
                     // Do we know from which column to get the table name?
188 188
                     if ( ! isset($key)) {
189
-                        if (isset($row[ 'table_name' ])) {
189
+                        if (isset($row['table_name'])) {
190 190
                             $key = 'table_name';
191
-                        } elseif (isset($row[ 'TABLE_NAME' ])) {
191
+                        } elseif (isset($row['TABLE_NAME'])) {
192 192
                             $key = 'TABLE_NAME';
193 193
                         } else {
194 194
                             /* We have no other choice but to just get the first element's key.
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
                         }
202 202
                     }
203 203
 
204
-                    $this->queriesResultCache[ 'tableNames' ][] = $row->offsetGet($key);
204
+                    $this->queriesResultCache['tableNames'][] = $row->offsetGet($key);
205 205
                 }
206 206
             }
207 207
         }
208 208
 
209
-        return $this->queriesResultCache[ 'tableNames' ];
209
+        return $this->queriesResultCache['tableNames'];
210 210
     }
211 211
 
212 212
     // ------------------------------------------------------------------------
@@ -224,16 +224,16 @@  discard block
 block discarded – undo
224 224
     {
225 225
         $table = $this->prefixTable($table);
226 226
 
227
-        if (empty($this->queriesResultCache[ 'tableColumns' ][ $table ])) {
227
+        if (empty($this->queriesResultCache['tableColumns'][$table])) {
228 228
             $result = $this->query('SHOW COLUMNS FROM ' . $this->protectIdentifiers($table, true, null, false));
229 229
 
230 230
             if ($result->count()) {
231 231
                 foreach ($result as $row) {
232 232
                     // Do we know from where to get the column's name?
233 233
                     if ( ! isset($key)) {
234
-                        if (isset($row[ 'column_name' ])) {
234
+                        if (isset($row['column_name'])) {
235 235
                             $key = 'column_name';
236
-                        } elseif (isset($row[ 'COLUMN_NAME' ])) {
236
+                        } elseif (isset($row['COLUMN_NAME'])) {
237 237
                             $key = 'COLUMN_NAME';
238 238
                         } else {
239 239
                             /* We have no other choice but to just get the first element's key.
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
                         }
247 247
                     }
248 248
 
249
-                    $this->queriesResultCache[ 'tableColumns' ][ $table ][ $row->offsetGet($key) ] = $row;
249
+                    $this->queriesResultCache['tableColumns'][$table][$row->offsetGet($key)] = $row;
250 250
                 }
251 251
             }
252 252
         }
253 253
 
254
-        return $this->queriesResultCache[ 'tableColumns' ][ $table ];
254
+        return $this->queriesResultCache['tableColumns'][$table];
255 255
     }
256 256
 
257 257
     // ------------------------------------------------------------------------
@@ -330,13 +330,13 @@  discard block
 block discarded – undo
330 330
      */
331 331
     protected function platformGetPlatformInfoHandler()
332 332
     {
333
-        $server[ 'version' ][ 'string' ] = $this->handle->server_info;
334
-        $server[ 'version' ][ 'number' ] = $this->handle->server_version;
335
-        $server[ 'stats' ] = $this->handle->get_connection_stats();
333
+        $server['version']['string'] = $this->handle->server_info;
334
+        $server['version']['number'] = $this->handle->server_version;
335
+        $server['stats'] = $this->handle->get_connection_stats();
336 336
 
337
-        $client[ 'version' ][ 'string' ] = $this->handle->client_info;
338
-        $client[ 'version' ][ 'number' ] = $this->handle->client_version;
339
-        $client[ 'stats' ] = mysqli_get_client_stats();
337
+        $client['version']['string'] = $this->handle->client_info;
338
+        $client['version']['number'] = $this->handle->client_version;
339
+        $client['stats'] = mysqli_get_client_stats();
340 340
 
341 341
         return new SplArrayObject([
342 342
             'name'     => $this->getPlatform(),
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
     protected function platformConnectHandler(Config $config)
364 364
     {
365 365
         // Do we have a socket path?
366
-        if ($config->hostname[ 0 ] === '/') {
366
+        if ($config->hostname[0] === '/') {
367 367
             $hostname = null;
368 368
             $port = null;
369 369
             $socket = $config->hostname;
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
 
410 410
         if (is_array($config->encrypt)) {
411 411
             $ssl = [];
412
-            empty($config->encrypt[ 'ssl_key' ]) OR $ssl[ 'key' ] = $config->encrypt[ 'ssl_key' ];
413
-            empty($config->encrypt[ 'ssl_cert' ]) OR $ssl[ 'cert' ] = $config->encrypt[ 'ssl_cert' ];
414
-            empty($config->encrypt[ 'ssl_ca' ]) OR $ssl[ 'ca' ] = $config->encrypt[ 'ssl_ca' ];
415
-            empty($config->encrypt[ 'ssl_capath' ]) OR $ssl[ 'capath' ] = $config->encrypt[ 'ssl_capath' ];
416
-            empty($config->encrypt[ 'ssl_cipher' ]) OR $ssl[ 'cipher' ] = $config->encrypt[ 'ssl_cipher' ];
412
+            empty($config->encrypt['ssl_key']) OR $ssl['key'] = $config->encrypt['ssl_key'];
413
+            empty($config->encrypt['ssl_cert']) OR $ssl['cert'] = $config->encrypt['ssl_cert'];
414
+            empty($config->encrypt['ssl_ca']) OR $ssl['ca'] = $config->encrypt['ssl_ca'];
415
+            empty($config->encrypt['ssl_capath']) OR $ssl['capath'] = $config->encrypt['ssl_capath'];
416
+            empty($config->encrypt['ssl_cipher']) OR $ssl['cipher'] = $config->encrypt['ssl_cipher'];
417 417
 
418 418
             if ( ! empty($ssl)) {
419
-                if (isset($config->encrypt[ 'ssl_verify' ])) {
420
-                    if ($config->encrypt[ 'ssl_verify' ]) {
419
+                if (isset($config->encrypt['ssl_verify'])) {
420
+                    if ($config->encrypt['ssl_verify']) {
421 421
                         defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT')
422 422
                         && $this->handle->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
423 423
                     }
@@ -434,20 +434,20 @@  discard block
 block discarded – undo
434 434
 
435 435
                 $flags |= MYSQLI_CLIENT_SSL;
436 436
                 $this->handle->ssl_set(
437
-                    isset($ssl[ 'key' ])
438
-                        ? $ssl[ 'key' ]
437
+                    isset($ssl['key'])
438
+                        ? $ssl['key']
439 439
                         : null,
440
-                    isset($ssl[ 'cert' ])
441
-                        ? $ssl[ 'cert' ]
440
+                    isset($ssl['cert'])
441
+                        ? $ssl['cert']
442 442
                         : null,
443
-                    isset($ssl[ 'ca' ])
444
-                        ? $ssl[ 'ca' ]
443
+                    isset($ssl['ca'])
444
+                        ? $ssl['ca']
445 445
                         : null,
446
-                    isset($ssl[ 'capath' ])
447
-                        ? $ssl[ 'capath' ]
446
+                    isset($ssl['capath'])
447
+                        ? $ssl['capath']
448 448
                         : null,
449
-                    isset($ssl[ 'cipher' ])
450
-                        ? $ssl[ 'cipher' ]
449
+                    isset($ssl['cipher'])
450
+                        ? $ssl['cipher']
451 451
                         : null
452 452
                 );
453 453
             }
Please login to merge, or discard this patch.