Completed
Push — master ( 9d1a0b...c99f2d )
by Lars
06:09
created
src/voku/db/Result.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
    * fetchObject
230 230
    *
231 231
    * @param string     $class
232
-   * @param null|array $params
232
+   * @param string $params
233 233
    * @param bool       $reset
234 234
    *
235 235
    * @return object|false false on error
Please login to merge, or discard this patch.
src/voku/db/Helper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $dbFields = array();
36 36
     $db = DB::getInstance();
37 37
 
38
-    $sql = 'SHOW COLUMNS FROM `' . $db->escape($table) . '`';
38
+    $sql = 'SHOW COLUMNS FROM `'.$db->escape($table).'`';
39 39
     $result = $db->query($sql);
40 40
 
41 41
     if ($result && $result->num_rows > 0) {
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
     $table = $db->escape($table);
72 72
 
73 73
     foreach ($whereArray as $key => $value) {
74
-      $whereSQL = ' AND ' . $db->escape($key) . ' = ' . $db->escape($value);
74
+      $whereSQL = ' AND '.$db->escape($key).' = '.$db->escape($value);
75 75
     }
76 76
 
77 77
     // get the row
78
-    $query = 'SELECT * FROM ' . $table . '
78
+    $query = 'SELECT * FROM '.$table.'
79 79
       WHERE 1 = 1
80
-      ' . $whereSQL . '
80
+      ' . $whereSQL.'
81 81
     ';
82 82
     $result = $db->query($query);
83 83
 
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
             if (array_key_exists($fieldName, $updateArray)) {
98 98
 
99 99
               if ($updateArray[$fieldName] || $updateArray[$fieldName] == 0) {
100
-                $insert_keys .= ',' . $fieldName;
100
+                $insert_keys .= ','.$fieldName;
101 101
                 $insert_values .= ',?';
102 102
                 $bindings[] = $updateArray[$fieldName];
103 103
               }
104 104
 
105 105
             } else {
106
-              $insert_keys .= ',' . $fieldName;
106
+              $insert_keys .= ','.$fieldName;
107 107
               $insert_values .= ',?';
108 108
               $bindings[] = $value;
109 109
             }
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         }
112 112
 
113 113
         // insert the "copied" row
114
-        $new_query = 'INSERT INTO `' . $table . '` (' . ltrim($insert_keys, ',') . ')
115
-          VALUES (' . ltrim($insert_values, ',') . ')
114
+        $new_query = 'INSERT INTO `'.$table.'` ('.ltrim($insert_keys, ',').')
115
+          VALUES (' . ltrim($insert_values, ',').')
116 116
         ';
117 117
         $return = $db->query($new_query, $bindings);
118 118
       }
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
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
     $this->logger(
129 129
         array(
130 130
             'error',
131
-            '<strong>' . date(
131
+            '<strong>'.date(
132 132
                 'd. m. Y G:i:s'
133
-            ) . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . ') (sql-error):</strong> ' . $error . '<br>',
133
+            ).' ('.$fileInfo['file'].' line: '.$fileInfo['line'].') (sql-error):</strong> '.$error.'<br>',
134 134
         )
135 135
     );
136 136
 
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
         $box_bg = $this->css_mysql_box_bg;
144 144
 
145 145
         echo '
146
-        <div class="OBJ-mysql-box" style="border:' . $box_border . '; background:' . $box_bg . '; padding:10px; margin:10px;">
146
+        <div class="OBJ-mysql-box" style="border:' . $box_border.'; background:'.$box_bg.'; padding:10px; margin:10px;">
147 147
           <b style="font-size:14px;">MYSQL Error:</b>
148 148
           <code style="display:block;">
149
-            file / line: ' . $fileInfo['file'] . ' / ' . $fileInfo['line'] . '
150
-            ' . $error . '
149
+            file / line: ' . $fileInfo['file'].' / '.$fileInfo['line'].'
150
+            ' . $error.'
151 151
           </code>
152 152
         </div>
153 153
         ';
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
 
275 275
     $infoExtra = mysqli_info($this->_db->getLink());
276 276
     if ($infoExtra) {
277
-      $infoExtra = ' | info => ' . $infoExtra;
277
+      $infoExtra = ' | info => '.$infoExtra;
278 278
     }
279 279
 
280
-    $info = 'time => ' . round($duration, 5) . ' | results => ' . (int)$results . $infoExtra . ' | SQL => ' . UTF8::htmlentities($sql);
280
+    $info = 'time => '.round($duration, 5).' | results => '.(int)$results.$infoExtra.' | SQL => '.UTF8::htmlentities($sql);
281 281
     $fileInfo = $this->getFileAndLineFromSql();
282 282
 
283 283
     $this->logger(
284 284
         array(
285 285
             'debug',
286
-            '<strong>' . date('d. m. Y G:i:s') . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . '):</strong> ' . $info . '<br>',
286
+            '<strong>'.date('d. m. Y G:i:s').' ('.$fileInfo['file'].' line: '.$fileInfo['line'].'):</strong> '.$info.'<br>',
287 287
             'sql',
288 288
         )
289 289
     );
@@ -347,21 +347,21 @@  discard block
 block discarded – undo
347 347
         $this->logger(
348 348
             array(
349 349
                 'debug',
350
-                $subject . ' | ' . $htmlBody,
350
+                $subject.' | '.$htmlBody,
351 351
             )
352 352
         );
353 353
       } elseif ($priority > 3) {
354 354
         $this->logger(
355 355
             array(
356 356
                 'error',
357
-                $subject . ' | ' . $htmlBody,
357
+                $subject.' | '.$htmlBody,
358 358
             )
359 359
         );
360 360
       } elseif ($priority < 3) {
361 361
         $this->logger(
362 362
             array(
363 363
                 'info',
364
-                $subject . ' | ' . $htmlBody,
364
+                $subject.' | '.$htmlBody,
365 365
             )
366 366
         );
367 367
       }
Please login to merge, or discard this patch.
src/voku/db/Prepare.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     $value = $this->_db->escape($value);
101 101
 
102 102
     if ('s' === $type) {
103
-      $valueForSqlWithBoundParameters = "'" . $value . "'";
103
+      $valueForSqlWithBoundParameters = "'".$value."'";
104 104
     } else {
105 105
       $valueForSqlWithBoundParameters = $value;
106 106
     }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     $bool = parent::prepare($query);
301 301
 
302 302
     if ($bool === false) {
303
-      $this->_debug->displayError('Can\'t prepare Query: ' . $query . ' | ' . $this->error, false);
303
+      $this->_debug->displayError('Can\'t prepare Query: '.$query.' | '.$this->error, false);
304 304
     }
305 305
 
306 306
     return true;
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 
390 390
       // exit if we have more then 3 "DB server has gone away"-errors
391 391
       if ($reconnectCounter > 3) {
392
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
392
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
393 393
         throw new \Exception($errorMsg);
394 394
       } else {
395
-        $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
395
+        $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
396 396
 
397 397
         // reconnect
398 398
         $reconnectCounter++;
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
         return $this->execute();
403 403
       }
404 404
     } else {
405
-      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
405
+      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg.":\n<br />".$sql);
406 406
 
407 407
       // this query returned an error, we must display it (only for dev) !!!
408
-      $this->_debug->displayError($errorMsg . ' | ' . $sql);
408
+      $this->_debug->displayError($errorMsg.' | '.$sql);
409 409
     }
410 410
 
411 411
     return false;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
    * @param null   $v34
165 165
    * @param null   $v35
166 166
    *
167
-   * @return mixed
167
+   * @return boolean
168 168
    */
169 169
   public function bind_param_debug($types, &$v1 = null, &$v2 = null, &$v3 = null, &$v4 = null, &$v5 = null, &$v6 = null, &$v7 = null, &$v8 = null, &$v9 = null, &$v10 = null, &$v11 = null, &$v12 = null, &$v13 = null, &$v14 = null, &$v15 = null, &$v16 = null, &$v17 = null, &$v18 = null, &$v19 = null, &$v20 = null, &$v21 = null, &$v22 = null, &$v23 = null, &$v24 = null, &$v25 = null, &$v26 = null, &$v27 = null, &$v28 = null, &$v29 = null, &$v30 = null, &$v31 = null, &$v32 = null, &$v33 = null, &$v34 = null, &$v35 = null)
170 170
   {
Please login to merge, or discard this patch.
src/voku/db/DB.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
           $this->socket
271 271
       );
272 272
     } catch (\Exception $e) {
273
-      $this->_debug->displayError('Error connecting to mysql server: ' . $e->getMessage(), true);
273
+      $this->_debug->displayError('Error connecting to mysql server: '.$e->getMessage(), true);
274 274
     }
275 275
     mysqli_report(MYSQLI_REPORT_OFF);
276 276
 
277 277
     if (!$this->connected) {
278
-      $this->_debug->displayError('Error connecting to mysql server: ' . mysqli_connect_error(), true);
278
+      $this->_debug->displayError('Error connecting to mysql server: '.mysqli_connect_error(), true);
279 279
     } else {
280 280
       $this->set_charset($this->charset);
281 281
     }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
     static $firstInstance = null;
377 377
 
378 378
     if (
379
-        $hostname . $username . $password . $database . $port . $charset == ''
379
+        $hostname.$username.$password.$database.$port.$charset == ''
380 380
         &&
381 381
         null !== $firstInstance
382 382
     ) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
     }
385 385
 
386 386
     $connection = md5(
387
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . (int)$session_to_db
387
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.(int)$session_to_db
388 388
     );
389 389
 
390 390
     if (!isset($instance[$connection])) {
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
       // "string"
559 559
 
560 560
       if (!in_array($var, $this->mysqlDefaultTimeFunctions, true)) {
561
-        $var = "'" . trim($this->escape(trim(trim((string)$var), "'")), "'") . "'";
561
+        $var = "'".trim($this->escape(trim(trim((string)$var), "'")), "'")."'";
562 562
       }
563 563
 
564 564
     } elseif (is_float($var)) {
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
       // "DateTime"-object
579 579
 
580 580
       try {
581
-        $var = "'" . $this->escape($var->format('Y-m-d H:i:s'), false) . "'";
581
+        $var = "'".$this->escape($var->format('Y-m-d H:i:s'), false)."'";
582 582
       } catch (\Exception $e) {
583 583
         $var = null;
584 584
       }
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
       // fallback ...
589 589
 
590
-      $var = "'" . trim($this->escape(trim(trim((string)$var), "'")), "'") . "'";
590
+      $var = "'".trim($this->escape(trim(trim((string)$var), "'")), "'")."'";
591 591
 
592 592
     }
593 593
 
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
 
728 728
       // exit if we have more then 3 "DB server has gone away"-errors
729 729
       if ($reconnectCounter > 3) {
730
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
730
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
731 731
         throw new \Exception($errorMsg);
732 732
       } else {
733
-        $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
733
+        $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
734 734
 
735 735
         // reconnect
736 736
         $reconnectCounter++;
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
         return $this->query($sql, $sqlParams);
741 741
       }
742 742
     } else {
743
-      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
743
+      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg.":\n<br />".$sql);
744 744
 
745 745
       // this query returned an error, we must display it (only for dev) !!!
746
-      $this->_debug->displayError($errorMsg . ' | ' . $sql);
746
+      $this->_debug->displayError($errorMsg.' | '.$sql);
747 747
     }
748 748
 
749 749
     return false;
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 
812 812
     if ($useCache === true) {
813 813
       $cache = new Cache(null, null, false, $useCache);
814
-      $cacheKey = 'sql-' . md5($query);
814
+      $cacheKey = 'sql-'.md5($query);
815 815
 
816 816
       if (
817 817
           $cache->getCacheIsReady() === true
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
 
874 874
     $return = mysqli_set_charset($this->link, $charset);
875 875
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
876
-    @mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
876
+    @mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
877 877
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
878
-    @mysqli_query($this->link, "SET NAMES '" . ($charset === 'utf8' ? 'utf8mb4' : $charset) . "'");
878
+    @mysqli_query($this->link, "SET NAMES '".($charset === 'utf8' ? 'utf8mb4' : $charset)."'");
879 879
 
880 880
     return $return;
881 881
   }
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
 
961 961
       if ($this->_debug->checkForDev() === true) {
962 962
         echo "Info: maybe you have to increase your 'max_allowed_packet = 30M' in the config: 'my.conf' \n<br />";
963
-        echo 'Error:' . $errorMsg;
963
+        echo 'Error:'.$errorMsg;
964 964
       }
965 965
 
966
-      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg . ":\n<br />" . $sql);
966
+      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg.":\n<br />".$sql);
967 967
     }
968 968
 
969 969
     // return the result only if there was a "SELECT"-query
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
       return false;
1002 1002
     } elseif (mysqli_connect_errno()) {
1003
-      $this->_debug->displayError('Error connecting to mysql server: ' . mysqli_connect_error(), true);
1003
+      $this->_debug->displayError('Error connecting to mysql server: '.mysqli_connect_error(), true);
1004 1004
 
1005 1005
       return false;
1006 1006
     } else {
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
     $SET = $this->_parseArrayPair($data);
1111 1111
 
1112
-    $sql = 'INSERT INTO ' . $this->quote_string($table) . " SET $SET;";
1112
+    $sql = 'INSERT INTO '.$this->quote_string($table)." SET $SET;";
1113 1113
 
1114 1114
     return $this->query($sql);
1115 1115
   }
@@ -1197,9 +1197,9 @@  discard block
 block discarded – undo
1197 1197
           }
1198 1198
 
1199 1199
           if ($_connector === 'NOT IN' || $_connector === 'IN') {
1200
-            $_value = '(' . implode(',', $_value) . ')';
1200
+            $_value = '('.implode(',', $_value).')';
1201 1201
           } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
1202
-            $_value = '(' . implode(' AND ', $_value) . ')';
1202
+            $_value = '('.implode(' AND ', $_value).')';
1203 1203
           }
1204 1204
 
1205 1205
         } else {
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
         }
1208 1208
 
1209 1209
         $quoteString = $this->quote_string(trim(str_ireplace($_connector, '', $_key)));
1210
-        $pairs[] = ' ' . $quoteString . ' ' . $_connector . ' ' . $_value . " \n";
1210
+        $pairs[] = ' '.$quoteString.' '.$_connector.' '.$_value." \n";
1211 1211
       }
1212 1212
 
1213 1213
       $sql = implode($glue, $pairs);
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
    */
1226 1226
   public function quote_string($str)
1227 1227
   {
1228
-    return '`' . $this->escape($str, false) . '`';
1228
+    return '`'.$this->escape($str, false).'`';
1229 1229
   }
1230 1230
 
1231 1231
   /**
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
     }
1280 1280
     $values = implode(',', $data);
1281 1281
 
1282
-    $sql = 'REPLACE INTO ' . $this->quote_string($table) . " ($columns) VALUES ($values);";
1282
+    $sql = 'REPLACE INTO '.$this->quote_string($table)." ($columns) VALUES ($values);";
1283 1283
 
1284 1284
     return $this->query($sql);
1285 1285
   }
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
       $WHERE = '';
1320 1320
     }
1321 1321
 
1322
-    $sql = 'UPDATE ' . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
1322
+    $sql = 'UPDATE '.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
1323 1323
 
1324 1324
     return $this->query($sql);
1325 1325
   }
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
       $WHERE = '';
1352 1352
     }
1353 1353
 
1354
-    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1354
+    $sql = 'DELETE FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1355 1355
 
1356 1356
     return $this->query($sql);
1357 1357
   }
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
       $WHERE = '';
1382 1382
     }
1383 1383
 
1384
-    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1384
+    $sql = 'SELECT * FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1385 1385
 
1386 1386
     return $this->query($sql);
1387 1387
   }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -616,7 +616,7 @@
 block discarded – undo
616 616
    * @param bool  $html_entity_decode
617 617
    * @param bool  $array_to_string
618 618
    *
619
-   * @return array|bool|float|int|string
619
+   * @return string
620 620
    */
621 621
   public function escape($var = '', $stripe_non_utf8 = true, $html_entity_decode = false, $array_to_string = false)
622 622
   {
Please login to merge, or discard this patch.