FilterMatch: Do not re-invent the parents implementation of matches()

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-23 13:00:46 +02:00
parent fcdf41a9b8
commit 939188be94
1 changed files with 0 additions and 17 deletions

View File

@ -5,21 +5,4 @@ namespace Icinga\Data\Filter;
class FilterMatch extends FilterExpression
{
public function matches($row)
{
if (! isset($row->{$this->column})) {
// TODO: REALLY? Exception?
return false;
}
$expression = (string) $this->expression;
if (strpos($expression, '*') === false) {
return (string) $row->{$this->column} === $expression;
} else {
$parts = array();
foreach (preg_split('/\*/', $expression) as $part) {
$parts[] = preg_quote($part);
}
return preg_match('/^' . implode('.*', $parts) . '$/', $row->{$this->column});
}
}
}