function RulesPHPEvaluator::evaluate

Evaluates PHP code contained in $text.

This method doesn't apply $options, thus the PHP code is responsible for behaving appropriately.

Overrides RulesDataInputEvaluator::evaluate

File

modules/php.eval.inc, line 58

Class

RulesPHPEvaluator
A class implementing a rules input evaluator processing PHP.

Code

public function evaluate($text, $options, RulesState $state) {
    $vars['eval_options'] = $options;
    foreach ($this->setting as $key => $var_name) {
        $vars[$var_name] = $state->get($var_name);
    }
    return rules_php_eval($text, rules_unwrap_data($vars));
}