diff --git a/core/DataTable.php b/core/DataTable.php index a5590e1cbb619a3a1da65552780f15c1048aa8d7..13f7f1e3ffeb39d64a3612c6c0917eeb9af42355 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -588,14 +588,13 @@ class Piwik_DataTable */ public function getRowsCount() { - $count = count($this->rows); if(is_null($this->summaryRow)) { - return $count; + return count($this->rows); } else { - return $count + 1; + return count($this->rows) + 1; } } @@ -820,10 +819,7 @@ class Piwik_DataTable $table1->rebuildIndex(); $table2->rebuildIndex(); - $countrows1 = $table1->getRowsCount(); - $countrows2 = $table2->getRowsCount(); - - if($countrows1 != $countrows2) + if($table1->getRowsCount() != $table2->getRowsCount()) { return false; } @@ -831,11 +827,8 @@ class Piwik_DataTable foreach($rows1 as $row1) { $row2 = $table2->getRowFromLabel($row1->getColumn('label')); - if($row2 === false) - { - return false; - } - if( !Piwik_DataTable_Row::isEqual($row1,$row2) ) + if($row2 === false + || !Piwik_DataTable_Row::isEqual($row1,$row2)) { return false; } diff --git a/core/Log.php b/core/Log.php index 0be03c98d08e21d505c7d61ee3eeb05f7d6793df..ca477bec44e1c3d8ac164de75582cd7e09b86d64 100644 --- a/core/Log.php +++ b/core/Log.php @@ -139,8 +139,7 @@ class Piwik_Log_Formatter_FileFormatter implements Zend_Log_Formatter_Interface } $ts = $event['timestamp']; unset($event['timestamp']); - $str = $ts . ' ' . implode(" ", $event) . "\n"; - return $str; + return $ts . ' ' . implode(" ", $event) . "\n"; } } @@ -156,11 +155,10 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac // no injection in error messages, backtrace when displayed on screen return array_map('htmlspecialchars', $event); } - + function format($string) { - $string = self::getFormattedString($string); - return $string; + return self::getFormattedString($string); } static public function getFormattedString($string) diff --git a/core/Period.php b/core/Period.php index 7fd59b84e84a9458942b79e3026b3e64307edbea..a8c880f32ff589710c6dd56e27fc3f3c3665f4ee 100644 --- a/core/Period.php +++ b/core/Period.php @@ -221,8 +221,7 @@ abstract class Piwik_Period public function __toString() { - $elements = $this->toString(); - return implode(",", $elements); + return implode(",", $this->toString()); } public function get( $part= null ) diff --git a/core/PluginsManager.php b/core/PluginsManager.php index 5e2c3e20d7f758b15eaf71cb3ed4840963b1119d..3c64ef012f55d84a591c622c199fb5b63eee1f43 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -192,9 +192,7 @@ class Piwik_PluginsManager */ public function getLoadedPluginsName() { - $oPlugins = $this->getLoadedPlugins(); - $pluginNames = array_map('get_class',$oPlugins); - return $pluginNames; + return array_map('get_class', $this->getLoadedPlugins()); } /** diff --git a/core/TablePartitioning.php b/core/TablePartitioning.php index 1edcbb4ef4704fb583810142451107935969dfa0..d74eefff3be12d1e3a280681df9e67a9290bfd55 100644 --- a/core/TablePartitioning.php +++ b/core/TablePartitioning.php @@ -108,11 +108,7 @@ class Piwik_TablePartitioning_Monthly extends Piwik_TablePartitioning protected function generateTableName() { $config = Zend_Registry::get('config'); - $prefixTables = $config->database->tables_prefix; - - $date = date("Y_m", $this->timestamp); - - return $prefixTables . $this->tableName . "_" . $date; + return $config->database->tables_prefix . $this->tableName . "_" . date("Y_m", $this->timestamp); } } @@ -131,10 +127,6 @@ class Piwik_TablePartitioning_Daily extends Piwik_TablePartitioning protected function generateTableName() { $config = Zend_Registry::get('config'); - $prefixTables = $config->database->tables_prefix; - - $date = date("Y_m_d", $this->timestamp); - - return $prefixTables . $this->tableName . "_" . $date; + return $config->database->tables_prefix . $this->tableName . "_" . date("Y_m_d", $this->timestamp); } }