DMS\Filter\Filter::filterValue PHP Method

filterValue() public method

{@inheritDoc}
public filterValue ( $value, $rule )
    public function filterValue($value, $rule)
    {
        if ($rule instanceof Rules\Rule) {
            $filter = $this->filterLoader->getFilterForRule($rule);
            return $filter->apply($rule, $value);
        }
        return $this->walkRuleChain($value, $rule);
    }

Usage Example

Esempio n. 1
0
 public function testFilterValueWithArray()
 {
     $value = "this is <b> a string<p> with<b> tags</p> and\n malformed";
     $filters = array(new Rules\StripTags(), new Rules\StripNewlines());
     $filtered = $this->filter->filterValue($value, $filters);
     $this->assertNotEquals($value, $filtered);
     $this->assertNotContains('<b>', $filtered);
     $this->assertNotContains('<p>', $filtered);
     $this->assertNotContains('\\n', $filtered);
 }
All Usage Examples Of DMS\Filter\Filter::filterValue