public function evaluate($value) { if (!is_object($value)) { return false; } if (!method_exists($value, $this->methodName)) { return false; } return $this->expr->evaluate(call_user_func_array(array($value, $this->methodName), $this->arguments)); }
public function testEvaluateWithArguments() { $expr = new Method('getBar', array(2), new GreaterThan(10)); $this->assertTrue($expr->evaluate(new MethodTest_TestClass(9))); $this->assertFalse($expr->evaluate(new MethodTest_TestClass(7))); }