Completed
Push — master ( a637a0...44fe92 )
by Lars
04:29 queued 01:28
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/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 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
           $this->socket
273 273
       );
274 274
     } catch (\Exception $e) {
275
-      $this->_debug->displayError('Error connecting to mysql server: ' . $e->getMessage(), true);
275
+      $this->_debug->displayError('Error connecting to mysql server: '.$e->getMessage(), true);
276 276
     }
277 277
     mysqli_report(MYSQLI_REPORT_OFF);
278 278
 
279 279
     if (!$this->connected) {
280
-      $this->_debug->displayError('Error connecting to mysql server: ' . mysqli_connect_error(), true);
280
+      $this->_debug->displayError('Error connecting to mysql server: '.mysqli_connect_error(), true);
281 281
     } else {
282 282
       $this->set_charset($this->charset);
283 283
     }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     static $firstInstance = null;
373 373
 
374 374
     if (
375
-        $hostname . $username . $password . $database . $port . $charset == ''
375
+        $hostname.$username.$password.$database.$port.$charset == ''
376 376
         &&
377 377
         null !== $firstInstance
378 378
     ) {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     }
381 381
 
382 382
     $connection = md5(
383
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . (int)$session_to_db
383
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.(int)$session_to_db
384 384
     );
385 385
 
386 386
     if (!isset($instance[$connection])) {
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
     $var = $this->escape($var, false, false, null);
571 571
 
572 572
     if (is_string($var)) {
573
-      $var = "'" . trim($var, "'") . "'";
573
+      $var = "'".trim($var, "'")."'";
574 574
     }
575 575
 
576 576
     return $var;
@@ -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
   }
@@ -950,10 +950,10 @@  discard block
 block discarded – undo
950 950
 
951 951
       if ($this->_debug->checkForDev() === true) {
952 952
         echo "Info: maybe you have to increase your 'max_allowed_packet = 30M' in the config: 'my.conf' \n<br />";
953
-        echo 'Error:' . $errorMsg;
953
+        echo 'Error:'.$errorMsg;
954 954
       }
955 955
 
956
-      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg . ":\n<br />" . $sql);
956
+      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg.":\n<br />".$sql);
957 957
     }
958 958
 
959 959
     // return the result only if there was a "SELECT"-query
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
       return false;
992 992
     } elseif (mysqli_connect_errno()) {
993
-      $this->_debug->displayError('Error connecting to mysql server: ' . mysqli_connect_error(), true);
993
+      $this->_debug->displayError('Error connecting to mysql server: '.mysqli_connect_error(), true);
994 994
 
995 995
       return false;
996 996
     } else {
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
     $SET = $this->_parseArrayPair($data);
1101 1101
 
1102
-    $sql = 'INSERT INTO ' . $this->quote_string($table) . " SET $SET;";
1102
+    $sql = 'INSERT INTO '.$this->quote_string($table)." SET $SET;";
1103 1103
 
1104 1104
     return $this->query($sql);
1105 1105
   }
@@ -1187,9 +1187,9 @@  discard block
 block discarded – undo
1187 1187
           }
1188 1188
 
1189 1189
           if ($_connector === 'NOT IN' || $_connector === 'IN') {
1190
-            $_value = '(' . implode(',', $_value) . ')';
1190
+            $_value = '('.implode(',', $_value).')';
1191 1191
           } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
1192
-            $_value = '(' . implode(' AND ', $_value) . ')';
1192
+            $_value = '('.implode(' AND ', $_value).')';
1193 1193
           }
1194 1194
 
1195 1195
         } else {
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
         }
1198 1198
 
1199 1199
         $quoteString = $this->quote_string(trim(str_ireplace($_connector, '', $_key)));
1200
-        $pairs[] = ' ' . $quoteString . ' ' . $_connector . ' ' . $_value . " \n";
1200
+        $pairs[] = ' '.$quoteString.' '.$_connector.' '.$_value." \n";
1201 1201
       }
1202 1202
 
1203 1203
       $sql = implode($glue, $pairs);
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
    */
1216 1216
   public function quote_string($str)
1217 1217
   {
1218
-    return '`' . $this->escape($str, false) . '`';
1218
+    return '`'.$this->escape($str, false).'`';
1219 1219
   }
1220 1220
 
1221 1221
   /**
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
     }
1270 1270
     $values = implode(',', $data);
1271 1271
 
1272
-    $sql = 'REPLACE INTO ' . $this->quote_string($table) . " ($columns) VALUES ($values);";
1272
+    $sql = 'REPLACE INTO '.$this->quote_string($table)." ($columns) VALUES ($values);";
1273 1273
 
1274 1274
     return $this->query($sql);
1275 1275
   }
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
       $WHERE = '';
1310 1310
     }
1311 1311
 
1312
-    $sql = 'UPDATE ' . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
1312
+    $sql = 'UPDATE '.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
1313 1313
 
1314 1314
     return $this->query($sql);
1315 1315
   }
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
       $WHERE = '';
1342 1342
     }
1343 1343
 
1344
-    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1344
+    $sql = 'DELETE FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1345 1345
 
1346 1346
     return $this->query($sql);
1347 1347
   }
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
       $WHERE = '';
1372 1372
     }
1373 1373
 
1374
-    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1374
+    $sql = 'SELECT * FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1375 1375
 
1376 1376
     return $this->query($sql);
1377 1377
   }
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
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
       return array();
62 62
     }
63 63
 
64
-    $sql = 'SHOW COLUMNS FROM ' . $db->quote_string($table);
64
+    $sql = 'SHOW COLUMNS FROM '.$db->quote_string($table);
65 65
     $result = $db->query($sql);
66 66
 
67 67
     if ($result && $result->num_rows > 0) {
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 
107 107
     $whereSQL = '';
108 108
     foreach ($whereArray as $key => $value) {
109
-      $whereSQL .= ' AND ' . $db->escape($key) . ' = ' . $db->escape($value);
109
+      $whereSQL .= ' AND '.$db->escape($key).' = '.$db->escape($value);
110 110
     }
111 111
 
112 112
     // get the row
113
-    $query = 'SELECT * FROM ' . $db->quote_string($table) . '
113
+    $query = 'SELECT * FROM '.$db->quote_string($table).'
114 114
       WHERE 1 = 1
115
-      ' . $whereSQL . '
115
+      ' . $whereSQL.'
116 116
     ';
117 117
     $result = $db->query($query);
118 118
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 
131 131
           if (!in_array($fieldName, $ignoreArray, true)) {
132 132
             if (array_key_exists($fieldName, $updateArray)) {
133
-              $insert_keys .= ',' . $fieldName;
133
+              $insert_keys .= ','.$fieldName;
134 134
               $insert_values .= ',?';
135 135
               $bindings[] = $db->escape($updateArray[$fieldName]);
136 136
             } else {
137
-              $insert_keys .= ',' . $fieldName;
137
+              $insert_keys .= ','.$fieldName;
138 138
               $insert_values .= ',?';
139 139
               $bindings[] = $db->escape($value);
140 140
             }
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
         $insert_values = ltrim($insert_values, ',');
146 146
 
147 147
         // insert the "copied" row
148
-        $new_query = 'INSERT INTO ' . $db->quote_string($table) . ' (' . $insert_keys . ')
149
-          VALUES (' . $insert_values . ')
148
+        $new_query = 'INSERT INTO '.$db->quote_string($table).' ('.$insert_keys.')
149
+          VALUES (' . $insert_values.')
150 150
         ';
151 151
         return $db->query($new_query, $bindings);
152 152
       }
Please login to merge, or discard this patch.