Completed
Push — master ( 834586...b472fa )
by Lars
02:24
created
src/voku/db/DB.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1079,7 +1079,7 @@
 block discarded – undo
1079 1079
      * @param string  $query    <p>sql-query</p>
1080 1080
      * @param bool    $useCache optional <p>use cache?</p>
1081 1081
      * @param int     $cacheTTL optional <p>cache-ttl in seconds</p>
1082
-     * @param DB|null $db       optional <p>the database connection</p>
1082
+     * @param null|\self $db       optional <p>the database connection</p>
1083 1083
      *
1084 1084
      * @throws QueryException
1085 1085
      *
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
         }
320 320
 
321 321
         if ($port) {
322
-            $this->port = (int) $port;
322
+            $this->port = (int)$port;
323 323
         } else {
324 324
             /** @noinspection PhpUsageOfSilenceOperatorInspection */
325
-            $this->port = (int) @\ini_get('mysqli.default_port');
325
+            $this->port = (int)@\ini_get('mysqli.default_port');
326 326
         }
327 327
 
328 328
         // fallback
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         foreach ($arrayPair as $_key => $_value) {
376 376
             $_connector = '=';
377 377
             $_glueHelper = '';
378
-            $_key_upper = \strtoupper((string) $_key);
378
+            $_key_upper = \strtoupper((string)$_key);
379 379
 
380 380
             if (\strpos($_key_upper, ' NOT') !== false) {
381 381
                 $_connector = 'NOT';
@@ -457,18 +457,18 @@  discard block
 block discarded – undo
457 457
                 }
458 458
 
459 459
                 if ($_connector === 'NOT IN' || $_connector === 'IN') {
460
-                    $_value = '(' . \implode(',', $_value) . ')';
460
+                    $_value = '('.\implode(',', $_value).')';
461 461
                 } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
462
-                    $_value = '(' . \implode(' AND ', $_value) . ')';
462
+                    $_value = '('.\implode(' AND ', $_value).')';
463 463
                 } elseif ($firstKey && $firstValue) {
464
-                    if (\strpos((string) $firstKey, ' +') !== false) {
465
-                        $firstKey = \str_replace(' +', '', (string) $firstKey);
466
-                        $_value = $firstKey . ' + ' . $firstValue;
464
+                    if (\strpos((string)$firstKey, ' +') !== false) {
465
+                        $firstKey = \str_replace(' +', '', (string)$firstKey);
466
+                        $_value = $firstKey.' + '.$firstValue;
467 467
                     }
468 468
 
469
-                    if (\strpos((string) $firstKey, ' -') !== false) {
470
-                        $firstKey = \str_replace(' -', '', (string) $firstKey);
471
-                        $_value = $firstKey . ' - ' . $firstValue;
469
+                    if (\strpos((string)$firstKey, ' -') !== false) {
470
+                        $firstKey = \str_replace(' -', '', (string)$firstKey);
471
+                        $_value = $firstKey.' - '.$firstValue;
472 472
                     }
473 473
                 }
474 474
             } else {
@@ -477,18 +477,18 @@  discard block
 block discarded – undo
477 477
 
478 478
             $quoteString = $this->quote_string(
479 479
                 \trim(
480
-                    (string) \str_ireplace(
480
+                    (string)\str_ireplace(
481 481
                         [
482 482
                             $_connector,
483 483
                             $_glueHelper,
484 484
                         ],
485 485
                         '',
486
-                        (string) $_key
486
+                        (string)$_key
487 487
                     )
488 488
                 )
489 489
             );
490 490
 
491
-            $_value = (array) $_value;
491
+            $_value = (array)$_value;
492 492
 
493 493
             if (!$_glueHelper) {
494 494
                 $_glueHelper = $glue;
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                     $valueInner = "''";
513 513
                 }
514 514
 
515
-                $sql .= ' ' . $_glueHelperInner . ' ' . $quoteString . ' ' . $_connector . ' ' . $valueInner . " \n";
515
+                $sql .= ' '.$_glueHelperInner.' '.$quoteString.' '.$_connector.' '.$valueInner." \n";
516 516
                 $tmpCounter++;
517 517
             }
518 518
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
             unset($params[$key]);
565 565
 
566 566
             $sql = \substr_replace($sql, $replacement, $offset, 1);
567
-            $offset = \strpos($sql, '?', $offset + \strlen((string) $replacement));
567
+            $offset = \strpos($sql, '?', $offset + \strlen((string)$replacement));
568 568
         }
569 569
 
570 570
         return ['sql' => $sql, 'params' => $params];
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
             // add ":" if needed
603 603
             if (\strpos($name, ':') !== 0) {
604
-                $nameTmp = ':' . $name;
604
+                $nameTmp = ':'.$name;
605 605
             } else {
606 606
                 $nameTmp = $name;
607 607
             }
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
             if ($offset === null) {
610 610
                 $offset = \strpos($sql, $nameTmp);
611 611
             } else {
612
-                $offset = \strpos($sql, $nameTmp, $offset + \strlen((string) $replacement));
612
+                $offset = \strpos($sql, $nameTmp, $offset + \strlen((string)$replacement));
613 613
             }
614 614
 
615 615
             if ($offset === false) {
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
             return \mysqli_affected_rows($this->mysqli_link);
642 642
         }
643 643
 
644
-        return (int) $this->affected_rows;
644
+        return (int)$this->affected_rows;
645 645
     }
646 646
 
647 647
     /**
@@ -853,10 +853,10 @@  discard block
 block discarded – undo
853 853
                 $this->database,
854 854
                 $this->port,
855 855
                 $this->socket,
856
-                (int) $flags
856
+                (int)$flags
857 857
             );
858 858
         } catch (\Exception $e) {
859
-            $error = 'Error connecting to mysql server: ' . $e->getMessage();
859
+            $error = 'Error connecting to mysql server: '.$e->getMessage();
860 860
             $this->debug->displayError($error, false);
861 861
 
862 862
             throw new DBConnectException($error, 100, $e);
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 
866 866
         $errno = \mysqli_connect_errno();
867 867
         if (!$this->connected || $errno) {
868
-            $error = 'Error connecting to mysql server: ' . \mysqli_connect_error() . ' (' . $errno . ')';
868
+            $error = 'Error connecting to mysql server: '.\mysqli_connect_error().' ('.$errno.')';
869 869
             $this->debug->displayError($error, false);
870 870
 
871 871
             throw new DBConnectException($error, 101);
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         $this->connected = $this->doctrine_connection->isConnected();
885 885
 
886 886
         if (!$this->connected) {
887
-            $error = 'Error connecting to mysql server: ' . \print_r($this->doctrine_connection->errorInfo(), false);
887
+            $error = 'Error connecting to mysql server: '.\print_r($this->doctrine_connection->errorInfo(), false);
888 888
             $this->debug->displayError($error, false);
889 889
 
890 890
             throw new DBConnectException($error, 101);
@@ -927,10 +927,10 @@  discard block
 block discarded – undo
927 927
         }
928 928
 
929 929
         if ($databaseName) {
930
-            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
930
+            $databaseName = $this->quote_string(\trim($databaseName)).'.';
931 931
         }
932 932
 
933
-        $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})";
933
+        $sql = 'DELETE FROM '.$databaseName.$this->quote_string($table)." WHERE (${WHERE})";
934 934
 
935 935
         $return = $this->query($sql);
936 936
 
@@ -1027,14 +1027,14 @@  discard block
 block discarded – undo
1027 1027
                 $var = $var->format('Y-m-d H:i:s');
1028 1028
                 $type = 'string';
1029 1029
             } elseif (\method_exists($var, '__toString')) {
1030
-                $var = (string) $var;
1030
+                $var = (string)$var;
1031 1031
                 $type = 'string';
1032 1032
             }
1033 1033
         }
1034 1034
 
1035 1035
         switch ($type) {
1036 1036
             case 'boolean':
1037
-                $var = (int) $var;
1037
+                $var = (int)$var;
1038 1038
 
1039 1039
                 break;
1040 1040
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                     }
1078 1078
                 } else {
1079 1079
                     $varCleaned = [];
1080
-                    foreach ((array) $var as $key => $value) {
1080
+                    foreach ((array)$var as $key => $value) {
1081 1081
                         $key = $this->escape($key, $stripe_non_utf8, $html_entity_decode);
1082 1082
                         $value = $this->escape($value, $stripe_non_utf8, $html_entity_decode);
1083 1083
 
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 
1144 1144
         if ($useCache) {
1145 1145
             $cache = new Cache(null, null, false, $useCache);
1146
-            $cacheKey = 'sql-' . \md5($query);
1146
+            $cacheKey = 'sql-'.\md5($query);
1147 1147
 
1148 1148
             if (
1149 1149
                 $cache->getCacheIsReady()
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
         }
1318 1318
 
1319 1319
         if (
1320
-            '' . $hostname . $username . $password . $database . $port . $charset === '' . $port . $charset
1320
+            ''.$hostname.$username.$password.$database.$port.$charset === ''.$port.$charset
1321 1321
             &&
1322 1322
             $firstInstance instanceof self
1323 1323
         ) {
@@ -1333,13 +1333,13 @@  discard block
 block discarded – undo
1333 1333
             if (\is_object($extra_config_value)) {
1334 1334
                 $extra_config_value_tmp = \spl_object_hash($extra_config_value);
1335 1335
             } else {
1336
-                $extra_config_value_tmp = (string) $extra_config_value;
1336
+                $extra_config_value_tmp = (string)$extra_config_value;
1337 1337
             }
1338
-            $extra_config_string .= $extra_config_key . $extra_config_value_tmp;
1338
+            $extra_config_string .= $extra_config_key.$extra_config_value_tmp;
1339 1339
         }
1340 1340
 
1341 1341
         $connection = \md5(
1342
-            $hostname . $username . $password . $database . $port . $charset . (int) $exit_on_error . (int) $echo_on_error . $logger_class_name . $logger_level . $extra_config_string
1342
+            $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.$extra_config_string
1343 1343
         );
1344 1344
 
1345 1345
         if (!isset($instance[$connection])) {
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
         $SET = $this->_parseArrayPair($data);
1480 1480
 
1481 1481
         if ($databaseName) {
1482
-            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
1482
+            $databaseName = $this->quote_string(\trim($databaseName)).'.';
1483 1483
         }
1484 1484
 
1485
-        $sql = 'INSERT INTO ' . $databaseName . $this->quote_string($table) . " SET ${SET}";
1485
+        $sql = 'INSERT INTO '.$databaseName.$this->quote_string($table)." SET ${SET}";
1486 1486
 
1487 1487
         $return = $this->query($sql);
1488 1488
         if ($return === false) {
@@ -2011,12 +2011,12 @@  discard block
 block discarded – undo
2011 2011
 
2012 2012
             // exit if we have more then 3 "DB server has gone away"-errors
2013 2013
             if ($RECONNECT_COUNTER > 3) {
2014
-                $this->debug->mailToAdmin('DB-Fatal-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql, 5);
2014
+                $this->debug->mailToAdmin('DB-Fatal-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql, 5);
2015 2015
 
2016 2016
                 throw new DBGoneAwayException($errorMessage);
2017 2017
             }
2018 2018
 
2019
-            $this->debug->mailToAdmin('DB-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
2019
+            $this->debug->mailToAdmin('DB-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
2020 2020
 
2021 2021
             // reconnect
2022 2022
             $RECONNECT_COUNTER++;
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
             return false;
2031 2031
         }
2032 2032
 
2033
-        $this->debug->mailToAdmin('SQL-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
2033
+        $this->debug->mailToAdmin('SQL-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
2034 2034
 
2035 2035
         $force_exception_after_error = null; // auto
2036 2036
         if ($this->in_transaction) {
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
         }
2039 2039
         // this query returned an error, we must display it (only for dev) !!!
2040 2040
 
2041
-        $this->debug->displayError($errorMessage . '(' . $errorNumber . ') ' . ' | ' . $sql, $force_exception_after_error);
2041
+        $this->debug->displayError($errorMessage.'('.$errorNumber.') '.' | '.$sql, $force_exception_after_error);
2042 2042
 
2043 2043
         return false;
2044 2044
     }
@@ -2056,12 +2056,12 @@  discard block
 block discarded – undo
2056 2056
             '`',
2057 2057
             '``',
2058 2058
             \trim(
2059
-                (string) $this->escape($str, false),
2059
+                (string)$this->escape($str, false),
2060 2060
                 '`'
2061 2061
             )
2062 2062
         );
2063 2063
 
2064
-        return '`' . $str . '`';
2064
+        return '`'.$str.'`';
2065 2065
     }
2066 2066
 
2067 2067
     /**
@@ -2130,10 +2130,10 @@  discard block
 block discarded – undo
2130 2130
         $values = \implode(',', $data);
2131 2131
 
2132 2132
         if ($databaseName) {
2133
-            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2133
+            $databaseName = $this->quote_string(\trim($databaseName)).'.';
2134 2134
         }
2135 2135
 
2136
-        $sql = 'REPLACE INTO ' . $databaseName . $this->quote_string($table) . " (${columns}) VALUES (${values})";
2136
+        $sql = 'REPLACE INTO '.$databaseName.$this->quote_string($table)." (${columns}) VALUES (${values})";
2137 2137
 
2138 2138
         $return = $this->query($sql);
2139 2139
         \assert(\is_int($return) || $return === false);
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
                 }
2233 2233
             } else {
2234 2234
                 $varCleaned = [];
2235
-                foreach ((array) $var as $key => $value) {
2235
+                foreach ((array)$var as $key => $value) {
2236 2236
                     $key = $this->escape($key, false, false, $convert_array);
2237 2237
                     $value = $this->secure($value);
2238 2238
 
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
         $var = $this->escape($var, false, false, null);
2280 2280
 
2281 2281
         if (\is_string($var)) {
2282
-            $var = "'" . \trim($var, "'") . "'";
2282
+            $var = "'".\trim($var, "'")."'";
2283 2283
         }
2284 2284
 
2285 2285
         return $var;
@@ -2317,10 +2317,10 @@  discard block
 block discarded – undo
2317 2317
         }
2318 2318
 
2319 2319
         if ($databaseName) {
2320
-            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2320
+            $databaseName = $this->quote_string(\trim($databaseName)).'.';
2321 2321
         }
2322 2322
 
2323
-        $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})";
2323
+        $sql = 'SELECT * FROM '.$databaseName.$this->quote_string($table)." WHERE (${WHERE})";
2324 2324
 
2325 2325
         $return = $this->query($sql);
2326 2326
         \assert($return instanceof Result || $return === false);
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
     public function setConfigExtra(array $extra_config)
2372 2372
     {
2373 2373
         if (isset($extra_config['session_to_db'])) {
2374
-            $this->session_to_db = (bool) $extra_config['session_to_db'];
2374
+            $this->session_to_db = (bool)$extra_config['session_to_db'];
2375 2375
         }
2376 2376
 
2377 2377
         if (isset($extra_config['doctrine'])) {
@@ -2434,9 +2434,9 @@  discard block
 block discarded – undo
2434 2434
             $return = \mysqli_set_charset($this->mysqli_link, $charset);
2435 2435
 
2436 2436
             /** @noinspection PhpUsageOfSilenceOperatorInspection */
2437
-            @\mysqli_query($this->mysqli_link, 'SET CHARACTER SET ' . $charset);
2437
+            @\mysqli_query($this->mysqli_link, 'SET CHARACTER SET '.$charset);
2438 2438
             /** @noinspection PhpUsageOfSilenceOperatorInspection */
2439
-            @\mysqli_query($this->mysqli_link, "SET NAMES '" . $charset . "'");
2439
+            @\mysqli_query($this->mysqli_link, "SET NAMES '".$charset."'");
2440 2440
         } elseif ($this->doctrine_connection && $this->isDoctrinePDOConnection()) {
2441 2441
             $doctrineWrappedConnection = $this->getDoctrinePDOConnection();
2442 2442
             if (!$doctrineWrappedConnection instanceof Connection) {
@@ -2444,9 +2444,9 @@  discard block
 block discarded – undo
2444 2444
             }
2445 2445
 
2446 2446
             /** @noinspection PhpUsageOfSilenceOperatorInspection */
2447
-            @$doctrineWrappedConnection->exec('SET CHARACTER SET ' . $charset);
2447
+            @$doctrineWrappedConnection->exec('SET CHARACTER SET '.$charset);
2448 2448
             /** @noinspection PhpUsageOfSilenceOperatorInspection */
2449
-            @$doctrineWrappedConnection->exec("SET NAMES '" . $charset . "'");
2449
+            @$doctrineWrappedConnection->exec("SET NAMES '".$charset."'");
2450 2450
 
2451 2451
             $return = true;
2452 2452
         } else {
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
      */
2588 2588
     public function table_exists(string $table): bool
2589 2589
     {
2590
-        $check = $this->query('SELECT 1 FROM ' . $this->quote_string($table));
2590
+        $check = $this->query('SELECT 1 FROM '.$this->quote_string($table));
2591 2591
 
2592 2592
         return $check !== false
2593 2593
                &&
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
             $result = $callback($this);
2619 2619
             if ($result === false) {
2620 2620
                 /** @noinspection ThrowRawExceptionInspection */
2621
-                throw new \Exception('call_user_func [' . \print_r($callback, true) . '] === false');
2621
+                throw new \Exception('call_user_func ['.\print_r($callback, true).'] === false');
2622 2622
             }
2623 2623
 
2624 2624
             return $this->commit();
@@ -2676,10 +2676,10 @@  discard block
 block discarded – undo
2676 2676
         }
2677 2677
 
2678 2678
         if ($databaseName) {
2679
-            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2679
+            $databaseName = $this->quote_string(\trim($databaseName)).'.';
2680 2680
         }
2681 2681
 
2682
-        $sql = 'UPDATE ' . $databaseName . $this->quote_string($table) . " SET ${SET} WHERE (${WHERE})";
2682
+        $sql = 'UPDATE '.$databaseName.$this->quote_string($table)." SET ${SET} WHERE (${WHERE})";
2683 2683
 
2684 2684
         $return = $this->query($sql);
2685 2685
         \assert(\is_int($return) || $return === false);
Please login to merge, or discard this patch.
src/voku/db/Debug.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         } else {
87 87
 
88 88
             // for testing with dev-address
89
-            $noDev = isset($_GET['noDev']) ? (int) $_GET['noDev'] : 0;
89
+            $noDev = isset($_GET['noDev']) ? (int)$_GET['noDev'] : 0;
90 90
             $remoteIpAddress = $_SERVER['REMOTE_ADDR'] ?? false;
91 91
 
92 92
             if (
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
         $this->logger(
138 138
             [
139 139
                 'error',
140
-                '<strong>' . \date(
140
+                '<strong>'.\date(
141 141
                     'd. m. Y G:i:s'
142
-                ) . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . ') (sql-error):</strong> ' . $error . '<br>',
142
+                ).' ('.$fileInfo['file'].' line: '.$fileInfo['line'].') (sql-error):</strong> '.$error.'<br>',
143 143
             ]
144 144
         );
145 145
 
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 
156 156
             if (\PHP_SAPI === 'cli') {
157 157
                 echo "\n";
158
-                echo 'file:line -> ' . $fileInfo['file'] . ':' . $fileInfo['line'] . "\n";
159
-                echo 'error: ' . \str_replace(["\r\n", "\n", "\r"], '', $error);
158
+                echo 'file:line -> '.$fileInfo['file'].':'.$fileInfo['line']."\n";
159
+                echo 'error: '.\str_replace(["\r\n", "\n", "\r"], '', $error);
160 160
                 echo "\n";
161 161
             } else {
162 162
                 echo '
163
-        <div class="OBJ-mysql-box" style="border: ' . $box_border . '; background: ' . $box_bg . '; padding: 10px; margin: 10px;">
163
+        <div class="OBJ-mysql-box" style="border: ' . $box_border.'; background: '.$box_bg.'; padding: 10px; margin: 10px;">
164 164
           <b style="font-size: 14px;">MYSQL Error:</b>
165 165
           <code style="display: block;">
166
-            file:line -> ' . $fileInfo['file'] . ':' . $fileInfo['line'] . '
167
-            ' . $error . '
166
+            file:line -> ' . $fileInfo['file'].':'.$fileInfo['line'].'
167
+            ' . $error.'
168 168
           </code>
169 169
         </div>
170 170
         ';
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             /** @noinspection PhpUsageOfSilenceOperatorInspection */
306 306
             $infoExtra = @\mysqli_info($tmpLink);
307 307
             if ($infoExtra) {
308
-                $infoExtra = ' | info => ' . $infoExtra;
308
+                $infoExtra = ' | info => '.$infoExtra;
309 309
             }
310 310
         }
311 311
 
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
         // logging
314 314
         //
315 315
 
316
-        $info = 'time => ' . \round($duration, 5) . ' | results => ' . \print_r($results, true) . $infoExtra . ' | SQL => ' . UTF8::htmlentities($sql);
316
+        $info = 'time => '.\round($duration, 5).' | results => '.\print_r($results, true).$infoExtra.' | SQL => '.UTF8::htmlentities($sql);
317 317
 
318 318
         $fileInfo = $this->getFileAndLineFromSql();
319 319
 
320 320
         return $this->logger(
321 321
             [
322 322
                 $logLevel,
323
-                '<strong>' . \date('d. m. Y G:i:s') . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . '):</strong> ' . $info . '<br>',
323
+                '<strong>'.\date('d. m. Y G:i:s').' ('.$fileInfo['file'].' line: '.$fileInfo['line'].'):</strong> '.$info.'<br>',
324 324
                 'sql',
325 325
             ]
326 326
         );
@@ -393,21 +393,21 @@  discard block
 block discarded – undo
393 393
                 $this->logger(
394 394
                     [
395 395
                         'debug',
396
-                        $subject . ' | ' . $htmlBody,
396
+                        $subject.' | '.$htmlBody,
397 397
                     ]
398 398
                 );
399 399
             } elseif ($priority > 3) {
400 400
                 $this->logger(
401 401
                     [
402 402
                         'error',
403
-                        $subject . ' | ' . $htmlBody,
403
+                        $subject.' | '.$htmlBody,
404 404
                     ]
405 405
                 );
406 406
             } elseif ($priority < 3) {
407 407
                 $this->logger(
408 408
                     [
409 409
                         'info',
410
-                        $subject . ' | ' . $htmlBody,
410
+                        $subject.' | '.$htmlBody,
411 411
                     ]
412 412
                 );
413 413
             }
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
      */
420 420
     public function setEchoOnError($echo_on_error)
421 421
     {
422
-        $this->echo_on_error = (bool) $echo_on_error;
422
+        $this->echo_on_error = (bool)$echo_on_error;
423 423
     }
424 424
 
425 425
     /**
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      */
428 428
     public function setExitOnError($exit_on_error)
429 429
     {
430
-        $this->exit_on_error = (bool) $exit_on_error;
430
+        $this->exit_on_error = (bool)$exit_on_error;
431 431
     }
432 432
 
433 433
     /**
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      */
436 436
     public function setLoggerClassName($logger_class_name)
437 437
     {
438
-        $this->logger_class_name = (string) $logger_class_name;
438
+        $this->logger_class_name = (string)$logger_class_name;
439 439
     }
440 440
 
441 441
     /**
@@ -443,6 +443,6 @@  discard block
 block discarded – undo
443 443
      */
444 444
     public function setLoggerLevel($logger_level)
445 445
     {
446
-        $this->logger_level = (string) $logger_level;
446
+        $this->logger_level = (string)$logger_level;
447 447
     }
448 448
 }
Please login to merge, or discard this patch.
src/voku/db/Prepare.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
         $value = $this->_db->escape($value);
102 102
 
103 103
         if ($type === 's') {
104
-            $valueForSqlWithBoundParameters = "'" . $value . "'";
104
+            $valueForSqlWithBoundParameters = "'".$value."'";
105 105
         } elseif ($type === 'i') {
106
-            $valueForSqlWithBoundParameters = (int) $value;
106
+            $valueForSqlWithBoundParameters = (int)$value;
107 107
         } elseif ($type === 'd') {
108
-            $valueForSqlWithBoundParameters = (float) $value;
108
+            $valueForSqlWithBoundParameters = (float)$value;
109 109
         } else {
110 110
             $valueForSqlWithBoundParameters = $value;
111 111
         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
             // "INSERT" || "REPLACE"
206 206
             if (\preg_match('/^\s*"?(INSERT|REPLACE)\s+/i', $this->_sql)) {
207
-                $insert_id = (int) $this->insert_id;
207
+                $insert_id = (int)$this->insert_id;
208 208
                 $this->_debug->logQuery($this->_sql_with_bound_parameters, $query_duration, $insert_id);
209 209
 
210 210
                 return $insert_id;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
             // "UPDATE" || "DELETE"
214 214
             if (\preg_match('/^\s*"?(UPDATE|DELETE)\s+/i', $this->_sql)) {
215
-                $affected_rows = (int) $this->affected_rows;
215
+                $affected_rows = (int)$this->affected_rows;
216 216
                 $this->_debug->logQuery($this->_sql_with_bound_parameters, $query_duration, $affected_rows);
217 217
 
218 218
                 return $affected_rows;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                     return $this->queryErrorHandling($this->error, $this->_sql_with_bound_parameters);
230 230
                 }
231 231
 
232
-                $num_rows = (int) $select_result->num_rows;
232
+                $num_rows = (int)$select_result->num_rows;
233 233
                 $this->_debug->logQuery($this->_sql_with_bound_parameters, $query_duration, $num_rows);
234 234
 
235 235
                 return new Result($this->_sql_with_bound_parameters, $select_result);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     public function prepare($query): bool
289 289
     {
290 290
         if (!\is_string($query)) {
291
-            throw new \InvalidArgumentException('$query was no string: ' . \gettype($query));
291
+            throw new \InvalidArgumentException('$query was no string: '.\gettype($query));
292 292
         }
293 293
 
294 294
         $this->_sql = $query;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $bool = parent::prepare($query);
308 308
 
309 309
         if ($bool === false) {
310
-            $this->_debug->displayError('Can not prepare query: ' . $query . ' | ' . $this->error, false);
310
+            $this->_debug->displayError('Can not prepare query: '.$query.' | '.$this->error, false);
311 311
         }
312 312
 
313 313
         return $bool;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 // we need to replace the question mark "?" here
369 369
                 $values[1] = \str_replace('?', '###simple_mysqli__prepare_question_mark###', $values[1]);
370 370
                 // build the query (only for debugging)
371
-                $testQuery = (string) \preg_replace("/\?/", $values[1], $testQuery, 1);
371
+                $testQuery = (string)\preg_replace("/\?/", $values[1], $testQuery, 1);
372 372
             }
373 373
             $testQuery = \str_replace('###simple_mysqli__prepare_question_mark###', '?', $testQuery);
374 374
         }
@@ -399,12 +399,12 @@  discard block
 block discarded – undo
399 399
 
400 400
             // exit if we have more then 3 "DB server has gone away"-errors
401 401
             if ($RECONNECT_COUNTER > 3) {
402
-                $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
402
+                $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
403 403
 
404 404
                 throw new DBGoneAwayException($errorMsg);
405 405
             }
406 406
 
407
-            $this->_debug->mailToAdmin('DB-Error', $errorMsg . ":\n<br />" . $sql);
407
+            $this->_debug->mailToAdmin('DB-Error', $errorMsg.":\n<br />".$sql);
408 408
 
409 409
             // reconnect
410 410
             $RECONNECT_COUNTER++;
@@ -414,10 +414,10 @@  discard block
 block discarded – undo
414 414
             return $this->execute();
415 415
         }
416 416
 
417
-        $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
417
+        $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
418 418
 
419 419
         // this query returned an error, we must display it (only for dev) !!!
420
-        $this->_debug->displayError($errorMsg . ' | ' . $sql);
420
+        $this->_debug->displayError($errorMsg.' | '.$sql);
421 421
 
422 422
         return false;
423 423
     }
Please login to merge, or discard this patch.