Slide 47
Slide 47 text
Ruler Usage
$rb = new RuleBuilder;
$rule = $rb->create(
$rb->logicalAnd(
$rb['minAge']->greaterThan($rb['age']),
$rb['maxAge']->lessThan($rb['age'])
),
function() {
echo 'Congratulations! You are between the ages of 18 and 25!';
}
);
$context = new Context(array(
'minAge' => 18,
'maxAge' => 25,
'age' => function() {
return 20;
},
));
$rule->execute($context); // "Congratulations! You are between the ages of 18 and 25!"
Friday, February 8, 13