/** * Command handler * * This function translates the command name to a command handler function of the format '_before[Command]' or * '_after[Command]. Command handler functions should be declared protected. * * @param string The command name * @param object The command context * @return boolean Can return both true or false. */ public function execute($name, KCommandContext $context) { if ($context->data instanceof KDatabaseRowInterface) { $this->setMixer($context->data); } return parent::execute($name, $context); }
/** * Command handler * * @param KCommandInterface $command The command * @param KCommandChainInterface $chain The chain executing the command * @return array|mixed Returns an array of the handler results in FIFO order. If a handler returns not NULL and the * returned value equals the break condition of the chain the break condition will be returned. */ public function execute(KCommandInterface $command, KCommandChainInterface $chain) { if ($command->data instanceof KDatabaseRowInterface) { $this->setMixer($command->data); } return parent::execute($command, $chain); }
/** * Command handler * * @param KCommandInterface $command The command * @param KCommandChainInterface $chain The chain executing the command * @return mixed If a handler breaks, returns the break condition. Returns the result of the handler otherwise. */ public function execute(KCommandInterface $command, KCommandChainInterface $chain) { $parts = explode('.', $command->getName()); $method = '_' . $parts[0] . ucfirst($parts[1]); if ($parts[0] == 'action') { $result = $this->{$method}($command); } else { $result = parent::execute($command, $chain); } return $result; }
/** * Command handler * * This function transmlated the command name to a command handler function of * the format '_before[Command]' or '_after[Command]. Command handler * functions should be declared protected. * * @param string The command name * @param object The command context * @return boolean Can return both true or false. */ public function execute($name, KCommandContext $context) { $this->setMixer($context->caller); $parts = explode('.', $name); if ($parts[0] == 'action') { $method = '_action' . ucfirst($parts[1]); if (method_exists($this, $method)) { return $this->{$method}($context); } } return parent::execute($name, $context); }