bobthecow / Ruler

A simple stateless production rules engine for modern PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New tag

bakura10 opened this issue · comments

Hi,

Would it be possible to tag a new version? Latest version does not include the trait :).

Thanks!

Yep. Totally possible :)

Before we tag a new release, we need to get the documentation updated for all the new operators. I'll do that when I get a minute.

Speaking about that, I've thought of a missing operator that would be useful: Exists operator. It would be used to make sure that a given key exist in the context:

$rb = new RuleBuilder;
$rule = $rb->create(
    $rb->logicalAnd(
        $rb['foo']->exists(),
        $rb['bar']->exists()
    )
);

$context = new Context(array(
    'foo' => 5,
    'bar' => null
));

$rule->execute($context); // return true

$context = new Context(array(
    'foo' => 5
));

$rule->execute($context); // return false

However I'm not sure how this would make to current architecture as exists() operator would not take a right operand.

Done! Sorry that took so long :(