@param Event           $event
@param ResolverCommand $command

@return array
176316
protected function getEventLogDetails(Event $event, ResolverCommand $command)
    {
        $details = $command->resolve($event);

        return empty($details) ? $this->default : $details;
    }
362454
public function exec($command)
    {
        $this->_events[] = $event = new Event($this->_mutex, $command);
        return $event;
    }
869664
public function beforeCommand(Event $event, Command $command)
    {
        $parameters = $command->parseParameters([], ['h' => 'help']);

        if (
            count($parameters) < ($command->getRequiredParams() + 1) ||
            $command->isReceivedOption(['help', 'h', '?']) ||
            in_array($command->getOption(1), ['help', 'h', '?'])
        ) {
            $command->getHelp();

            return false;
        }

        if( !defined('BASE_PATH') ) {
            throw new CommandsException('Commands need a BASE_PATH constant defined.');
        }

        if ($command->canBeExternal() == false) {
            $path = $command->getOption('directory');
            if (!file_exists($path.'.phalcon')) {
                throw new CommandsException('This command should be invoked inside a Phalcon project directory.');
            }
        }

        return true;
    }
81631
protected function doAction(Command $command)
    {
        if ($command->name() === '__default__') {
            return $this->notFound();
        }

        // Let the command collect more data (if missing or needs confirmation)
        $command->interact($this->io());

        if (!$command->action() && !\method_exists($command, 'execute')) {
            return;
        }

        $params = [];
        $values = $command->values();
        // We prioritize action to be in line with commander.js!
        $action = $command->action() ?? [$command, 'execute'];

        foreach ($this->getActionParameters($action) as $param) {
            $params[] = $values[$param->getName()] ?? null;
        }

        return $action(...$params);
    }
783601
protected function createEventFromCommand(Command $command, string $suffix): Event
    {
        /** @var NodeRef $nodeRef */
        $nodeRef = $command->get('node_ref') ?: NodeRef::fromNode($command->get('node'));
        $curie = $command::schema()->getCurie();
        $eventCurie = "{$curie->getVendor()}:{$curie->getPackage()}:event:{$nodeRef->getLabel()}-{$suffix}";

        /** @var Event $class */
        $class = MessageResolver::resolveCurie(SchemaCurie::fromString($eventCurie));
        return $class::create();
    }
1345179
public function onCommand(CommandEvent $event)
    {
        switch ($event->getCommandName()) {
            case 'dump-autoload':
                $_this = new DumpAutoloadEventHandler(
                    $this->__installer->getComposer()->getPackage(),
                    $this->__installer->getComposer()
                );
                break;
            default: break;
        }
    }
114919
public function resolve($event)
    {
        if ($event instanceof FilterUserResponseEvent) {
            return $this->getEventDetailsArray($event->getUser()->getUsername());
        }

        return null;
    }
1262693
public function handle($event)
    {
        switch (get_class($event)) {
            case AfterMassActionsAction::class:
                $actions = $event->massActions;
                $row = $event->model;
                break;

            case BeforeMassActionsAction::class:
                $actions = $event->massActions;
                $row = $event->model;
                break;

            case AfterTableAction::class:
                $actions = $event->tableActions;
                $row = $event->row;
                break;

            case BeforeTableAction::class:
                $actions = $event->tableActions;
                $row = $event->row;
                break;
        }

        $elements = $this->getActions($row);
        $return   = [];

        foreach ($elements as $element) {
            $resolved = $this->resolveDatatableAction($actions, $row, $element);
            if (is_array($resolved)) {
                $return[] = $resolved;
            }
        }


        return count($return) ? array_merge(...$return) : [];
    }
246637
protected function listCommands(CommandEvent $event, EventQueueInterface $queue)
    {
        $targets = $event->getTargets();
        $target = reset($targets);
        $nick = $event->getNick();

        if ($target === $event->getConnection()->getNickname()) {
            $target = $nick;
            $address = '';
        } else {
            $address = $nick . ': ';
        }

        $method = 'irc' . $event->getCommand();
        $message = $address . $this->listText . implode(' ', $this->commands);
        $queue->$method($target, $message);
    }
1235626
public function getArgs($event)
    {
        return [
            $event->getGroupField(),
            $event->getGroupingMode(),
            $event->getValue(),
            $event->getModel()->getPropertiesAsArray()
        ];
    }
556952
protected function executeCommand($command)
    {

        $process = new Process($command);
        $process->run();

        return array(
            $process->getExitCode(),
            $process->getOutput(),
            $process->getErrorOutput(),
        );
    }
244317
public function onCommand($event)
    {
        $this->data['commands'][] = array(
            'command' => $event->getCommand(),
            'arguments' => $event->getArguments(),
            'executiontime' => $event->getExecutionTime(),
        );
    }
1040633
protected function registerMakeEventCommand($command)
     {
         $this->app->singleton($command, function ($app) {
             return new Generators\Commands\EventMakeCommand($app);
         });
     }
116793
protected function _getArgumentValues($controller, $command, $argumentName)
    {
        $controllerClassName = $this->_getControllerClassName($controller);
        if (!class_exists($controllerClassName)) {
            return [];
        }

        $argument_values = [];
        $command = Text::camelize($command) . 'Completion';
        if (method_exists($controllerClassName, $command)) {
            try {
                $argument_values = (new $controllerClassName())->$command($argumentName);
            } catch (\Exception $e) {

            }
        }

        return $argument_values;
    }
31868
public function resolve($event, $resourceParts, $method)
	{
		$nbParts = count($resourceParts);
		if ($nbParts == 0 && $method === Request::METHOD_GET)
		{
			array_unshift($resourceParts, 'plugins');
			$event->setParam('namespace', implode('.', $resourceParts));
			$event->setParam('resolver', $this);
			$action = function ($event)
			{
				$action = new DiscoverNameSpace();
				$action->execute($event);
			};
			$event->setAction($action);
			return;
		}
		elseif ($nbParts == 1)
		{
			$actionName = $resourceParts[0];
			if ($actionName === 'installedPlugins')
			{
				$action = new GetInstalledPlugins();
				$event->setAction(function($event) use($action) {$action->execute($event);});
				$authorisation = function() use ($event)
				{
					return $event->getPermissionsManager()->isAllowed('Administrator');
				};
				$event->setAuthorization($authorisation);
			}
			else if ($actionName === 'registeredPlugins')
			{
				$action = new GetRegisteredPlugins();
				$event->setAction(function($event) use($action) {$action->execute($event);});
				$authorisation = function() use ($event)
				{
					return $event->getPermissionsManager()->isAllowed('Administrator');
				};
				$event->setAuthorization($authorisation);
			}
			else if ($actionName === 'newPlugins')
			{
				$action = new GetNewPlugins();
				$event->setAction(function($event) use($action) {$action->execute($event);});
				$authorisation = function() use ($event)
				{
					return $event->getPermissionsManager()->isAllowed('Administrator');
				};
				$event->setAuthorization($authorisation);
			}
		}
	}
869469
public function resolve(interfaces\commands\Command $command): interfaces\handlers\Handler
    {
        $commandClass = get_class($command);

        if (isset($this->handlers[$commandClass])) {
            $handler = $this->handlers[$commandClass];

            return is_object($handler) ? $handler : $this->createHandler($handler);
        }

        if ($command instanceof interfaces\commands\PlainCommand) {
            return $this->createHandler($this->plainCommandHandlerClassName);
        }

        $handlerClass = $commandClass . 'Handler';
        if (class_exists($handlerClass)) {
            return $this->createHandler($handlerClass);
        }

        $handlerClass = str_replace('\\commands\\', '\\handlers\\', $handlerClass);
        if (class_exists($handlerClass)) {
            return $this->createHandler($handlerClass);
        }

        throw new Exception("Could not terminate the handler of a command of type \"{$commandClass}\"");
    }
1173669
private static function getExtraConfig(Event $event) : array
    {
        $extra = $event->getComposer()->getPackage()->getExtra();
        return is_array($extra) ? $extra : [];
    }