diff options
author | sgiehl <stefangiehl@gmail.com> | 2012-05-28 21:29:23 +0400 |
---|---|---|
committer | sgiehl <stefangiehl@gmail.com> | 2012-05-28 21:29:23 +0400 |
commit | 06bb25eb436e6d17d79eb44b286a1d877328142d (patch) | |
tree | f92a56ad52588a20b8bf16eb466ce920c2a65c2b /core/DataTable/Filter/Pattern.php | |
parent | 90ae9e10229fc517dd1c9f406736cc091b6cf970 (diff) |
added/fixed doc blocks
git-svn-id: http://dev.piwik.org/svn/trunk@6353 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/DataTable/Filter/Pattern.php')
-rw-r--r-- | core/DataTable/Filter/Pattern.php | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/core/DataTable/Filter/Pattern.php b/core/DataTable/Filter/Pattern.php index ac59e70941..a640800bf1 100644 --- a/core/DataTable/Filter/Pattern.php +++ b/core/DataTable/Filter/Pattern.php @@ -13,7 +13,7 @@ /** * Delete all rows for which the given $columnToFilter do not contain the $patternToSearch * This filter is to be used on columns containing strings. - * Exemple: fron the keyword report, keep only the rows for which the label contains "piwik" + * Example: from the keyword report, keep only the rows for which the label contains "piwik" * * @package Piwik * @subpackage Piwik_DataTable @@ -23,8 +23,14 @@ class Piwik_DataTable_Filter_Pattern extends Piwik_DataTable_Filter private $columnToFilter; private $patternToSearch; private $patternToSearchQuoted; - private $invertedMatch; - + private $invertedMatch; + + /** + * @param Piwik_DataTable $table + * @param string $columnToFilter + * @param string $patternToSearch + * @param bool $invertedMatch + */ public function __construct( $table, $columnToFilter, $patternToSearch, $invertedMatch = false ) { parent::__construct($table); @@ -33,20 +39,35 @@ class Piwik_DataTable_Filter_Pattern extends Piwik_DataTable_Filter $this->columnToFilter = $columnToFilter; $this->invertedMatch = $invertedMatch; } - + + /** + * Helper method to return the given pattern quoted + * + * @param string $pattern + * @return string + */ static public function getPatternQuoted( $pattern ) { return '/'. str_replace('/', '\/', $pattern) .'/'; } - - /* + + /** * Performs case insensitive match + * + * @param string $pattern + * @param string $patternQuoted + * @param string $string + * @param bool $invertedMatch + * @return int */ static public function match($pattern, $patternQuoted, $string, $invertedMatch) { return @preg_match($patternQuoted . "i", $string) == 1 ^ $invertedMatch; } - + + /** + * @param Piwik_DataTable $table + */ public function filter($table) { foreach($table->getRows() as $key => $row) |