Passed
Push — master ( b7b77b...565dd3 )
by Glynn
05:12 queued 03:02
created
src/AliasFacade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      */
26 26
     public static function __callStatic($method, $args)
27 27
     {
28
-        if (!static::$queryBuilderInstance) {
28
+        if ( ! static::$queryBuilderInstance) {
29 29
             static::$queryBuilderInstance = new QueryBuilderHandler();
30 30
         }
31 31
 
Please login to merge, or discard this patch.
src/Binding.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     protected function verifyType(?string $type): void
126 126
     {
127 127
         $validTypes = [self::STRING, self::BOOL, self::FLOAT, self::INT, self::JSON, self::RAW];
128
-        if (null !== $type && !in_array($type, $validTypes, true)) {
128
+        if (null !== $type && ! in_array($type, $validTypes, true)) {
129 129
             throw new Exception("{$type} is not a valid type to use for Bindings.", 1);
130 130
         }
131 131
     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function hasTypeDefined(): bool
139 139
     {
140
-        return !\in_array($this->type, [null, self::RAW], true);
140
+        return ! \in_array($this->type, [null, self::RAW], true);
141 141
     }
142 142
 
143 143
     /**
Please login to merge, or discard this patch.
src/Connection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         }
65 65
 
66 66
         // Preserve the first database connection with a static property
67
-        if (!static::$storedConnection) {
67
+        if ( ! static::$storedConnection) {
68 68
             static::$storedConnection = $this;
69 69
         }
70 70
     }
Please login to merge, or discard this patch.
src/QueryBuilder/QueryObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     public function __construct(string $sql, array $bindings, wpdb $dbInstance)
30 30
     {
31
-        $this->sql        = (string)$sql;
31
+        $this->sql        = (string) $sql;
32 32
         $this->bindings   = $bindings;
33 33
         $this->dbInstance = $dbInstance;
34 34
     }
Please login to merge, or discard this patch.
src/QueryBuilder/Raw.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __construct($value, $bindings = [])
22 22
     {
23
-        $this->value    = (string)$value;
24
-        $this->bindings = (array)$bindings;
23
+        $this->value    = (string) $value;
24
+        $this->bindings = (array) $bindings;
25 25
     }
26 26
 
27 27
     /**
@@ -49,6 +49,6 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __toString()
51 51
     {
52
-        return (string)$this->value;
52
+        return (string) $this->value;
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
src/EventHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             // Fire before events for :any table
87 87
             if ($action = $this->getEvent($event, $table)) {
88 88
                 // Make an event id, with event type and table
89
-                $eventId = $event . $table;
89
+                $eventId = $event.$table;
90 90
 
91 91
                 // Fire event
92 92
                 $handlerParams = func_get_args();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 // Add to fired list
95 95
                 $this->firedEvents[] = $eventId;
96 96
                 $result              = call_user_func_array($action, $handlerParams);
97
-                if (!is_null($result)) {
97
+                if ( ! is_null($result)) {
98 98
                     return $result;
99 99
                 }
100 100
             }
Please login to merge, or discard this patch.
src/Hydration/Hydrator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,6 +195,6 @@
 block discarded – undo
195 195
     {
196 196
         return $underscore
197 197
             ? "set_{$property}"
198
-            : 'set' . ucfirst($property);
198
+            : 'set'.ucfirst($property);
199 199
     }
200 200
 }
Please login to merge, or discard this patch.
src/QueryBuilder/WPDBAdapter.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function select(array $statements): array
51 51
     {
52
-        if (!array_key_exists('tables', $statements)) {
52
+        if ( ! array_key_exists('tables', $statements)) {
53 53
             throw new Exception('No table specified.', 3);
54
-        } elseif (!array_key_exists('selects', $statements)) {
54
+        } elseif ( ! array_key_exists('selects', $statements)) {
55 55
             $statements['selects'][] = '*';
56 56
         }
57 57
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         // Group bys
67 67
         $groupBys = '';
68 68
         if (isset($statements['groupBys']) && $groupBys = $this->arrayStr($statements['groupBys'], ', ')) {
69
-            $groupBys = 'GROUP BY ' . $groupBys;
69
+            $groupBys = 'GROUP BY '.$groupBys;
70 70
         }
71 71
 
72 72
         // Order bys
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
                 if ($field instanceof Closure) {
78 78
                     continue;
79 79
                 }
80
-                $orderBys .= $field . ' ' . $orderBy['type'] . ', ';
80
+                $orderBys .= $field.' '.$orderBy['type'].', ';
81 81
             }
82 82
 
83 83
             if ($orderBys = trim($orderBys, ', ')) {
84
-                $orderBys = 'ORDER BY ' . $orderBys;
84
+                $orderBys = 'ORDER BY '.$orderBys;
85 85
             }
86 86
         }
87 87
 
88 88
         // Limit and offset
89
-        $limit  = isset($statements['limit']) ? 'LIMIT ' . (int) $statements['limit'] : '';
90
-        $offset = isset($statements['offset']) ? 'OFFSET ' . (int) $statements['offset'] : '';
89
+        $limit  = isset($statements['limit']) ? 'LIMIT '.(int) $statements['limit'] : '';
90
+        $offset = isset($statements['offset']) ? 'OFFSET '.(int) $statements['offset'] : '';
91 91
 
92 92
         // Having
93 93
         list($havingCriteria, $havingBindings) = $this->buildCriteriaWithType($statements, 'havings', 'HAVING');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         /** @var string[] */
99 99
         $sqlArray = [
100
-            'SELECT' . (isset($statements['distinct']) ? ' DISTINCT' : ''),
100
+            'SELECT'.(isset($statements['distinct']) ? ' DISTINCT' : ''),
101 101
             $selects,
102 102
             'FROM',
103 103
             $tables,
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     public function criteriaOnly(array $statements, bool $bindValues = true): array
132 132
     {
133 133
         $sql = $bindings = [];
134
-        if (!isset($statements['criteria'])) {
134
+        if ( ! isset($statements['criteria'])) {
135 135
             return compact('sql', 'bindings');
136 136
         }
137 137
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      */
154 154
     private function doInsert(array $statements, array $data, string $type): array
155 155
     {
156
-        if (!isset($statements['tables'])) {
156
+        if ( ! isset($statements['tables'])) {
157 157
             throw new Exception('No table specified', 3);
158 158
         }
159 159
 
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
             if ($value instanceof Raw) {
175 175
                 $values[] = $this->parseRaw($value);
176 176
             } elseif ($isBindings) {
177
-                $values[]   =  $value->getType();
177
+                $values[]   = $value->getType();
178 178
                 $bindings[] = $value->getValue();
179 179
             } else {
180
-                $values[]   =  $this->inferType($value);
180
+                $values[]   = $this->inferType($value);
181 181
                 $bindings[] = $value;
182 182
             }
183 183
         }
184 184
 
185 185
         $sqlArray = [
186
-        $type . ' INTO',
186
+        $type.' INTO',
187 187
         $this->wrapSanitizer($table),
188
-        '(' . $this->arrayStr($keys, ',') . ')',
188
+        '('.$this->arrayStr($keys, ',').')',
189 189
         'VALUES',
190
-        '(' . $this->arrayStr($values, ',') . ')',
190
+        '('.$this->arrayStr($values, ',').')',
191 191
         ];
192 192
 
193 193
         if (isset($statements['onduplicate'])) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 throw new Exception('No data given.', 4);
196 196
             }
197 197
             list($updateStatement, $updateBindings) = $this->getUpdateStatement($statements['onduplicate']);
198
-            $sqlArray[]                             = 'ON DUPLICATE KEY UPDATE ' . $updateStatement;
198
+            $sqlArray[]                             = 'ON DUPLICATE KEY UPDATE '.$updateStatement;
199 199
             $bindings                               = array_merge($bindings, $updateBindings);
200 200
         }
201 201
 
@@ -303,12 +303,12 @@  discard block
 block discarded – undo
303 303
             }
304 304
 
305 305
             if ($value instanceof Raw) {
306
-                $statement .= $this->stringifyValue($this->wrapSanitizer($key)) . '=' . $value . ',';
306
+                $statement .= $this->stringifyValue($this->wrapSanitizer($key)).'='.$value.',';
307 307
             } elseif ($isBindings) {
308
-                $statement .= $this->stringifyValue($this->wrapSanitizer($key)) . sprintf('=%s,', $value->getType());
308
+                $statement .= $this->stringifyValue($this->wrapSanitizer($key)).sprintf('=%s,', $value->getType());
309 309
                 $bindings[] = $value->getValue();
310 310
             } else {
311
-                $statement .= $this->stringifyValue($this->wrapSanitizer($key)) . sprintf('=%s,', $this->inferType($value));
311
+                $statement .= $this->stringifyValue($this->wrapSanitizer($key)).sprintf('=%s,', $this->inferType($value));
312 312
                 $bindings[] = $value;
313 313
             }
314 314
         }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      */
331 331
     public function update($statements, array $data)
332 332
     {
333
-        if (!isset($statements['tables'])) {
333
+        if ( ! isset($statements['tables'])) {
334 334
             throw new Exception('No table specified', 3);
335 335
         } elseif (count($data) < 1) {
336 336
             throw new Exception('No data given.', 4);
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
         list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE');
346 346
 
347 347
         // Limit
348
-        $limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : '';
348
+        $limit = isset($statements['limit']) ? 'LIMIT '.$statements['limit'] : '';
349 349
 
350 350
         $sqlArray = [
351 351
             'UPDATE',
352 352
             $this->wrapSanitizer($table),
353
-            'SET ' . $updateStatement,
353
+            'SET '.$updateStatement,
354 354
             $whereCriteria,
355 355
             $limit,
356 356
         ];
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      */
374 374
     public function delete($statements)
375 375
     {
376
-        if (!isset($statements['tables'])) {
376
+        if ( ! isset($statements['tables'])) {
377 377
             throw new Exception('No table specified', 3);
378 378
         }
379 379
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         list($whereCriteria, $whereBindings) = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE');
389 389
 
390 390
         // Limit
391
-        $limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : '';
391
+        $limit = isset($statements['limit']) ? 'LIMIT '.$statements['limit'] : '';
392 392
 
393 393
         $sqlArray = ['DELETE FROM', $table, $whereCriteria];
394 394
         $sql      = $this->concatenateQuery($sqlArray);
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
     {
411 411
         $str = '';
412 412
         foreach ($pieces as $key => $piece) {
413
-            if (!is_int($key)) {
414
-                $piece = $key . ' AS ' . $piece;
413
+            if ( ! is_int($key)) {
414
+                $piece = $key.' AS '.$piece;
415 415
             }
416 416
 
417
-            $str .= $piece . $glue;
417
+            $str .= $piece.$glue;
418 418
         }
419 419
 
420 420
         return trim($str, $glue);
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     {
432 432
         $str = '';
433 433
         foreach ($pieces as $piece) {
434
-            $str = trim($str) . ' ' . trim($piece);
434
+            $str = trim($str).' '.trim($piece);
435 435
         }
436 436
 
437 437
         return trim($str);
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
     public function getType($value): string
447 447
     {
448 448
         return $value instanceof Binding && $value->getType() !== null
449
-            ? $value->getType() : $this->inferType($value) ;
449
+            ? $value->getType() : $this->inferType($value);
450 450
     }
451 451
 
452 452
     /**
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 
490 490
 
491 491
         $bindings = array_map([$this, 'getValue'], $bindings);
492
-        $query = $this->connection->getDbInstance()->prepare($query, $bindings) ;
492
+        $query = $this->connection->getDbInstance()->prepare($query, $bindings);
493 493
         return is_string($query) ? $query : '';
494 494
     }
495 495
 
@@ -530,10 +530,10 @@  discard block
 block discarded – undo
530 530
                 // Merge the bindings we get from nestedCriteria object
531 531
                 $bindings = array_merge($bindings, $queryObject->getBindings());
532 532
                 // Append the sql we get from the nestedCriteria object
533
-                $criteria .= $statement['joiner'] . ' (' . $queryObject->getSql() . ') ';
533
+                $criteria .= $statement['joiner'].' ('.$queryObject->getSql().') ';
534 534
             } elseif (is_array($value)) {
535 535
                 // where_in or between like query
536
-                $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'];
536
+                $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'];
537 537
 
538 538
                 switch ($statement['operator']) {
539 539
                     case 'BETWEEN':
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
                         $value[1] = $this->getValue($value[1]);
550 550
 
551 551
                         // Parse any raws.
552
-                        $value = array_map(function ($value) {
552
+                        $value = array_map(function($value) {
553 553
                             return $value instanceof Raw
554 554
                                 ? $this->parseRaw($value)
555 555
                                 : $value;
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                         }
574 574
 
575 575
                         $valuePlaceholder = trim($valuePlaceholder, ', ');
576
-                        $criteria .= ' (' . $valuePlaceholder . ') ';
576
+                        $criteria .= ' ('.$valuePlaceholder.') ';
577 577
                         break;
578 578
                 }
579 579
             } elseif ($value instanceof Raw) {
@@ -581,20 +581,20 @@  discard block
 block discarded – undo
581 581
                 $criteria .= "{$statement['joiner']} {$key} {$statement['operator']} $value ";
582 582
             } else {
583 583
                 // Usual where like criteria
584
-                if (!$bindValues) {
584
+                if ( ! $bindValues) {
585 585
                     // Specially for joins
586 586
                     // We are not binding values, lets sanitize then
587 587
                     $value = $this->stringifyValue($this->wrapSanitizer($value)) ?? '';
588
-                    $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'] . ' ' . $value . ' ';
588
+                    $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'].' '.$value.' ';
589 589
                 } elseif ($statement['key'] instanceof Raw) {
590
-                    $criteria .= $statement['joiner'] . ' ' . $key . ' ';
590
+                    $criteria .= $statement['joiner'].' '.$key.' ';
591 591
                     $bindings = array_merge($bindings, $statement['key']->getBindings());
592 592
                 } else {
593 593
                     // For wheres
594 594
                     $bindings[] = $this->getValue($value);
595 595
 
596
-                    $criteria .= $statement['joiner'] . ' ' . $key . ' ' . $statement['operator'] . ' '
597
-                    . $this->getType($value) . ' ';
596
+                    $criteria .= $statement['joiner'].' '.$key.' '.$statement['operator'].' '
597
+                    . $this->getType($value).' ';
598 598
                 }
599 599
             }
600 600
         }
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 
650 650
         foreach ($valueArr as $key => $subValue) {
651 651
             // Don't wrap if we have *, which is not a usual field
652
-            $valueArr[$key] = '*' == trim($subValue) ? $subValue : $this->sanitizer . $subValue . $this->sanitizer;
652
+            $valueArr[$key] = '*' == trim($subValue) ? $subValue : $this->sanitizer.$subValue.$this->sanitizer;
653 653
         }
654 654
 
655 655
         // Join these back with "." and return
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
             list($criteria, $bindings) = $this->buildCriteria($statements[$key], $bindValues);
677 677
 
678 678
             if ($criteria) {
679
-                $criteria = $type . ' ' . $criteria;
679
+                $criteria = $type.' '.$criteria;
680 680
             }
681 681
         }
682 682
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
     {
698 698
         $sql = '';
699 699
 
700
-        if (!array_key_exists('joins', $statements) || !is_array($statements['joins'])) {
700
+        if ( ! array_key_exists('joins', $statements) || ! is_array($statements['joins'])) {
701 701
             return $sql;
702 702
         }
703 703
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
             if (is_array($joinArr['table'])) {
706 706
                 $mainTable  = $this->stringifyValue($this->wrapSanitizer($joinArr['table'][0]));
707 707
                 $aliasTable = $this->stringifyValue($this->wrapSanitizer($joinArr['table'][1]));
708
-                $table      = $mainTable . ' AS ' . $aliasTable;
708
+                $table      = $mainTable.' AS '.$aliasTable;
709 709
             } else {
710 710
                 $table = $joinArr['table'] instanceof Raw
711 711
                     ? $this->parseRaw($joinArr['table'])
Please login to merge, or discard this patch.
src/QueryBuilder/TablePrefixer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
         // If supplied value is not an array then make it one
29 29
         $single = false;
30
-        if (!is_array($values)) {
30
+        if ( ! is_array($values)) {
31 31
             $values = [$values];
32 32
             // We had single value, so should return a single value
33 33
             $single = true;
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
             // If key is not integer, it is likely a alias mapping,
46 46
             // so we need to change prefix target
47 47
             $target = &$value;
48
-            if (!is_int($key)) {
48
+            if ( ! is_int($key)) {
49 49
                 $target = &$key;
50 50
             }
51 51
 
52 52
             // Do prefix if the target is an expression or function.
53 53
             if (
54
-                !$tableFieldMix
54
+                ! $tableFieldMix
55 55
                 || (
56 56
                     is_string($target) // Must be a string
57 57
                     && (bool) preg_match('/^[A-Za-z0-9_.]+$/', $target) // Can only contain letters, numbers, underscore and full stops
58 58
                     && 1 === \substr_count($target, '.') // Contains a single full stop ONLY.
59 59
                 )
60 60
             ) {
61
-                $target = $this->getTablePrefix() . $target;
61
+                $target = $this->getTablePrefix().$target;
62 62
             }
63 63
 
64 64
             $return[$key] = $value;
Please login to merge, or discard this patch.