Command handler.

@param   string      The command name
@param   object      The command context

@return bool Can return both true or false.
515269
public function execute($name, AnCommandContext $context)
    {
        $parts = explode('.', $name);

        if ($parts[0] == 'before') {
            $value = pick($this->{$this->getIdentifiableKey()}, $context->data->{$this->getIdentifiableKey()});

            if ($value) {
                $parent = $this->getParentRepository()->fetch($value);

                $this->setParent($parent);

                //set the entity owner as the context actor of the controller
                if ($parent && $this->getRepository()->isOwnable() && $this->isOwnable()) {
                    $this->setActor($parent->owner);
                }

                $context->data['parent'] = $parent;
            }
        }
    }
743126
function Command(handler, options, desc) {
  Command.super_.apply(this, [handler, options, desc]);
}
1075591
public function execute(Command $command)
    {
        $handler = $this->resolver->resolve($command);

        return $handler->handle($command);
    }
465662
public function isCommand($name) {
        if (!$this->docoptResult)
            return false;

        if (!($len=strlen($name)) || !isset($this->docoptResult[$name]))
            return false;
        return (bool) preg_match('/^[a-z]+$/', $name);
    }
1077481
public function findHandler(Command $command)
    {
        $command_name = get_class($command);

        return isset($this->handlers[$command_name]) ? $this->handlers[$command_name] : null;
    }
165863
public function execute($eventName, $object)
    {
        if (isset($this->events[$eventName]) && is_array(($this->events[$eventName]))) {
            foreach ($this->events[$eventName] as $method) {
                call_user_func([$object, $method]);
            }
        }
    }
991724
protected function dispatchCommand($command, array $argumentBag = [])
    {
        $result    = false;
        $arguments = null;

        // Multicommand?
        $arguments = explode(self::ARGUMENT_SEPARATOR, $command);

        if (count($arguments) > 1) {
            $command = array_shift($arguments);
        } else {
            // Extract the scope (scope for action)
            $arguments = $argumentBag['scope'];
        }

        switch ($command) {
            case self::COMMAND_PURGE:
                $result = $this->purge(
                    $arguments,
                    $argumentBag
                );
                break;

            case self::COMMAND_WARMUP:
                $result = $this->warmup(
                    $arguments,
                    $argumentBag
                );
                break;

            default:
                $command = null;
                break;
        }

        return $result;
    }
1336389
@Override
    public boolean handles(String command) {
        if (command.startsWith(this.tree.getTopNode().getData())) {
            return true;
        }
        return false;
    }
1064476
public function executeCommand($cmd, \Closure $closure = null, Process $process = null)
    {
        try {
            $cmd = $this->php.' '.$this->console.' '.$cmd;
            if (null === $process) {
                $process =  new Process($cmd);
            } else {
                $process->setCommandLine($cmd);
            }

            return $process->run($closure);
        } catch (\Exception $e) {
            return false;
        }
    }
117215
public boolean handleAction (Component source, String command, Object arg)
    {
        return handleAction(new CommandEvent(source, command, arg));
    }
1136567
public function canHandle($object)
    {
        if ((is_string($object)) || ($object instanceof Media && $object->getContentType() == self::CONTENT_TYPE)) {
            return true;
        }

        return false;
    }
1238297
public function unregisterActionHandler($handlertype, $regexhandler,
        $object, $methodname = ''
    ) {
        // precheck
        if (!($handlertype & SMARTIRC_TYPE_ALL)) {
            $this->log(SMARTIRC_DEBUG_NOTICE, 'WARNING: passed invalid handler'
                .'type to unregisterActionHandler()', __FILE__, __LINE__
            );
            return false;
        }

        if (!empty($methodname)) {
            $object = array($object, $methodname);
        }

        foreach ($this->_actionhandler as $i => &$handlerinfo) {
            if ($handlerinfo['type'] == $handlertype
                && $handlerinfo['message'] == $regexhandler
                && $handlerinfo['callback'] == $object
            ) {
                $id = $handlerinfo['id'];
                unset($this->_actionhandler[$i]);

                $this->log(SMARTIRC_DEBUG_ACTIONHANDLER, 'DEBUG_ACTIONHANDLER: '
                    .'actionhandler('.$id.') unregistered', __FILE__, __LINE__
                );
                $this->_actionhandler = array_values($this->_actionhandler);
                return $this;
            }
        }

        $this->log(SMARTIRC_DEBUG_ACTIONHANDLER, 'DEBUG_ACTIONHANDLER: could '
            .'not find actionhandler type: "'.$handlertype.'" message: "'
            .$regexhandler.'" matching callback. Nothing unregistered', __FILE__, __LINE__
        );
        return false;
    }
1026245
public function callHandler(array $command, $method, $args = array())
    {
        try {
            $handlers = $this->getHandlers();
            return Handler::call($handlers, $command['command_id'], $method, $args);
        } catch (Exception $ex) {
            return $ex->getMessage();
        }
    }
977055
protected function _execute($command) {
		try {
			if (!$class = $this->_instance($command)) {
				return false;
			}
		} catch (ClassNotFoundException $e) {
			return false;
		}
		$data = [];
		$params = $class->invokeMethod('_params');

		foreach ($params as $param) {
			$data[$param] = $class->invokeMethod("_{$param}", [$this->request]);
		}

		if ($message = $class->invokeMethod('_save', [$data])) {
			$this->out($message);
			return true;
		}
		return false;
	}
1149868
function cmd(handlers)
{
  this.fieldindex = 0;
  this.state = "start";
  this.stmt = ""
  this.params = []

  // mixin all handlers
  for (var h in handlers)
  {
    this[h] = handlers[h];
  }
  // save command name to display in debug output
  this.command_name = cmd.caller.command_name;
  this.args = Array.prototype.slice.call(cmd.caller.arguments);
}
184130
public function handle(Command $command)
    {
        $handler = $this->container->make($this->handlerName);

        return $handler->handle($command);
    }
411609
public function addCommand(string $name, $handler = null, $option = null): self
    {
        return $this->command($name, $handler, $option);
    }