Completed
Push — master ( dbb48c...a781c6 )
by Lars
14:05
created
src/voku/db/ActiveRecordExpressions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,6 +21,6 @@
 block discarded – undo
21 21
    */
22 22
   public function __toString()
23 23
   {
24
-    return $this->source . ' ' . $this->operator . ' ' . $this->target;
24
+    return $this->source.' '.$this->operator.' '.$this->target;
25 25
   }
26 26
 }
Please login to merge, or discard this patch.
src/voku/db/Result.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
   /**
437 437
    * Fetch all results as "\Generator" via yield.
438 438
    *
439
-   * @param object|string $class  <p>
439
+   * @param boolean $class  <p>
440 440
    *                              <strong>string</strong>: create a new object (with optional constructor
441 441
    *                              parameter)<br>
442 442
    *                              <strong>object</strong>: use a object and fill the the data into
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
   /**
865 865
    * Fetch as "\Generator" via yield.
866 866
    *
867
-   * @param object|string $class  <p>
867
+   * @param boolean $class  <p>
868 868
    *                              <strong>string</strong>: create a new object (with optional constructor
869 869
    *                              parameter)<br>
870 870
    *                              <strong>object</strong>: use a object and fill the the data into
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
   {
688 688
     if ($as_array) {
689 689
       return \array_map(
690
-          function ($object) {
690
+          function($object) {
691 691
             return (array)$object;
692 692
           },
693 693
           \mysqli_fetch_fields($this->_result)
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     }
856 856
 
857 857
     return \array_map(
858
-        function ($values) use ($keys) {
858
+        function($values) use ($keys) {
859 859
           return \array_combine($keys, $values);
860 860
         }, $rows
861 861
     );
Please login to merge, or discard this patch.
src/voku/db/ActiveRecord.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -659,7 +659,7 @@
 block discarded – undo
659 659
    * @param array     $param          <p>
660 660
    *                                  The param will be bind to the $sql query.
661 661
    *                                  </p>
662
-   * @param null|self $obj            <p>
662
+   * @param null|\self $obj            <p>
663 663
    *                                  The object, if find record in database, we will assign the attributes into
664 664
    *                                  this object.
665 665
    *                                  </p>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     $value = $this->_filterParam($this->dirty);
584 584
     $this->insert = new ActiveRecordExpressions(
585 585
         [
586
-            'operator' => 'INSERT INTO ' . $this->table,
586
+            'operator' => 'INSERT INTO '.$this->table,
587 587
             'target'   => new ActiveRecordExpressionsWrap(['target' => \array_keys($this->dirty)]),
588 588
         ]
589 589
     );
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
         null === $active_record->{$sql_string_part}
795 795
     ) {
796 796
 
797
-      $sql_string_part = \strtoupper($sql_string_part) . ' ' . $active_record->table . '.*';
797
+      $sql_string_part = \strtoupper($sql_string_part).' '.$active_record->table.'.*';
798 798
 
799 799
     } elseif (
800 800
         (
@@ -806,15 +806,15 @@  discard block
 block discarded – undo
806 806
         null === $active_record->{$sql_string_part}
807 807
     ) {
808 808
 
809
-      $sql_string_part = \strtoupper($sql_string_part) . ' ' . $active_record->table;
809
+      $sql_string_part = \strtoupper($sql_string_part).' '.$active_record->table;
810 810
 
811 811
     } elseif ('delete' === $sql_string_part) {
812 812
 
813
-      $sql_string_part = \strtoupper($sql_string_part) . ' ';
813
+      $sql_string_part = \strtoupper($sql_string_part).' ';
814 814
 
815 815
     } else {
816 816
 
817
-      $sql_string_part = (null !== $active_record->{$sql_string_part}) ? $active_record->{$sql_string_part} . ' ' : '';
817
+      $sql_string_part = (null !== $active_record->{$sql_string_part}) ? $active_record->{$sql_string_part}.' ' : '';
818 818
 
819 819
     }
820 820
   }
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
   {
929 929
     if (\is_array($value)) {
930 930
       foreach ($value as $key => $val) {
931
-        $this->params[$value[$key] = self::PREFIX . ++self::$count] = $val;
931
+        $this->params[$value[$key] = self::PREFIX.++self::$count] = $val;
932 932
       }
933 933
     } elseif (\is_string($value)) {
934
-      $this->params[$ph = self::PREFIX . ++self::$count] = $value;
934
+      $this->params[$ph = self::PREFIX.++self::$count] = $value;
935 935
       $value = $ph;
936 936
     }
937 937
 
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
     $value = $this->_filterParam($value);
953 953
     $expression = new ActiveRecordExpressions(
954 954
         [
955
-            'source'   => ('where' === strtolower($name) ? $this->table . '.' : '') . $field,
955
+            'source'   => ('where' === strtolower($name) ? $this->table.'.' : '').$field,
956 956
             'operator' => $operator,
957 957
             'target'   => \is_array($value)
958 958
                 ? new ActiveRecordExpressionsWrap(
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
     $this->join = new ActiveRecordExpressions(
987 987
         [
988 988
             'source'   => $this->join ?: '',
989
-            'operator' => $type . ' JOIN',
989
+            'operator' => $type.' JOIN',
990 990
             'target'   => new ActiveRecordExpressions(
991 991
                 ['source' => $table, 'operator' => 'ON', 'target' => $on]
992 992
             ),
Please login to merge, or discard this patch.
src/voku/db/DB.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
         }
461 461
 
462 462
         if ($_connector === 'NOT IN' || $_connector === 'IN') {
463
-          $_value = '(' . \implode(',', $_value) . ')';
463
+          $_value = '('.\implode(',', $_value).')';
464 464
         } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
465
-          $_value = '(' . \implode(' AND ', $_value) . ')';
465
+          $_value = '('.\implode(' AND ', $_value).')';
466 466
         }
467 467
 
468 468
       } else {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
           $valueInner = "''";
510 510
         }
511 511
 
512
-        $sql .= ' ' . $_glueHelperInner . ' ' . $quoteString . ' ' . $_connector . ' ' . $valueInner . " \n";
512
+        $sql .= ' '.$_glueHelperInner.' '.$quoteString.' '.$_connector.' '.$valueInner." \n";
513 513
         $tmpCounter++;
514 514
       }
515 515
 
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
       );
711 711
 
712 712
     } catch (\Exception $e) {
713
-      $error = 'Error connecting to mysql server: ' . $e->getMessage();
713
+      $error = 'Error connecting to mysql server: '.$e->getMessage();
714 714
       $this->_debug->displayError($error, true);
715 715
       throw new DBConnectException($error, 100, $e);
716 716
     }
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 
719 719
     $errno = \mysqli_connect_errno();
720 720
     if (!$this->connected || $errno) {
721
-      $error = 'Error connecting to mysql server: ' . \mysqli_connect_error() . ' (' . $errno . ')';
721
+      $error = 'Error connecting to mysql server: '.\mysqli_connect_error().' ('.$errno.')';
722 722
       $this->_debug->displayError($error, true);
723 723
       throw new DBConnectException($error, 101);
724 724
     }
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
     }
760 760
 
761 761
     if ($databaseName) {
762
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
762
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
763 763
     }
764 764
 
765
-    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE)";
765
+    $sql = 'DELETE FROM '.$databaseName.$this->quote_string($table)." WHERE ($WHERE)";
766 766
 
767 767
     return $this->query($sql);
768 768
   }
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 
831 831
       // add ":" if needed
832 832
       if (\strpos($name, ':') !== 0) {
833
-        $nameTmp = ':' . $name;
833
+        $nameTmp = ':'.$name;
834 834
       } else {
835 835
         $nameTmp = $name;
836 836
       }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
     if ($useCache === true) {
1012 1012
       $cache = new Cache(null, null, false, $useCache);
1013
-      $cacheKey = 'sql-' . \md5($query);
1013
+      $cacheKey = 'sql-'.\md5($query);
1014 1014
 
1015 1015
       if (
1016 1016
           $cache->getCacheIsReady() === true
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
     static $firstInstance = null;
1134 1134
 
1135 1135
     if (
1136
-        $hostname . $username . $password . $database . $port . $charset == '3306utf8'
1136
+        $hostname.$username.$password.$database.$port.$charset == '3306utf8'
1137 1137
         &&
1138 1138
         null !== $firstInstance
1139 1139
     ) {
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
     $extra_config_string = '';
1148 1148
     if (\is_array($extra_config) === true) {
1149 1149
       foreach ($extra_config as $extra_config_key => $extra_config_value) {
1150
-        $extra_config_string .= $extra_config_key . (string)$extra_config_value;
1150
+        $extra_config_string .= $extra_config_key.(string)$extra_config_value;
1151 1151
       }
1152 1152
     } else {
1153 1153
       // only for backward compatibility
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
     }
1156 1156
 
1157 1157
     $connection = \md5(
1158
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . $extra_config_string
1158
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.$extra_config_string
1159 1159
     );
1160 1160
 
1161 1161
     if (!isset($instance[$connection])) {
@@ -1246,10 +1246,10 @@  discard block
 block discarded – undo
1246 1246
     $SET = $this->_parseArrayPair($data);
1247 1247
 
1248 1248
     if ($databaseName) {
1249
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1249
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
1250 1250
     }
1251 1251
 
1252
-    $sql = 'INSERT INTO ' . $databaseName . $this->quote_string($table) . " SET $SET";
1252
+    $sql = 'INSERT INTO '.$databaseName.$this->quote_string($table)." SET $SET";
1253 1253
 
1254 1254
     return $this->query($sql);
1255 1255
   }
@@ -1560,11 +1560,11 @@  discard block
 block discarded – undo
1560 1560
 
1561 1561
       // exit if we have more then 3 "DB server has gone away"-errors
1562 1562
       if ($RECONNECT_COUNTER > 3) {
1563
-        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql, 5);
1563
+        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql, 5);
1564 1564
         throw new DBGoneAwayException($errorMessage);
1565 1565
       }
1566 1566
 
1567
-      $this->_debug->mailToAdmin('DB-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
1567
+      $this->_debug->mailToAdmin('DB-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
1568 1568
 
1569 1569
       // reconnect
1570 1570
       $RECONNECT_COUNTER++;
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
       return false;
1579 1579
     }
1580 1580
 
1581
-    $this->_debug->mailToAdmin('SQL-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
1581
+    $this->_debug->mailToAdmin('SQL-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
1582 1582
 
1583 1583
     $force_exception_after_error = null; // auto
1584 1584
     if ($this->_in_transaction === true) {
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
     }
1587 1587
     // this query returned an error, we must display it (only for dev) !!!
1588 1588
 
1589
-    $this->_debug->displayError($errorMessage . '(' . $errorNumber . ') ' . ' | ' . $sql, $force_exception_after_error);
1589
+    $this->_debug->displayError($errorMessage.'('.$errorNumber.') '.' | '.$sql, $force_exception_after_error);
1590 1590
 
1591 1591
     return false;
1592 1592
   }
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
         )
1610 1610
     );
1611 1611
 
1612
-    return '`' . $str . '`';
1612
+    return '`'.$str.'`';
1613 1613
   }
1614 1614
 
1615 1615
   /**
@@ -1680,10 +1680,10 @@  discard block
 block discarded – undo
1680 1680
     $values = \implode(',', $data);
1681 1681
 
1682 1682
     if ($databaseName) {
1683
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1683
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
1684 1684
     }
1685 1685
 
1686
-    $sql = 'REPLACE INTO ' . $databaseName . $this->quote_string($table) . " ($columns) VALUES ($values)";
1686
+    $sql = 'REPLACE INTO '.$databaseName.$this->quote_string($table)." ($columns) VALUES ($values)";
1687 1687
 
1688 1688
     return $this->query($sql);
1689 1689
   }
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
     $var = $this->escape($var, false, false, null);
1780 1780
 
1781 1781
     if (\is_string($var)) {
1782
-      $var = "'" . \trim($var, "'") . "'";
1782
+      $var = "'".\trim($var, "'")."'";
1783 1783
     }
1784 1784
 
1785 1785
     return $var;
@@ -1816,10 +1816,10 @@  discard block
 block discarded – undo
1816 1816
     }
1817 1817
 
1818 1818
     if ($databaseName) {
1819
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1819
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
1820 1820
     }
1821 1821
 
1822
-    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE)";
1822
+    $sql = 'SELECT * FROM '.$databaseName.$this->quote_string($table)." WHERE ($WHERE)";
1823 1823
 
1824 1824
     return $this->query($sql);
1825 1825
   }
@@ -1861,9 +1861,9 @@  discard block
 block discarded – undo
1861 1861
 
1862 1862
     $return = mysqli_set_charset($this->link, $charset);
1863 1863
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
1864
-    @\mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
1864
+    @\mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
1865 1865
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
1866
-    @\mysqli_query($this->link, "SET NAMES '" . $charset . "'");
1866
+    @\mysqli_query($this->link, "SET NAMES '".$charset."'");
1867 1867
 
1868 1868
     return $return;
1869 1869
   }
@@ -1997,7 +1997,7 @@  discard block
 block discarded – undo
1997 1997
       $result = $callback($this);
1998 1998
       if ($result === false) {
1999 1999
         /** @noinspection ThrowRawExceptionInspection */
2000
-        throw new \Exception('call_user_func [' . $callback . '] === false');
2000
+        throw new \Exception('call_user_func ['.$callback.'] === false');
2001 2001
       }
2002 2002
 
2003 2003
       return $this->commit();
@@ -2050,10 +2050,10 @@  discard block
 block discarded – undo
2050 2050
     }
2051 2051
 
2052 2052
     if ($databaseName) {
2053
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2053
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
2054 2054
     }
2055 2055
 
2056
-    $sql = 'UPDATE ' . $databaseName . $this->quote_string($table) . " SET $SET WHERE ($WHERE)";
2056
+    $sql = 'UPDATE '.$databaseName.$this->quote_string($table)." SET $SET WHERE ($WHERE)";
2057 2057
 
2058 2058
     return $this->query($sql);
2059 2059
   }
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
    */
2068 2068
   public function table_exists(string $table): bool
2069 2069
   {
2070
-    $check = $this->query('SELECT 1 FROM ' . $this->quote_string($table));
2070
+    $check = $this->query('SELECT 1 FROM '.$this->quote_string($table));
2071 2071
 
2072 2072
     return $check !== false
2073 2073
            &&
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -983,7 +983,7 @@
 block discarded – undo
983 983
    * @param string  $query    <p>sql-query</p>
984 984
    * @param bool    $useCache optional <p>use cache?</p>
985 985
    * @param int     $cacheTTL optional <p>cache-ttl in seconds</p>
986
-   * @param DB|null $db       optional <p>the database connection</p>
986
+   * @param null|\self $db       optional <p>the database connection</p>
987 987
    *
988 988
    * @return mixed "array" by "<b>SELECT</b>"-queries<br />
989 989
    *               "int" (insert_id) by "<b>INSERT</b>"-queries<br />
Please login to merge, or discard this patch.
src/voku/db/Debug.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
     $this->logger(
140 140
         [
141 141
             'error',
142
-            '<strong>' . \date(
142
+            '<strong>'.\date(
143 143
                 'd. m. Y G:i:s'
144
-            ) . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . ') (sql-error):</strong> ' . $error . '<br>',
144
+            ).' ('.$fileInfo['file'].' line: '.$fileInfo['line'].') (sql-error):</strong> '.$error.'<br>',
145 145
         ]
146 146
     );
147 147
 
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
         $box_bg = $this->css_mysql_box_bg;
154 154
 
155 155
         echo '
156
-        <div class="OBJ-mysql-box" style="border:' . $box_border . '; background:' . $box_bg . '; padding:10px; margin:10px;">
156
+        <div class="OBJ-mysql-box" style="border:' . $box_border.'; background:'.$box_bg.'; padding:10px; margin:10px;">
157 157
           <b style="font-size:14px;">MYSQL Error:</b>
158 158
           <code style="display:block;">
159
-            file / line: ' . $fileInfo['file'] . ' / ' . $fileInfo['line'] . '
160
-            ' . $error . '
159
+            file / line: ' . $fileInfo['file'].' / '.$fileInfo['line'].'
160
+            ' . $error.'
161 161
           </code>
162 162
         </div>
163 163
         ';
@@ -295,21 +295,21 @@  discard block
 block discarded – undo
295 295
     // get extra info
296 296
     $infoExtra = \mysqli_info($this->_db->getLink());
297 297
     if ($infoExtra) {
298
-      $infoExtra = ' | info => ' . $infoExtra;
298
+      $infoExtra = ' | info => '.$infoExtra;
299 299
     }
300 300
 
301 301
     //
302 302
     // logging
303 303
     //
304 304
 
305
-    $info = 'time => ' . \round($duration, 5) . ' | results => ' . (int)$results . $infoExtra . ' | SQL => ' . UTF8::htmlentities($sql);
305
+    $info = 'time => '.\round($duration, 5).' | results => '.(int)$results.$infoExtra.' | SQL => '.UTF8::htmlentities($sql);
306 306
 
307 307
     $fileInfo = $this->getFileAndLineFromSql();
308 308
 
309 309
     return $this->logger(
310 310
         [
311 311
             $logLevel,
312
-            '<strong>' . \date('d. m. Y G:i:s') . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . '):</strong> ' . $info . '<br>',
312
+            '<strong>'.\date('d. m. Y G:i:s').' ('.$fileInfo['file'].' line: '.$fileInfo['line'].'):</strong> '.$info.'<br>',
313 313
             'sql',
314 314
         ]
315 315
     );
@@ -375,21 +375,21 @@  discard block
 block discarded – undo
375 375
         $this->logger(
376 376
             [
377 377
                 'debug',
378
-                $subject . ' | ' . $htmlBody,
378
+                $subject.' | '.$htmlBody,
379 379
             ]
380 380
         );
381 381
       } elseif ($priority > 3) {
382 382
         $this->logger(
383 383
             [
384 384
                 'error',
385
-                $subject . ' | ' . $htmlBody,
385
+                $subject.' | '.$htmlBody,
386 386
             ]
387 387
         );
388 388
       } elseif ($priority < 3) {
389 389
         $this->logger(
390 390
             [
391 391
                 'info',
392
-                $subject . ' | ' . $htmlBody,
392
+                $subject.' | '.$htmlBody,
393 393
             ]
394 394
         );
395 395
       }
Please login to merge, or discard this patch.
src/voku/db/Helper.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     $optimized = 0;
32 32
     if (!empty($tables)) {
33 33
       foreach ($tables as $table) {
34
-        $optimize = 'OPTIMIZE TABLE ' . $dbConnection->quote_string($table);
34
+        $optimize = 'OPTIMIZE TABLE '.$dbConnection->quote_string($table);
35 35
         $result = $dbConnection->query($optimize);
36 36
         if ($result) {
37 37
           $optimized++;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     $optimized = 0;
60 60
     if (!empty($tables)) {
61 61
       foreach ($tables as $table) {
62
-        $optimize = 'REPAIR TABLE ' . $dbConnection->quote_string($table);
62
+        $optimize = 'REPAIR TABLE '.$dbConnection->quote_string($table);
63 63
         $result = $dbConnection->query($optimize);
64 64
         if ($result) {
65 65
           $optimized++;
@@ -176,23 +176,23 @@  discard block
 block discarded – undo
176 176
 
177 177
     $whereSQL = $dbConnection->_parseArrayPair($whereArray, 'AND');
178 178
     if ($whereSQL) {
179
-      $whereSQL = 'AND ' . $whereSQL;
179
+      $whereSQL = 'AND '.$whereSQL;
180 180
     }
181 181
 
182 182
     if ($databaseName) {
183
-      $databaseName = $dbConnection->quote_string(trim($databaseName)) . '.';
183
+      $databaseName = $dbConnection->quote_string(trim($databaseName)).'.';
184 184
     }
185 185
 
186 186
     // get the row
187
-    $query = 'SELECT ' . $dbConnection->quote_string($searchFieldName) . ', ' . $dbConnection->quote_string($idFieldName) . ' 
188
-      FROM ' . $databaseName . $dbConnection->quote_string($table) . '
187
+    $query = 'SELECT '.$dbConnection->quote_string($searchFieldName).', '.$dbConnection->quote_string($idFieldName).' 
188
+      FROM ' . $databaseName.$dbConnection->quote_string($table).'
189 189
       WHERE 1 = 1
190
-      ' . $whereSQL . '
190
+      ' . $whereSQL.'
191 191
     ';
192 192
 
193 193
     if ($useCache === true) {
194 194
       $cache = new Cache(null, null, false, $useCache);
195
-      $cacheKey = 'sql-phonetic-search-' . \md5($query);
195
+      $cacheKey = 'sql-phonetic-search-'.\md5($query);
196 196
 
197 197
       if (
198 198
           $cache->getCacheIsReady() === true
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
     }
323 323
 
324 324
     if ($databaseName) {
325
-      $databaseName = $dbConnection->quote_string(trim($databaseName)) . '.';
325
+      $databaseName = $dbConnection->quote_string(trim($databaseName)).'.';
326 326
     }
327 327
 
328
-    $sql = 'SHOW COLUMNS FROM ' . $databaseName . $dbConnection->escape($table);
328
+    $sql = 'SHOW COLUMNS FROM '.$databaseName.$dbConnection->escape($table);
329 329
     $result = $dbConnection->query($sql);
330 330
 
331 331
     if ($result && $result->num_rows > 0) {
@@ -371,17 +371,17 @@  discard block
 block discarded – undo
371 371
 
372 372
     $whereSQL = $dbConnection->_parseArrayPair($whereArray, 'AND');
373 373
     if ($whereSQL) {
374
-      $whereSQL = 'AND ' . $whereSQL;
374
+      $whereSQL = 'AND '.$whereSQL;
375 375
     }
376 376
 
377 377
     if ($databaseName) {
378
-      $databaseName = $dbConnection->quote_string(trim($databaseName)) . '.';
378
+      $databaseName = $dbConnection->quote_string(trim($databaseName)).'.';
379 379
     }
380 380
 
381 381
     // get the row
382
-    $query = 'SELECT * FROM ' . $databaseName . $dbConnection->quote_string($table) . '
382
+    $query = 'SELECT * FROM '.$databaseName.$dbConnection->quote_string($table).'
383 383
       WHERE 1 = 1
384
-      ' . $whereSQL . '
384
+      ' . $whereSQL.'
385 385
     ';
386 386
     $result = $dbConnection->query($query);
387 387
 
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 
402 402
           if (!\in_array($fieldName, $ignoreArray, true)) {
403 403
             if (\array_key_exists($fieldName, $updateArray)) {
404
-              $insert_keys .= ',' . $fieldName;
404
+              $insert_keys .= ','.$fieldName;
405 405
               $insert_values .= ',?';
406 406
               $bindings[] = $updateArray[$fieldName]; // INFO: do not escape non selected data
407 407
             } else {
408
-              $insert_keys .= ',' . $fieldName;
408
+              $insert_keys .= ','.$fieldName;
409 409
               $insert_values .= ',?';
410 410
               $bindings[] = $value; // INFO: do not escape non selected data
411 411
             }
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
         $insert_values = ltrim($insert_values, ',');
417 417
 
418 418
         // insert the "copied" row
419
-        $new_query = 'INSERT INTO ' . $databaseName . $dbConnection->quote_string($table) . ' 
420
-          (' . $insert_keys . ')
419
+        $new_query = 'INSERT INTO '.$databaseName.$dbConnection->quote_string($table).' 
420
+          (' . $insert_keys.')
421 421
           VALUES 
422
-          (' . $insert_values . ')
422
+          (' . $insert_values.')
423 423
         ';
424 424
 
425 425
         return $dbConnection->query($new_query, $bindings);
Please login to merge, or discard this patch.
src/voku/db/Prepare.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     foreach ($this->_boundParams as $param) {
84 84
       $arguments[0] .= $param['type'];
85
-      $arguments[] =& $param['value'];
85
+      $arguments[] = & $param['value'];
86 86
     }
87 87
 
88 88
     return $arguments;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     $value = $this->_db->escape($value);
106 106
 
107 107
     if ($type === 's') {
108
-      $valueForSqlWithBoundParameters = "'" . $value . "'";
108
+      $valueForSqlWithBoundParameters = "'".$value."'";
109 109
     } elseif ($type === 'i') {
110 110
       $valueForSqlWithBoundParameters = (int)$value;
111 111
     } elseif ($type === 'd') {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     // debug_backtrace returns arguments by reference, see comments at http://php.net/manual/de/function.func-get-args.php
183 183
     $trace = \debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1);
184 184
 
185
-    $args =& $trace[0]['args'];
185
+    $args = & $trace[0]['args'];
186 186
     $types = \str_split($types);
187 187
 
188 188
     $args_count = \count($args) - 1;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
     $arg = 1;
198 198
     foreach ($types as $typeInner) {
199
-      $val =& $args[$arg];
199
+      $val = & $args[$arg];
200 200
       $this->_boundParams[] = [
201 201
           'type'  => $typeInner,
202 202
           'value' => &$val,
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     $bool = parent::prepare($query);
333 333
 
334 334
     if ($bool === false) {
335
-      $this->_debug->displayError('Can not prepare query: ' . $query . ' | ' . $this->error, false);
335
+      $this->_debug->displayError('Can not prepare query: '.$query.' | '.$this->error, false);
336 336
     }
337 337
 
338 338
     return $bool;
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
 
421 421
       // exit if we have more then 3 "DB server has gone away"-errors
422 422
       if ($RECONNECT_COUNTER > 3) {
423
-        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
423
+        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
424 424
         throw new DBGoneAwayException($errorMsg);
425 425
       }
426 426
 
427
-      $this->_debug->mailToAdmin('DB-Error', $errorMsg . ":\n<br />" . $sql);
427
+      $this->_debug->mailToAdmin('DB-Error', $errorMsg.":\n<br />".$sql);
428 428
 
429 429
       // reconnect
430 430
       $RECONNECT_COUNTER++;
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
       return $this->execute();
435 435
     }
436 436
 
437
-    $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
437
+    $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
438 438
 
439 439
     // this query returned an error, we must display it (only for dev) !!!
440
-    $this->_debug->displayError($errorMsg . ' | ' . $sql);
440
+    $this->_debug->displayError($errorMsg.' | '.$sql);
441 441
 
442 442
     return false;
443 443
   }
Please login to merge, or discard this patch.