Esempio n. 1
0
 function testApplyRecursive()
 {
     $rule = new DeclFilter_CatchAllFilterRule('digits');
     $rule->applyOnElements();
     $data = array('hello' => array('abc123', 'abc456'));
     $rule->apply($data, 'hello');
     $this->assertEquals($data['hello'][0], '123');
     $this->assertEquals($data['hello'][1], '456');
 }
Esempio n. 2
0
 /**
  * Adds a catch-all rule with a default filter. Will apply on all values
  * not covered by previous rules. This must be the last rule applied. The
  * filter will only be applied on array elements.
  *
  * @var mixed Filter object or filter name
  */
 function addCatchAllFilter($filter)
 {
     require_once 'DeclFilter/CatchAllFilterRule.php';
     $rule = new DeclFilter_CatchAllFilterRule($filter);
     $rule->applyOnElements();
     $this->rules[] = $rule;
 }