public function __construct() { $args = func_get_args(); $this->rules = array(); foreach ($args as $i => &$v) { if (is_array($v)) { $execute = false; if (array_key_exists('execute', $v)) { $execute = $v['execute']; unset($v['execute']); } $v = Dispatcher_Utils::vivify_rule($v); if ($execute) { call_user_func_array(array($v, 'execute'), $execute); } } if (!is_object($v)) { Dispatch_Exception::construction("Got something that is not an object for argument {$i}"); } if (!$v instanceof Dispatcher_Rule) { Dispatch_Exception::construction("Got something that is not a Dispatcher_Rule for argument {$i}"); } $this->add_rule($v); } return $this; }
public static function er($rulename) { return Dispatcher_Utils::vivify_rule(func_get_args()); }