diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-05-09 06:57:35 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-05-09 06:57:35 +0400 |
commit | ccf13b8caf89e77d2885bb874c4f7691ade5fd6f (patch) | |
tree | 43be062b63589fd476acca0b333ab172f4fff8ae /core/API/DataTableGenericFilter.php | |
parent | b0b6338d240fec9b1c7e43ee6bb38be930e3ecce (diff) |
Small refactor refs #4706
Diffstat (limited to 'core/API/DataTableGenericFilter.php')
-rw-r--r-- | core/API/DataTableGenericFilter.php | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/core/API/DataTableGenericFilter.php b/core/API/DataTableGenericFilter.php index 965e4fdeb1..6b24e00c6a 100644 --- a/core/API/DataTableGenericFilter.php +++ b/core/API/DataTableGenericFilter.php @@ -10,8 +10,8 @@ namespace Piwik\API; use Exception; use Piwik\Common; -use Piwik\DataTable; use Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal; +use Piwik\DataTable; class DataTableGenericFilter { @@ -53,37 +53,45 @@ class DataTableGenericFilter { if (is_null(self::$genericFiltersInfo)) { self::$genericFiltersInfo = array( - 'Pattern' => array( - 'filter_column' => array('string', 'label'), - 'filter_pattern' => array('string'), - ), - 'PatternRecursive' => array( - 'filter_column_recursive' => array('string', 'label'), - 'filter_pattern_recursive' => array('string'), - ), - 'ExcludeLowPopulation' => array( - 'filter_excludelowpop' => array('string'), - 'filter_excludelowpop_value' => array('float', '0'), - ), - 'AddColumnsProcessedMetrics' => array( - 'filter_add_columns_when_show_all_columns' => array('integer') - ), - 'AddColumnsProcessedMetricsGoal' => array( - 'filter_update_columns_when_show_all_goals' => array('integer'), - 'idGoal' => array('string', AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW), - ), - 'Sort' => array( - 'filter_sort_column' => array('string'), - 'filter_sort_order' => array('string', 'desc'), - ), - 'Truncate' => array( - 'filter_truncate' => array('integer'), - ), - 'Limit' => array( - 'filter_offset' => array('integer', '0'), - 'filter_limit' => array('integer'), - 'keep_summary_row' => array('integer', '0'), - ), + array('Pattern', + array( + 'filter_column' => array('string', 'label'), + 'filter_pattern' => array('string') + )), + array('PatternRecursive', + array( + 'filter_column_recursive' => array('string', 'label'), + 'filter_pattern_recursive' => array('string'), + )), + array('ExcludeLowPopulation', + array( + 'filter_excludelowpop' => array('string'), + 'filter_excludelowpop_value' => array('float', '0'), + )), + array('AddColumnsProcessedMetrics', + array( + 'filter_add_columns_when_show_all_columns' => array('integer') + )), + array('AddColumnsProcessedMetricsGoal', + array( + 'filter_update_columns_when_show_all_goals' => array('integer'), + 'idGoal' => array('string', AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW), + )), + array('Sort', + array( + 'filter_sort_column' => array('string'), + 'filter_sort_order' => array('string', 'desc'), + )), + array('Truncate', + array( + 'filter_truncate' => array('integer'), + )), + array('Limit', + array( + 'filter_offset' => array('integer', '0'), + 'filter_limit' => array('integer'), + 'keep_summary_row' => array('integer', '0'), + )), ); } @@ -110,10 +118,12 @@ class DataTableGenericFilter $genericFilters = self::getGenericFiltersInformation(); $filterApplied = false; - foreach ($genericFilters as $filterName => $parameters) { + foreach ($genericFilters as $filterMeta) { + $filterName = $filterMeta[0]; + $filterParams = $filterMeta[1]; $filterParameters = array(); $exceptionRaised = false; - foreach ($parameters as $name => $info) { + foreach ($filterParams as $name => $info) { // parameter type to cast to $type = $info[0]; |