Support for custom objects
This release adds the ability to call methods on objects, and use the result as part of the rule.
class User
{
// ...
public function points(): int
{
return 1337;
}
}
$variables = [
'user' => new User(),
];
$rule = new Rule('user.points() > 300', $variables);
var_dump($rule->isTrue()); // bool(true)