Completed
Push — master ( 6adf9a...a068ee )
by Lars
06:53
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   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
           $this->socket
283 283
       );
284 284
     } catch (\Exception $e) {
285
-      $this->_debug->displayError('Error connecting to mysql server: ' . $e->getMessage(), true);
285
+      $this->_debug->displayError('Error connecting to mysql server: '.$e->getMessage(), true);
286 286
     }
287 287
     \mysqli_report(MYSQLI_REPORT_OFF);
288 288
 
289 289
     if (!$this->connected) {
290
-      $this->_debug->displayError('Error connecting to mysql server: ' . \mysqli_connect_error(), true);
290
+      $this->_debug->displayError('Error connecting to mysql server: '.\mysqli_connect_error(), true);
291 291
     } else {
292 292
       $this->set_charset($this->charset);
293 293
     }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     static $firstInstance = null;
383 383
 
384 384
     if (
385
-        $hostname . $username . $password . $database . $port . $charset == ''
385
+        $hostname.$username.$password.$database.$port.$charset == ''
386 386
         &&
387 387
         null !== $firstInstance
388 388
     ) {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     }
391 391
 
392 392
     $connection = md5(
393
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . (int)$session_to_db
393
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.(int)$session_to_db
394 394
     );
395 395
 
396 396
     if (!isset($instance[$connection])) {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
     $var = $this->escape($var, false, false, null);
601 601
 
602 602
     if (is_string($var)) {
603
-      $var = "'" . trim($var, "'") . "'";
603
+      $var = "'".trim($var, "'")."'";
604 604
     }
605 605
 
606 606
     return $var;
@@ -786,11 +786,11 @@  discard block
 block discarded – undo
786 786
 
787 787
       // exit if we have more then 3 "DB server has gone away"-errors
788 788
       if ($reconnectCounter > 3) {
789
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
789
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
790 790
         throw new \Exception($errorMsg);
791 791
       }
792 792
 
793
-      $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
793
+      $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
794 794
 
795 795
       // reconnect
796 796
       $reconnectCounter++;
@@ -800,10 +800,10 @@  discard block
 block discarded – undo
800 800
       return $this->query($sql, $sqlParams);
801 801
     }
802 802
 
803
-    $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
803
+    $this->_debug->mailToAdmin('SQL-Warning', $errorMsg.":\n<br />".$sql);
804 804
 
805 805
     // this query returned an error, we must display it (only for dev) !!!
806
-    $this->_debug->displayError($errorMsg . ' | ' . $sql);
806
+    $this->_debug->displayError($errorMsg.' | '.$sql);
807 807
 
808 808
     return false;
809 809
   }
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 
871 871
     if ($useCache === true) {
872 872
       $cache = new Cache(null, null, false, $useCache);
873
-      $cacheKey = 'sql-' . md5($query);
873
+      $cacheKey = 'sql-'.md5($query);
874 874
 
875 875
       if (
876 876
           $cache->getCacheIsReady() === true
@@ -985,9 +985,9 @@  discard block
 block discarded – undo
985 985
 
986 986
     $return = mysqli_set_charset($this->link, $charset);
987 987
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
988
-    @\mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
988
+    @\mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
989 989
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
990
-    @\mysqli_query($this->link, "SET NAMES '" . $charset . "'");
990
+    @\mysqli_query($this->link, "SET NAMES '".$charset."'");
991 991
 
992 992
     return $return;
993 993
   }
@@ -1074,10 +1074,10 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
       if ($this->_debug->checkForDev() === true) {
1076 1076
         echo "Info: maybe you have to increase your 'max_allowed_packet = 30M' in the config: 'my.conf' \n<br />";
1077
-        echo 'Error:' . $errorMsg;
1077
+        echo 'Error:'.$errorMsg;
1078 1078
       }
1079 1079
 
1080
-      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg . ":\n<br />" . $sql);
1080
+      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg.":\n<br />".$sql);
1081 1081
     }
1082 1082
 
1083 1083
     // return the result only if there was a "SELECT"-query
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
     }
1117 1117
 
1118 1118
     if (\mysqli_connect_errno()) {
1119
-      $this->_debug->displayError('Error connecting to mysql server: ' . \mysqli_connect_error(), true);
1119
+      $this->_debug->displayError('Error connecting to mysql server: '.\mysqli_connect_error(), true);
1120 1120
 
1121 1121
       return false;
1122 1122
     }
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
     $SET = $this->_parseArrayPair($data);
1226 1226
 
1227
-    $sql = 'INSERT INTO ' . $this->quote_string($table) . " SET $SET;";
1227
+    $sql = 'INSERT INTO '.$this->quote_string($table)." SET $SET;";
1228 1228
 
1229 1229
     return $this->query($sql);
1230 1230
   }
@@ -1312,9 +1312,9 @@  discard block
 block discarded – undo
1312 1312
           }
1313 1313
 
1314 1314
           if ($_connector === 'NOT IN' || $_connector === 'IN') {
1315
-            $_value = '(' . implode(',', $_value) . ')';
1315
+            $_value = '('.implode(',', $_value).')';
1316 1316
           } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
1317
-            $_value = '(' . implode(' AND ', $_value) . ')';
1317
+            $_value = '('.implode(' AND ', $_value).')';
1318 1318
           }
1319 1319
 
1320 1320
         } else {
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
         }
1323 1323
 
1324 1324
         $quoteString = $this->quote_string(trim(str_ireplace($_connector, '', $_key)));
1325
-        $pairs[] = ' ' . $quoteString . ' ' . $_connector . ' ' . $_value . " \n";
1325
+        $pairs[] = ' '.$quoteString.' '.$_connector.' '.$_value." \n";
1326 1326
       }
1327 1327
 
1328 1328
       $sql = implode($glue, $pairs);
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
    */
1341 1341
   public function quote_string($str)
1342 1342
   {
1343
-    $str= str_replace(
1343
+    $str = str_replace(
1344 1344
         '`',
1345 1345
         '``',
1346 1346
         trim(
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
         )
1350 1350
     );
1351 1351
 
1352
-    return '`' . $str . '`';
1352
+    return '`'.$str.'`';
1353 1353
   }
1354 1354
 
1355 1355
   /**
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
     }
1404 1404
     $values = implode(',', $data);
1405 1405
 
1406
-    $sql = 'REPLACE INTO ' . $this->quote_string($table) . " ($columns) VALUES ($values);";
1406
+    $sql = 'REPLACE INTO '.$this->quote_string($table)." ($columns) VALUES ($values);";
1407 1407
 
1408 1408
     return $this->query($sql);
1409 1409
   }
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
       $WHERE = '';
1444 1444
     }
1445 1445
 
1446
-    $sql = 'UPDATE ' . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
1446
+    $sql = 'UPDATE '.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
1447 1447
 
1448 1448
     return $this->query($sql);
1449 1449
   }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
       $WHERE = '';
1476 1476
     }
1477 1477
 
1478
-    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1478
+    $sql = 'DELETE FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1479 1479
 
1480 1480
     return $this->query($sql);
1481 1481
   }
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
       $WHERE = '';
1506 1506
     }
1507 1507
 
1508
-    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1508
+    $sql = 'SELECT * FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1509 1509
 
1510 1510
     return $this->query($sql);
1511 1511
   }
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
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
       return array();
145 145
     }
146 146
 
147
-    $sql = 'SHOW COLUMNS FROM ' . $db->escape($table);
147
+    $sql = 'SHOW COLUMNS FROM '.$db->escape($table);
148 148
     $result = $db->query($sql);
149 149
 
150 150
     if ($result && $result->num_rows > 0) {
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 
190 190
     $whereSQL = '';
191 191
     foreach ($whereArray as $key => $value) {
192
-      $whereSQL .= ' AND ' . $db->escape($key) . ' = ' . $db->escape($value);
192
+      $whereSQL .= ' AND '.$db->escape($key).' = '.$db->escape($value);
193 193
     }
194 194
 
195 195
     // get the row
196
-    $query = 'SELECT * FROM ' . $db->quote_string($table) . '
196
+    $query = 'SELECT * FROM '.$db->quote_string($table).'
197 197
       WHERE 1 = 1
198
-      ' . $whereSQL . '
198
+      ' . $whereSQL.'
199 199
     ';
200 200
     $result = $db->query($query);
201 201
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 
215 215
           if (!in_array($fieldName, $ignoreArray, true)) {
216 216
             if (array_key_exists($fieldName, $updateArray)) {
217
-              $insert_keys .= ',' . $fieldName;
217
+              $insert_keys .= ','.$fieldName;
218 218
               $insert_values .= ',?';
219 219
               $bindings[] = $updateArray[$fieldName]; // INFO: do not escape non selected data
220 220
             } else {
221
-              $insert_keys .= ',' . $fieldName;
221
+              $insert_keys .= ','.$fieldName;
222 222
               $insert_values .= ',?';
223 223
               $bindings[] = $value; // INFO: do not escape non selected data
224 224
             }
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
         $insert_values = ltrim($insert_values, ',');
230 230
 
231 231
         // insert the "copied" row
232
-        $new_query = 'INSERT INTO ' . $db->quote_string($table) . ' (' . $insert_keys . ')
233
-          VALUES (' . $insert_values . ')
232
+        $new_query = 'INSERT INTO '.$db->quote_string($table).' ('.$insert_keys.')
233
+          VALUES (' . $insert_values.')
234 234
         ';
235 235
         return $db->query($new_query, $bindings);
236 236
       }
Please login to merge, or discard this patch.
src/voku/db/Prepare.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@
 block discarded – undo
170 170
    * @param mixed  $v34
171 171
    * @param mixed  $v35
172 172
    *
173
-   * @return mixed
173
+   * @return boolean
174 174
    */
175 175
   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)
176 176
   {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     foreach ($this->_boundParams as $param) {
81 81
       $arguments[0] .= $param['type'];
82
-      $arguments[] =& $param['value'];
82
+      $arguments[] = & $param['value'];
83 83
     }
84 84
 
85 85
     return $arguments;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     $value = $this->_db->escape($value);
103 103
 
104 104
     if ($type === 's') {
105
-      $valueForSqlWithBoundParameters = "'" . $value . "'";
105
+      $valueForSqlWithBoundParameters = "'".$value."'";
106 106
     } elseif ($type === 'i') {
107 107
       $valueForSqlWithBoundParameters = (int)$value;
108 108
     } elseif ($type === 'd') {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
       $trace = debug_backtrace();
184 184
     }
185 185
 
186
-    $args =& $trace[0]['args'];
186
+    $args = & $trace[0]['args'];
187 187
     $types = str_split($types);
188 188
 
189 189
     $args_count = count($args) - 1;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     $arg = 1;
199 199
     foreach ($types as $typeInner) {
200
-      $val =& $args[$arg];
200
+      $val = & $args[$arg];
201 201
       $this->_boundParams[] = array(
202 202
           'type'  => $typeInner,
203 203
           'value' => &$val,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     $bool = parent::prepare($query);
334 334
 
335 335
     if ($bool === false) {
336
-      $this->_debug->displayError('Can\'t prepare Query: ' . $query . ' | ' . $this->error, false);
336
+      $this->_debug->displayError('Can\'t prepare Query: '.$query.' | '.$this->error, false);
337 337
     }
338 338
 
339 339
     return true;
@@ -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 ($reconnectCounter > 3) {
423
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
423
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
424 424
         throw new \Exception($errorMsg);
425 425
       }
426 426
 
427
-      $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
427
+      $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
428 428
 
429 429
       // reconnect
430 430
       $reconnectCounter++;
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
       return $this->execute();
435 435
     }
436 436
 
437
-    $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
437
+    $this->_debug->mailToAdmin('SQL-Warning', $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.
src/voku/db/Result.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@
 block discarded – undo
336 336
    * Fetch as object.
337 337
    *
338 338
    * @param string     $class
339
-   * @param null|array $params
339
+   * @param string $params
340 340
    * @param bool       $reset
341 341
    *
342 342
    * @return object|false false on error
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
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     $this->logger(
134 134
         array(
135 135
             'error',
136
-            '<strong>' . date(
136
+            '<strong>'.date(
137 137
                 'd. m. Y G:i:s'
138
-            ) . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . ') (sql-error):</strong> ' . $error . '<br>',
138
+            ).' ('.$fileInfo['file'].' line: '.$fileInfo['line'].') (sql-error):</strong> '.$error.'<br>',
139 139
         )
140 140
     );
141 141
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
         $box_bg = $this->css_mysql_box_bg;
149 149
 
150 150
         echo '
151
-        <div class="OBJ-mysql-box" style="border:' . $box_border . '; background:' . $box_bg . '; padding:10px; margin:10px;">
151
+        <div class="OBJ-mysql-box" style="border:' . $box_border.'; background:'.$box_bg.'; padding:10px; margin:10px;">
152 152
           <b style="font-size:14px;">MYSQL Error:</b>
153 153
           <code style="display:block;">
154
-            file / line: ' . $fileInfo['file'] . ' / ' . $fileInfo['line'] . '
155
-            ' . $error . '
154
+            file / line: ' . $fileInfo['file'].' / '.$fileInfo['line'].'
155
+            ' . $error.'
156 156
           </code>
157 157
         </div>
158 158
         ';
@@ -293,21 +293,21 @@  discard block
 block discarded – undo
293 293
     // get extra info
294 294
     $infoExtra = \mysqli_info($this->_db->getLink());
295 295
     if ($infoExtra) {
296
-      $infoExtra = ' | info => ' . $infoExtra;
296
+      $infoExtra = ' | info => '.$infoExtra;
297 297
     }
298 298
 
299 299
     //
300 300
     // logging
301 301
     //
302 302
 
303
-    $info = 'time => ' . round($duration, 5) . ' | results => ' . (int)$results . $infoExtra . ' | SQL => ' . UTF8::htmlentities($sql);
303
+    $info = 'time => '.round($duration, 5).' | results => '.(int)$results.$infoExtra.' | SQL => '.UTF8::htmlentities($sql);
304 304
 
305 305
     $fileInfo = $this->getFileAndLineFromSql();
306 306
 
307 307
     return $this->logger(
308 308
         array(
309 309
             $logLevel,
310
-            '<strong>' . date('d. m. Y G:i:s') . ' (' . $fileInfo['file'] . ' line: ' . $fileInfo['line'] . '):</strong> ' . $info . '<br>',
310
+            '<strong>'.date('d. m. Y G:i:s').' ('.$fileInfo['file'].' line: '.$fileInfo['line'].'):</strong> '.$info.'<br>',
311 311
             'sql',
312 312
         )
313 313
     );
@@ -373,21 +373,21 @@  discard block
 block discarded – undo
373 373
         $this->logger(
374 374
             array(
375 375
                 'debug',
376
-                $subject . ' | ' . $htmlBody,
376
+                $subject.' | '.$htmlBody,
377 377
             )
378 378
         );
379 379
       } elseif ($priority > 3) {
380 380
         $this->logger(
381 381
             array(
382 382
                 'error',
383
-                $subject . ' | ' . $htmlBody,
383
+                $subject.' | '.$htmlBody,
384 384
             )
385 385
         );
386 386
       } elseif ($priority < 3) {
387 387
         $this->logger(
388 388
             array(
389 389
                 'info',
390
-                $subject . ' | ' . $htmlBody,
390
+                $subject.' | '.$htmlBody,
391 391
             )
392 392
         );
393 393
       }
Please login to merge, or discard this patch.