class RulesEvaluationException

An exception that is thrown during evaluation.

Messages are prepared to be logged to the watchdog, thus not yet translated.

Hierarchy

Expanded class hierarchy of RulesEvaluationException

See also

watchdog()

File

includes/rules.core.inc, line 2845

View source
class RulesEvaluationException extends RulesException {
    public $msg;
    public $args;
    public $severity;
    public $element;
    public $keys = array();
    
    /**
     * Constructor.
     *
     * @param string $msg
     *   The exception message containing placeholder as t().
     * @param array $args
     *   Replacement arguments such as for t().
     * @param $element
     *   The element of a configuration causing the exception or an array
     *   consisting of the element and keys specifying a setting value causing
     *   the exception.
     * @param int $severity
     *   The RulesLog severity. Defaults to RulesLog::WARN.
     */
    public function __construct($msg, array $args = array(), $element = NULL, $severity = RulesLog::WARN) {
        $this->element = is_array($element) ? array_shift($element) : $element;
        $this->keys = is_array($element) ? $element : array();
        $this->msg = $msg;
        $this->args = $args;
        $this->severity = $severity;
        // If an error happened, run the integrity check on the rules configuration
        // and mark it as dirty if it the check fails.
        if ($severity == RulesLog::ERROR && isset($this->element)) {
            $rules_config = $this->element
                ->root();
            rules_config_update_dirty_flag($rules_config);
            // If we discovered a broken configuration, exclude it in future.
            if ($rules_config->dirty) {
                rules_clear_cache();
            }
        }
        // @todo Fix _drupal_decode_exception() to use __toString() and override it.
        $this->message = t($this->msg, $this->args);
    }

}

Members

Title Sort descending Modifiers Object type Summary
RulesEvaluationException::$args public property
RulesEvaluationException::$element public property
RulesEvaluationException::$keys public property
RulesEvaluationException::$msg public property
RulesEvaluationException::$severity public property
RulesEvaluationException::__construct public function Constructor.