Completed
Push — master ( da9721...858781 )
by Lars
01:54
created
src/voku/db/DB.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -569,7 +569,7 @@
 block discarded – undo
569 569
    *
570 570
    * @param mixed $var
571 571
    *
572
-   * @return mixed
572
+   * @return string
573 573
    */
574 574
   public function secure($var)
575 575
   {
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db;
6 6
 
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
         }
450 450
 
451 451
         if ($_connector === 'NOT IN' || $_connector === 'IN') {
452
-          $_value = '(' . \implode(',', $_value) . ')';
452
+          $_value = '('.\implode(',', $_value).')';
453 453
         } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
454
-          $_value = '(' . \implode(' AND ', $_value) . ')';
454
+          $_value = '('.\implode(' AND ', $_value).')';
455 455
         }
456 456
 
457 457
       } else {
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
           $valueInner = "''";
499 499
         }
500 500
 
501
-        $sql .= ' ' . $_glueHelperInner . ' ' . $quoteString . ' ' . $_connector . ' ' . $valueInner . " \n";
501
+        $sql .= ' '.$_glueHelperInner.' '.$quoteString.' '.$_connector.' '.$valueInner." \n";
502 502
         $tmpCounter++;
503 503
       }
504 504
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
       );
706 706
 
707 707
     } catch (\Exception $e) {
708
-      $error = 'Error connecting to mysql server: ' . $e->getMessage();
708
+      $error = 'Error connecting to mysql server: '.$e->getMessage();
709 709
       $this->_debug->displayError($error, true);
710 710
       throw new DBConnectException($error, 100, $e);
711 711
     }
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 
714 714
     $errno = \mysqli_connect_errno();
715 715
     if (!$this->connected || $errno) {
716
-      $error = 'Error connecting to mysql server: ' . \mysqli_connect_error() . ' (' . $errno . ')';
716
+      $error = 'Error connecting to mysql server: '.\mysqli_connect_error().' ('.$errno.')';
717 717
       $this->_debug->displayError($error, true);
718 718
       throw new DBConnectException($error, 101);
719 719
     }
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
     }
755 755
 
756 756
     if ($databaseName) {
757
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
757
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
758 758
     }
759 759
 
760
-    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
760
+    $sql = 'DELETE FROM '.$databaseName.$this->quote_string($table)." WHERE ($WHERE);";
761 761
 
762 762
     return $this->query($sql);
763 763
   }
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
         $nameTmp = \substr($name, 1);
831 831
       }
832 832
 
833
-      $parseKeyInner = $nameTmp . '-' . $PARSE_KEY_CACHE;
834
-      $sql = \str_replace(':' . $nameTmp, $parseKeyInner, $sql);
833
+      $parseKeyInner = $nameTmp.'-'.$PARSE_KEY_CACHE;
834
+      $sql = \str_replace(':'.$nameTmp, $parseKeyInner, $sql);
835 835
     }
836 836
 
837 837
     foreach ($params as $name => $value) {
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
         $nameTmp = \substr($name, 1);
841 841
       }
842 842
 
843
-      $parseKeyInner = $nameTmp . '-' . $PARSE_KEY_CACHE;
843
+      $parseKeyInner = $nameTmp.'-'.$PARSE_KEY_CACHE;
844 844
       $sqlBefore = $sql;
845 845
       $secureParamValue = $this->secure($params[$name]);
846 846
 
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
     if ($useCache === true) {
1018 1018
       $cache = new Cache(null, null, false, $useCache);
1019
-      $cacheKey = 'sql-' . \md5($query);
1019
+      $cacheKey = 'sql-'.\md5($query);
1020 1020
 
1021 1021
       if (
1022 1022
           $cache->getCacheIsReady() === true
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
     static $firstInstance = null;
1127 1127
 
1128 1128
     if (
1129
-        $hostname . $username . $password . $database . $port . $charset == '3306utf8'
1129
+        $hostname.$username.$password.$database.$port.$charset == '3306utf8'
1130 1130
         &&
1131 1131
         null !== $firstInstance
1132 1132
     ) {
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
     $extra_config_string = '';
1137 1137
     if (\is_array($extra_config) === true) {
1138 1138
       foreach ($extra_config as $extra_config_key => $extra_config_value) {
1139
-        $extra_config_string .= $extra_config_key . (string)$extra_config_value;
1139
+        $extra_config_string .= $extra_config_key.(string)$extra_config_value;
1140 1140
       }
1141 1141
     } else {
1142 1142
       // only for backward compatibility
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
     }
1145 1145
 
1146 1146
     $connection = \md5(
1147
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . $extra_config_string
1147
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.$extra_config_string
1148 1148
     );
1149 1149
 
1150 1150
     if (!isset($instance[$connection])) {
@@ -1231,10 +1231,10 @@  discard block
 block discarded – undo
1231 1231
     $SET = $this->_parseArrayPair($data);
1232 1232
 
1233 1233
     if ($databaseName) {
1234
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1234
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
1235 1235
     }
1236 1236
 
1237
-    $sql = 'INSERT INTO ' . $databaseName . $this->quote_string($table) . " SET $SET;";
1237
+    $sql = 'INSERT INTO '.$databaseName.$this->quote_string($table)." SET $SET;";
1238 1238
 
1239 1239
     return $this->query($sql);
1240 1240
   }
@@ -1545,11 +1545,11 @@  discard block
 block discarded – undo
1545 1545
 
1546 1546
       // exit if we have more then 3 "DB server has gone away"-errors
1547 1547
       if ($RECONNECT_COUNTER > 3) {
1548
-        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql, 5);
1548
+        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql, 5);
1549 1549
         throw new DBGoneAwayException($errorMessage);
1550 1550
       }
1551 1551
 
1552
-      $this->_debug->mailToAdmin('DB-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
1552
+      $this->_debug->mailToAdmin('DB-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
1553 1553
 
1554 1554
       // reconnect
1555 1555
       $RECONNECT_COUNTER++;
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
       return false;
1564 1564
     }
1565 1565
 
1566
-    $this->_debug->mailToAdmin('SQL-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
1566
+    $this->_debug->mailToAdmin('SQL-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
1567 1567
 
1568 1568
     $force_exception_after_error = null; // auto
1569 1569
     if ($this->_in_transaction === true) {
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
     }
1572 1572
     // this query returned an error, we must display it (only for dev) !!!
1573 1573
 
1574
-    $this->_debug->displayError($errorMessage . '(' . $errorNumber . ') ' . ' | ' . $sql, $force_exception_after_error);
1574
+    $this->_debug->displayError($errorMessage.'('.$errorNumber.') '.' | '.$sql, $force_exception_after_error);
1575 1575
 
1576 1576
     return false;
1577 1577
   }
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
         )
1595 1595
     );
1596 1596
 
1597
-    return '`' . $str . '`';
1597
+    return '`'.$str.'`';
1598 1598
   }
1599 1599
 
1600 1600
   /**
@@ -1665,10 +1665,10 @@  discard block
 block discarded – undo
1665 1665
     $values = \implode(',', $data);
1666 1666
 
1667 1667
     if ($databaseName) {
1668
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1668
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
1669 1669
     }
1670 1670
 
1671
-    $sql = 'REPLACE INTO ' . $databaseName . $this->quote_string($table) . " ($columns) VALUES ($values);";
1671
+    $sql = 'REPLACE INTO '.$databaseName.$this->quote_string($table)." ($columns) VALUES ($values);";
1672 1672
 
1673 1673
     return $this->query($sql);
1674 1674
   }
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
     $var = $this->escape($var, false, false, null);
1765 1765
 
1766 1766
     if (\is_string($var)) {
1767
-      $var = "'" . \trim($var, "'") . "'";
1767
+      $var = "'".\trim($var, "'")."'";
1768 1768
     }
1769 1769
 
1770 1770
     return $var;
@@ -1801,10 +1801,10 @@  discard block
 block discarded – undo
1801 1801
     }
1802 1802
 
1803 1803
     if ($databaseName) {
1804
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1804
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
1805 1805
     }
1806 1806
 
1807
-    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1807
+    $sql = 'SELECT * FROM '.$databaseName.$this->quote_string($table)." WHERE ($WHERE);";
1808 1808
 
1809 1809
     return $this->query($sql);
1810 1810
   }
@@ -1846,9 +1846,9 @@  discard block
 block discarded – undo
1846 1846
 
1847 1847
     $return = mysqli_set_charset($this->link, $charset);
1848 1848
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
1849
-    @\mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
1849
+    @\mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
1850 1850
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
1851
-    @\mysqli_query($this->link, "SET NAMES '" . $charset . "'");
1851
+    @\mysqli_query($this->link, "SET NAMES '".$charset."'");
1852 1852
 
1853 1853
     return $return;
1854 1854
   }
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
       $result = $callback($this);
1983 1983
       if ($result === false) {
1984 1984
         /** @noinspection ThrowRawExceptionInspection */
1985
-        throw new \Exception('call_user_func [' . $callback . '] === false');
1985
+        throw new \Exception('call_user_func ['.$callback.'] === false');
1986 1986
       }
1987 1987
 
1988 1988
       return $this->commit();
@@ -2035,10 +2035,10 @@  discard block
 block discarded – undo
2035 2035
     }
2036 2036
 
2037 2037
     if ($databaseName) {
2038
-      $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2038
+      $databaseName = $this->quote_string(\trim($databaseName)).'.';
2039 2039
     }
2040 2040
 
2041
-    $sql = 'UPDATE ' . $databaseName . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
2041
+    $sql = 'UPDATE '.$databaseName.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
2042 2042
 
2043 2043
     return $this->query($sql);
2044 2044
   }
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
    */
2053 2053
   public function table_exists(string $table): bool
2054 2054
   {
2055
-    $check = $this->query('SELECT 1 FROM ' . $this->quote_string($table));
2055
+    $check = $this->query('SELECT 1 FROM '.$this->quote_string($table));
2056 2056
 
2057 2057
     return $check !== false
2058 2058
            &&
Please login to merge, or discard this patch.
src/voku/db/exceptions/QueryException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db\exceptions;
6 6
 
Please login to merge, or discard this patch.
src/voku/db/ActiveRecordExpressions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db;
6 6
 
@@ -23,6 +23,6 @@  discard block
 block discarded – undo
23 23
    */
24 24
   public function __toString()
25 25
   {
26
-    return $this->source . ' ' . $this->operator . ' ' . $this->target;
26
+    return $this->source.' '.$this->operator.' '.$this->target;
27 27
   }
28 28
 }
Please login to merge, or discard this patch.
src/voku/db/ActiveRecordExpressionsWrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db;
6 6
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
     $delimiter = (string)($this->delimiter ?: ',');
22 22
 
23 23
     if ($this->start) {
24
-      return $this->start . implode($delimiter, $this->target->getArray()) . ($this->end ?: ')');
24
+      return $this->start.implode($delimiter, $this->target->getArray()).($this->end ?: ')');
25 25
     }
26 26
 
27
-    return '(' . implode($delimiter, $this->target->getArray()) . ($this->end ?: ')');
27
+    return '('.implode($delimiter, $this->target->getArray()).($this->end ?: ')');
28 28
   }
29 29
 }
Please login to merge, or discard this patch.
src/voku/db/exceptions/FetchingException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db\exceptions;
6 6
 
Please login to merge, or discard this patch.
src/voku/db/exceptions/DBConnectException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db\exceptions;
6 6
 
Please login to merge, or discard this patch.
src/voku/db/exceptions/DBGoneAwayException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db\exceptions;
6 6
 
Please login to merge, or discard this patch.
src/voku/db/exceptions/ActiveRecordException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db\exceptions;
6 6
 
Please login to merge, or discard this patch.
src/voku/db/Result.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace voku\db;
6 6
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
   {
680 680
     if ($as_array) {
681 681
       return \array_map(
682
-          function ($object) {
682
+          function($object) {
683 683
             return (array)$object;
684 684
           },
685 685
           \mysqli_fetch_fields($this->_result)
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
     }
792 792
 
793 793
     return \array_map(
794
-        function ($values) use ($keys) {
794
+        function($values) use ($keys) {
795 795
           return \array_combine($keys, $values);
796 796
         }, $rows
797 797
     );
Please login to merge, or discard this patch.