This provides flexibility to clients that do not want to subclass a Rule but still want to work with the rules library. $rule = new Closure(function ($a, $b) { return $a === $b; }), array(1,2)); $rule->applies();//returns false: 1 is not equal to 2
Наследование: extends Rule
Пример #1
0
 public function testClosureRuleFalse()
 {
     $closure = function ($a, $b) {
         return $a === $b;
     };
     $rule = new Closure($closure, array(1, 2));
     $this->assertFalse($rule->applies());
 }