diff options
Diffstat (limited to 'core/DataTable/Filter/ColumnDelete.php')
-rw-r--r-- | core/DataTable/Filter/ColumnDelete.php | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/core/DataTable/Filter/ColumnDelete.php b/core/DataTable/Filter/ColumnDelete.php index 709d56a02e..5540634ef8 100644 --- a/core/DataTable/Filter/ColumnDelete.php +++ b/core/DataTable/Filter/ColumnDelete.php @@ -8,15 +8,19 @@ * @category Piwik * @package Piwik */ +namespace Piwik\DataTable\Filter; + +use Piwik\DataTable; +use Piwik\DataTable\Filter; /** * Filter that will remove columns from a DataTable using either a blacklist, * whitelist or both. * * @package Piwik - * @subpackage Piwik_DataTable + * @subpackage DataTable */ -class Piwik_DataTable_Filter_ColumnDelete extends Piwik_DataTable_Filter +class ColumnDelete extends Filter { /** * The columns that should be removed from DataTable rows. @@ -51,13 +55,13 @@ class Piwik_DataTable_Filter_ColumnDelete extends Piwik_DataTable_Filter /** * Constructor. * - * @param Piwik_DataTable $table - * @param array|string $columnsToRemove An array of column names or a comma-separated list of + * @param DataTable $table + * @param array|string $columnsToRemove An array of column names or a comma-separated list of * column names. These columns will be removed. - * @param array|string $columnsToKeep An array of column names that should be kept or a + * @param array|string $columnsToKeep An array of column names that should be kept or a * comma-separated list of column names. Columns not in * this list will be removed. - * @param bool $deleteIfZeroOnly + * @param bool $deleteIfZeroOnly */ public function __construct($table, $columnsToRemove, $columnsToKeep = array(), $deleteIfZeroOnly = false) { @@ -80,7 +84,7 @@ class Piwik_DataTable_Filter_ColumnDelete extends Piwik_DataTable_Filter * Filters the given DataTable. Removes columns that are not desired from * each DataTable row. * - * @param Piwik_DataTable $table + * @param DataTable $table */ public function filter($table) { @@ -112,15 +116,16 @@ class Piwik_DataTable_Filter_ColumnDelete extends Piwik_DataTable_Filter $keep = false; // @see self::APPEND_TO_COLUMN_NAME_TO_KEEP - foreach($this->columnsToKeep as $nameKeep => $true) { - if(strpos($name, $nameKeep . self::APPEND_TO_COLUMN_NAME_TO_KEEP) === 0) { + foreach ($this->columnsToKeep as $nameKeep => $true) { + if (strpos($name, $nameKeep . self::APPEND_TO_COLUMN_NAME_TO_KEEP) === 0) { $keep = true; } } if (!$keep && $name != 'label' // label cannot be removed via whitelisting - && !isset($this->columnsToKeep[$name])) { + && !isset($this->columnsToKeep[$name]) + ) { $row->deleteColumn($name); } } |