/** * Command handler * * If params are passed as a associative array or as a KConfig object they will be merged with the context of the * command chain and passed along. If they are passed as an indexed array they will be passed to the callback * directly. * * @param string $name The command name * @param CommandContext $context The command context * @return boolean */ public function execute($name, CommandContext $context) { $result = true; $callbacks = $this->getCallbacks($name); foreach ($callbacks as $key => $callback) { $params = $this->_params[$name][$key]; if (is_array($params) && is_numeric(key($params))) { $result = call_user_func_array($callback, $params); } else { $result = call_user_func($callback, $context->append($params)); } //Call the callback if ($result === false) { break; } } return $result === false ? false : true; }