diff options
Diffstat (limited to 'core/DataTable/Filter/ReplaceColumnNames.php')
-rw-r--r-- | core/DataTable/Filter/ReplaceColumnNames.php | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php index c2b2beca79..abf802b82a 100644 --- a/core/DataTable/Filter/ReplaceColumnNames.php +++ b/core/DataTable/Filter/ReplaceColumnNames.php @@ -8,8 +8,14 @@ * @category Piwik * @package Piwik */ +namespace Piwik\DataTable\Filter; + +use Piwik\DataTable\Filter; +use Piwik\DataTable\Simple; use Piwik\Metrics; use Piwik\Piwik; +use Piwik\DataTable; +use Piwik_Tracker_GoalManager; /** * This filter replaces column names using a mapping table that maps from the old name to the new name. @@ -24,14 +30,14 @@ use Piwik\Piwik; * You can specify the mapping array to apply in the constructor. * * @package Piwik - * @subpackage Piwik_DataTable + * @subpackage DataTable */ -class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter +class ReplaceColumnNames extends Filter { protected $mappingToApply; /** - * @param Piwik_DataTable $table Table + * @param DataTable $table Table * @param array $mappingToApply Mapping to apply. Must have the format * array( OLD_COLUMN_NAME => NEW_COLUMN NAME, * OLD_COLUMN_NAME2 => NEW_COLUMN NAME2, @@ -49,11 +55,11 @@ class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter /** * Executes the filter and renames the defined columns * - * @param Piwik_DataTable $table + * @param DataTable $table */ public function filter($table) { - if($table instanceof Piwik_DataTable_Simple) { + if ($table instanceof Simple) { $this->filterSimple($table); } else { $this->filterTable($table); @@ -70,13 +76,13 @@ class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter } } - protected function filterSimple(Piwik_DataTable_Simple $table) + protected function filterSimple(Simple $table) { foreach ($table->getRows() as $row) { - $columns = array_keys( $row->getColumns() ); - foreach($columns as $column) { + $columns = array_keys($row->getColumns()); + foreach ($columns as $column) { $newName = $this->getRenamedColumn($column); - if($newName) { + if ($newName) { $row->renameColumn($column, $newName); } } |