Completed
Push — master ( d2d838...15d122 )
by Lars
03:19
created
src/voku/db/Result.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -595,7 +595,7 @@
 block discarded – undo
595 595
    *                              parameter)<br>
596 596
    *                              <strong>object</strong>: use a object and fill the the data into
597 597
    *                              </p>
598
-   * @param null|array    $params optional
598
+   * @param string    $params optional
599 599
    *                              <p>
600 600
    *                              An array of parameters to pass to the constructor, used if $class is a
601 601
    *                              string.
Please login to merge, or discard this patch.
src/voku/db/DB.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
         }
439 439
 
440 440
         if ($_connector === 'NOT IN' || $_connector === 'IN') {
441
-          $_value = '(' . implode(',', $_value) . ')';
441
+          $_value = '('.implode(',', $_value).')';
442 442
         } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
443
-          $_value = '(' . implode(' AND ', $_value) . ')';
443
+          $_value = '('.implode(' AND ', $_value).')';
444 444
         }
445 445
 
446 446
       } else {
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
           $_glueHelperInner = 'AND ('; // inner-loop "OR"-query glue
486 486
         }
487 487
 
488
-        $sql .= ' ' . $_glueHelperInner . ' ' . $quoteString . ' ' . $_connector . ' ' . $valueInner . " \n";
488
+        $sql .= ' '.$_glueHelperInner.' '.$quoteString.' '.$_connector.' '.$valueInner." \n";
489 489
         $tmpCounter++;
490 490
       }
491 491
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
       );
680 680
 
681 681
     } catch (\Exception $e) {
682
-      $error = 'Error connecting to mysql server: ' . $e->getMessage();
682
+      $error = 'Error connecting to mysql server: '.$e->getMessage();
683 683
       $this->_debug->displayError($error, true);
684 684
       throw new DBConnectException($error, 100, $e);
685 685
     }
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 
688 688
     $errno = mysqli_connect_errno();
689 689
     if (!$this->connected || $errno) {
690
-      $error = 'Error connecting to mysql server: ' . \mysqli_connect_error() . ' (' . $errno . ')';
690
+      $error = 'Error connecting to mysql server: '.\mysqli_connect_error().' ('.$errno.')';
691 691
       $this->_debug->displayError($error, true);
692 692
       throw new DBConnectException($error, 101);
693 693
     }
@@ -728,10 +728,10 @@  discard block
 block discarded – undo
728 728
     }
729 729
 
730 730
     if ($databaseName) {
731
-      $databaseName = $this->quote_string(trim($databaseName)) . '.';
731
+      $databaseName = $this->quote_string(trim($databaseName)).'.';
732 732
     }
733 733
 
734
-    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
734
+    $sql = 'DELETE FROM '.$databaseName.$this->quote_string($table)." WHERE ($WHERE);";
735 735
 
736 736
     return $this->query($sql);
737 737
   }
@@ -801,8 +801,8 @@  discard block
 block discarded – undo
801 801
         $nameTmp = substr($name, 1);
802 802
       }
803 803
 
804
-      $parseKeyInner = $nameTmp . '-' . $parseKey;
805
-      $sql = str_replace(':' . $nameTmp, $parseKeyInner, $sql);
804
+      $parseKeyInner = $nameTmp.'-'.$parseKey;
805
+      $sql = str_replace(':'.$nameTmp, $parseKeyInner, $sql);
806 806
     }
807 807
 
808 808
     foreach ($params as $name => $value) {
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
         $nameTmp = substr($name, 1);
812 812
       }
813 813
 
814
-      $parseKeyInner = $nameTmp . '-' . $parseKey;
814
+      $parseKeyInner = $nameTmp.'-'.$parseKey;
815 815
       $sqlBefore = $sql;
816 816
 
817 817
       while (strpos($sql, $parseKeyInner) !== false) {
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 
989 989
     if ($useCache === true) {
990 990
       $cache = new Cache(null, null, false, $useCache);
991
-      $cacheKey = 'sql-' . md5($query);
991
+      $cacheKey = 'sql-'.md5($query);
992 992
 
993 993
       if (
994 994
           $cache->getCacheIsReady() === true
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
     static $firstInstance = null;
1099 1099
 
1100 1100
     if (
1101
-        $hostname . $username . $password . $database . $port . $charset == ''
1101
+        $hostname.$username.$password.$database.$port.$charset == ''
1102 1102
         &&
1103 1103
         null !== $firstInstance
1104 1104
     ) {
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
     $extra_config_string = '';
1109 1109
     if (is_array($extra_config) === true) {
1110 1110
       foreach ($extra_config as $extra_config_key => $extra_config_value) {
1111
-        $extra_config_string .= $extra_config_key . (string)$extra_config_value;
1111
+        $extra_config_string .= $extra_config_key.(string)$extra_config_value;
1112 1112
       }
1113 1113
     } else {
1114 1114
       // only for backward compatibility
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
     }
1117 1117
 
1118 1118
     $connection = md5(
1119
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . $extra_config_string
1119
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.$extra_config_string
1120 1120
     );
1121 1121
 
1122 1122
     if (!isset($instance[$connection])) {
@@ -1203,10 +1203,10 @@  discard block
 block discarded – undo
1203 1203
     $SET = $this->_parseArrayPair($data);
1204 1204
 
1205 1205
     if ($databaseName) {
1206
-      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1206
+      $databaseName = $this->quote_string(trim($databaseName)).'.';
1207 1207
     }
1208 1208
 
1209
-    $sql = 'INSERT INTO ' . $databaseName . $this->quote_string($table) . " SET $SET;";
1209
+    $sql = 'INSERT INTO '.$databaseName.$this->quote_string($table)." SET $SET;";
1210 1210
 
1211 1211
     return $this->query($sql);
1212 1212
   }
@@ -1520,11 +1520,11 @@  discard block
 block discarded – undo
1520 1520
 
1521 1521
       // exit if we have more then 3 "DB server has gone away"-errors
1522 1522
       if ($RECONNECT_COUNTER > 3) {
1523
-        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql, 5);
1523
+        $this->_debug->mailToAdmin('DB-Fatal-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql, 5);
1524 1524
         throw new DBGoneAwayException($errorMessage);
1525 1525
       }
1526 1526
 
1527
-      $this->_debug->mailToAdmin('DB-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
1527
+      $this->_debug->mailToAdmin('DB-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
1528 1528
 
1529 1529
       // reconnect
1530 1530
       $RECONNECT_COUNTER++;
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
       return false;
1539 1539
     }
1540 1540
 
1541
-    $this->_debug->mailToAdmin('SQL-Error', $errorMessage . '(' . $errorNumber . ') ' . ":\n<br />" . $sql);
1541
+    $this->_debug->mailToAdmin('SQL-Error', $errorMessage.'('.$errorNumber.') '.":\n<br />".$sql);
1542 1542
 
1543 1543
     $force_exception_after_error = null; // auto
1544 1544
     if ($this->_in_transaction === true) {
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
     }
1547 1547
     // this query returned an error, we must display it (only for dev) !!!
1548 1548
 
1549
-    $this->_debug->displayError($errorMessage . '(' . $errorNumber . ') ' . ' | ' . $sql, $force_exception_after_error);
1549
+    $this->_debug->displayError($errorMessage.'('.$errorNumber.') '.' | '.$sql, $force_exception_after_error);
1550 1550
 
1551 1551
     return false;
1552 1552
   }
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
         )
1570 1570
     );
1571 1571
 
1572
-    return '`' . $str . '`';
1572
+    return '`'.$str.'`';
1573 1573
   }
1574 1574
 
1575 1575
   /**
@@ -1640,10 +1640,10 @@  discard block
 block discarded – undo
1640 1640
     $values = implode(',', $data);
1641 1641
 
1642 1642
     if ($databaseName) {
1643
-      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1643
+      $databaseName = $this->quote_string(trim($databaseName)).'.';
1644 1644
     }
1645 1645
 
1646
-    $sql = 'REPLACE INTO ' . $databaseName . $this->quote_string($table) . " ($columns) VALUES ($values);";
1646
+    $sql = 'REPLACE INTO '.$databaseName.$this->quote_string($table)." ($columns) VALUES ($values);";
1647 1647
 
1648 1648
     return $this->query($sql);
1649 1649
   }
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
     $var = $this->escape($var, false, false, null);
1732 1732
 
1733 1733
     if (is_string($var)) {
1734
-      $var = "'" . trim($var, "'") . "'";
1734
+      $var = "'".trim($var, "'")."'";
1735 1735
     }
1736 1736
 
1737 1737
     return $var;
@@ -1768,10 +1768,10 @@  discard block
 block discarded – undo
1768 1768
     }
1769 1769
 
1770 1770
     if ($databaseName) {
1771
-      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1771
+      $databaseName = $this->quote_string(trim($databaseName)).'.';
1772 1772
     }
1773 1773
 
1774
-    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1774
+    $sql = 'SELECT * FROM '.$databaseName.$this->quote_string($table)." WHERE ($WHERE);";
1775 1775
 
1776 1776
     return $this->query($sql);
1777 1777
   }
@@ -1814,10 +1814,10 @@  discard block
 block discarded – undo
1814 1814
     $return = mysqli_set_charset($this->link, $charset);
1815 1815
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
1816 1816
     /** @noinspection UsageOfSilenceOperatorInspection */
1817
-    @\mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
1817
+    @\mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
1818 1818
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
1819 1819
     /** @noinspection UsageOfSilenceOperatorInspection */
1820
-    @\mysqli_query($this->link, "SET NAMES '" . $charset . "'");
1820
+    @\mysqli_query($this->link, "SET NAMES '".$charset."'");
1821 1821
 
1822 1822
     return $return;
1823 1823
   }
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
       $result = call_user_func($callback, $this);
1946 1946
       if ($result === false) {
1947 1947
         /** @noinspection ThrowRawExceptionInspection */
1948
-        throw new \Exception('call_user_func [' . $callback . '] === false');
1948
+        throw new \Exception('call_user_func ['.$callback.'] === false');
1949 1949
       }
1950 1950
 
1951 1951
       return $this->commit();
@@ -1998,10 +1998,10 @@  discard block
 block discarded – undo
1998 1998
     }
1999 1999
 
2000 2000
     if ($databaseName) {
2001
-      $databaseName = $this->quote_string(trim($databaseName)) . '.';
2001
+      $databaseName = $this->quote_string(trim($databaseName)).'.';
2002 2002
     }
2003 2003
 
2004
-    $sql = 'UPDATE ' . $databaseName . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
2004
+    $sql = 'UPDATE '.$databaseName.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
2005 2005
 
2006 2006
     return $this->query($sql);
2007 2007
   }
@@ -2015,7 +2015,7 @@  discard block
 block discarded – undo
2015 2015
    */
2016 2016
   public function table_exists($table)
2017 2017
   {
2018
-    $check = $this->query('SELECT 1 FROM ' . $this->quote_string($table));
2018
+    $check = $this->query('SELECT 1 FROM '.$this->quote_string($table));
2019 2019
     if (
2020 2020
         $check !== false
2021 2021
         &&
@@ -2039,7 +2039,7 @@  discard block
 block discarded – undo
2039 2039
     if (!empty($tables)) {
2040 2040
       $optimized = 0;
2041 2041
       foreach ($tables as $table) {
2042
-        $optimize = 'OPTIMIZE TABLE `' . trim($table) . '`';
2042
+        $optimize = 'OPTIMIZE TABLE `'.trim($table).'`';
2043 2043
         $this->link->query($optimize);
2044 2044
         if (!$this->link->error) {
2045 2045
           $optimized++;
Please login to merge, or discard this patch.
src/voku/db/ActiveRecordExpressionsWrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
     $delimiter = $this->delimiter ?: ',';
13 13
 
14 14
     if ($this->start) {
15
-      return $this->start . implode($delimiter, $this->target->getArray()) . ($this->end ?: ')');
15
+      return $this->start.implode($delimiter, $this->target->getArray()).($this->end ?: ')');
16 16
     }
17 17
 
18
-    return '(' . implode($delimiter, $this->target->getArray()) . ($this->end ? $this->end : ')');
18
+    return '('.implode($delimiter, $this->target->getArray()).($this->end ? $this->end : ')');
19 19
   }
20 20
 }
Please login to merge, or discard this patch.
src/voku/db/ActiveRecord.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     $value = $this->_filterParam($this->dirty);
379 379
     $this->insert = new ActiveRecordExpressions(
380 380
         array(
381
-            'operator' => 'INSERT INTO ' . $this->table,
381
+            'operator' => 'INSERT INTO '.$this->table,
382 382
             'target'   => new ActiveRecordExpressionsWrap(array('target' => array_keys($this->dirty))),
383 383
         )
384 384
     );
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
         null === $o->$n
557 557
     ) {
558 558
 
559
-      $n = strtoupper($n) . ' ' . $o->table . '.*';
559
+      $n = strtoupper($n).' '.$o->table.'.*';
560 560
 
561 561
     } elseif (
562 562
         (
@@ -568,15 +568,15 @@  discard block
 block discarded – undo
568 568
         null === $o->$n
569 569
     ) {
570 570
 
571
-      $n = strtoupper($n) . ' ' . $o->table;
571
+      $n = strtoupper($n).' '.$o->table;
572 572
 
573 573
     } elseif ('delete' === $n) {
574 574
 
575
-      $n = strtoupper($n) . ' ';
575
+      $n = strtoupper($n).' ';
576 576
 
577 577
     } else {
578 578
 
579
-      $n = (null !== $o->$n) ? $o->$n . ' ' : '';
579
+      $n = (null !== $o->$n) ? $o->$n.' ' : '';
580 580
 
581 581
     }
582 582
   }
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
   {
690 690
     if (is_array($value)) {
691 691
       foreach ($value as $key => $val) {
692
-        $this->params[$value[$key] = self::PREFIX . ++self::$count] = $val;
692
+        $this->params[$value[$key] = self::PREFIX.++self::$count] = $val;
693 693
       }
694 694
     } elseif (is_string($value)) {
695
-      $this->params[$ph = self::PREFIX . ++self::$count] = $value;
695
+      $this->params[$ph = self::PREFIX.++self::$count] = $value;
696 696
       $value = $ph;
697 697
     }
698 698
 
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
     $value = $this->_filterParam($value);
715 715
     $exp = new ActiveRecordExpressions(
716 716
         array(
717
-            'source'   => ('where' == $name ? $this->table . '.' : '') . $field,
717
+            'source'   => ('where' == $name ? $this->table.'.' : '').$field,
718 718
             'operator' => $operator,
719 719
             'target'   => is_array($value)
720 720
                 ? new ActiveRecordExpressionsWrap(
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     $this->join = new ActiveRecordExpressions(
749 749
         array(
750 750
             'source'   => $this->join ?: '',
751
-            'operator' => $type . ' JOIN',
751
+            'operator' => $type.' JOIN',
752 752
             'target'   => new ActiveRecordExpressions(
753 753
                 array('source' => $table, 'operator' => 'ON', 'target' => $on)
754 754
             ),
Please login to merge, or discard this patch.