Completed
Push — master ( b1b517...89387e )
by Lars
16:05 queued 40s
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
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.
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
     } else if ($type === 'i') {
107 107
       $valueForSqlWithBoundParameters = (int)$value;
108 108
     } else if ($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,
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     $bool = parent::prepare($query);
324 324
 
325 325
     if ($bool === false) {
326
-      $this->_debug->displayError('Can\'t prepare Query: ' . $query . ' | ' . $this->error, false);
326
+      $this->_debug->displayError('Can\'t prepare Query: '.$query.' | '.$this->error, false);
327 327
     }
328 328
 
329 329
     return true;
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 
411 411
       // exit if we have more then 3 "DB server has gone away"-errors
412 412
       if ($reconnectCounter > 3) {
413
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
413
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
414 414
         throw new \Exception($errorMsg);
415 415
       } else {
416
-        $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
416
+        $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
417 417
 
418 418
         // reconnect
419 419
         $reconnectCounter++;
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
         return $this->execute();
424 424
       }
425 425
     } else {
426
-      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
426
+      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg.":\n<br />".$sql);
427 427
 
428 428
       // this query returned an error, we must display it (only for dev) !!!
429
-      $this->_debug->displayError($errorMsg . ' | ' . $sql);
429
+      $this->_debug->displayError($errorMsg.' | '.$sql);
430 430
     }
431 431
 
432 432
     return false;
Please login to merge, or discard this patch.
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   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
           $this->socket
278 278
       );
279 279
     } catch (\Exception $e) {
280
-      $this->_debug->displayError('Error connecting to mysql server: ' . $e->getMessage(), true);
280
+      $this->_debug->displayError('Error connecting to mysql server: '.$e->getMessage(), true);
281 281
     }
282 282
     \mysqli_report(MYSQLI_REPORT_OFF);
283 283
 
284 284
     if (!$this->connected) {
285
-      $this->_debug->displayError('Error connecting to mysql server: ' . \mysqli_connect_error(), true);
285
+      $this->_debug->displayError('Error connecting to mysql server: '.\mysqli_connect_error(), true);
286 286
     } else {
287 287
       $this->set_charset($this->charset);
288 288
     }
@@ -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])) {
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
     $var = $this->escape($var, false, false, null);
593 593
 
594 594
     if (is_string($var)) {
595
-      $var = "'" . trim($var, "'") . "'";
595
+      $var = "'".trim($var, "'")."'";
596 596
     }
597 597
 
598 598
     return $var;
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 
761 761
       // exit if we have more then 3 "DB server has gone away"-errors
762 762
       if ($reconnectCounter > 3) {
763
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
763
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
764 764
         throw new \Exception($errorMsg);
765 765
       } else {
766
-        $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
766
+        $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
767 767
 
768 768
         // reconnect
769 769
         $reconnectCounter++;
@@ -773,10 +773,10 @@  discard block
 block discarded – undo
773 773
         return $this->query($sql, $sqlParams);
774 774
       }
775 775
     } else {
776
-      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
776
+      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg.":\n<br />".$sql);
777 777
 
778 778
       // this query returned an error, we must display it (only for dev) !!!
779
-      $this->_debug->displayError($errorMsg . ' | ' . $sql);
779
+      $this->_debug->displayError($errorMsg.' | '.$sql);
780 780
     }
781 781
 
782 782
     return false;
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 
845 845
     if ($useCache === true) {
846 846
       $cache = new Cache(null, null, false, $useCache);
847
-      $cacheKey = 'sql-' . md5($query);
847
+      $cacheKey = 'sql-'.md5($query);
848 848
 
849 849
       if (
850 850
           $cache->getCacheIsReady() === true
@@ -914,9 +914,9 @@  discard block
 block discarded – undo
914 914
 
915 915
     $return = mysqli_set_charset($this->link, $charset);
916 916
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
917
-    @\mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
917
+    @\mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
918 918
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
919
-    @\mysqli_query($this->link, "SET NAMES '" . $charset . "'");
919
+    @\mysqli_query($this->link, "SET NAMES '".$charset."'");
920 920
 
921 921
     return $return;
922 922
   }
@@ -1003,10 +1003,10 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
       if ($this->_debug->checkForDev() === true) {
1005 1005
         echo "Info: maybe you have to increase your 'max_allowed_packet = 30M' in the config: 'my.conf' \n<br />";
1006
-        echo 'Error:' . $errorMsg;
1006
+        echo 'Error:'.$errorMsg;
1007 1007
       }
1008 1008
 
1009
-      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg . ":\n<br />" . $sql);
1009
+      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg.":\n<br />".$sql);
1010 1010
     }
1011 1011
 
1012 1012
     // return the result only if there was a "SELECT"-query
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
       return false;
1045 1045
     } elseif (\mysqli_connect_errno()) {
1046
-      $this->_debug->displayError('Error connecting to mysql server: ' . \mysqli_connect_error(), true);
1046
+      $this->_debug->displayError('Error connecting to mysql server: '.\mysqli_connect_error(), true);
1047 1047
 
1048 1048
       return false;
1049 1049
     } else {
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
     $SET = $this->_parseArrayPair($data);
1154 1154
 
1155
-    $sql = 'INSERT INTO ' . $this->quote_string($table) . " SET $SET;";
1155
+    $sql = 'INSERT INTO '.$this->quote_string($table)." SET $SET;";
1156 1156
 
1157 1157
     return $this->query($sql);
1158 1158
   }
@@ -1240,9 +1240,9 @@  discard block
 block discarded – undo
1240 1240
           }
1241 1241
 
1242 1242
           if ($_connector === 'NOT IN' || $_connector === 'IN') {
1243
-            $_value = '(' . implode(',', $_value) . ')';
1243
+            $_value = '('.implode(',', $_value).')';
1244 1244
           } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
1245
-            $_value = '(' . implode(' AND ', $_value) . ')';
1245
+            $_value = '('.implode(' AND ', $_value).')';
1246 1246
           }
1247 1247
 
1248 1248
         } else {
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
         }
1251 1251
 
1252 1252
         $quoteString = $this->quote_string(trim(str_ireplace($_connector, '', $_key)));
1253
-        $pairs[] = ' ' . $quoteString . ' ' . $_connector . ' ' . $_value . " \n";
1253
+        $pairs[] = ' '.$quoteString.' '.$_connector.' '.$_value." \n";
1254 1254
       }
1255 1255
 
1256 1256
       $sql = implode($glue, $pairs);
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
    */
1269 1269
   public function quote_string($str)
1270 1270
   {
1271
-    return '`' . $this->escape($str, false) . '`';
1271
+    return '`'.$this->escape($str, false).'`';
1272 1272
   }
1273 1273
 
1274 1274
   /**
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
     }
1323 1323
     $values = implode(',', $data);
1324 1324
 
1325
-    $sql = 'REPLACE INTO ' . $this->quote_string($table) . " ($columns) VALUES ($values);";
1325
+    $sql = 'REPLACE INTO '.$this->quote_string($table)." ($columns) VALUES ($values);";
1326 1326
 
1327 1327
     return $this->query($sql);
1328 1328
   }
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
       $WHERE = '';
1363 1363
     }
1364 1364
 
1365
-    $sql = 'UPDATE ' . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
1365
+    $sql = 'UPDATE '.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
1366 1366
 
1367 1367
     return $this->query($sql);
1368 1368
   }
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
       $WHERE = '';
1395 1395
     }
1396 1396
 
1397
-    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1397
+    $sql = 'DELETE FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1398 1398
 
1399 1399
     return $this->query($sql);
1400 1400
   }
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
       $WHERE = '';
1425 1425
     }
1426 1426
 
1427
-    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1427
+    $sql = 'SELECT * FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1428 1428
 
1429 1429
     return $this->query($sql);
1430 1430
   }
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.