@param \Spryker\Install\Stage\Section\Command\CommandInterface $command
@param array $definition

@return void
429154
protected function setStores(CommandInterface $command, array $definition)
    {
        if (isset($definition[static::CONFIG_STORES]) && is_array($definition[static::CONFIG_STORES])) {
            $command->setStores($definition[static::CONFIG_STORES]);
        }
    }
933426
protected function execute(CommandInterface $command)
    {
        $runner = $this->getCommandRunner();

        $this->lastReturnValue = $runner->run($command);

        $this->checkReturnValue($runner);
    }
1140223
protected function addCommandConditions(CommandInterface $command, array $definition)
    {
        if (!isset($definition[static::CONFIG_CONDITIONS])) {
            return;
        }

        foreach ($definition[static::CONFIG_CONDITIONS] as $condition) {
            $condition = $this->conditionFactory->createCondition($condition);
            $command->addCondition($condition);
        }
    }
875924
protected function checkForMissingArguments(CommandInterface $command, array $providedArguments): void
	{
		$this->checkForMissingArgumentsOrOptions($command->getCommandArguments(), $providedArguments, MissingArgumentException::class);
	}
14276
protected function doSendCommand(Command $command): void
    {
        if (!$this->shouldUseGearman()) {
            $this->locator->getCommandBus()->receiveCommand($command);
            return;
        }

        $envelope = new TransportEnvelope($command, 'php');
        $channel = $this->router->forCommand($command);

        try {
            $client = $this->getClient();
            @$client->doBackground($channel, $envelope->toString(), (string)$command->get('command_id'));
            $this->validateReturnCode($client, $channel);
        } catch (\GearmanException $ge) {
            if (isset(self::$reconnectCodes[$ge->getCode()])) {
                $this->destroyClient();
                $this->locator->getCommandBus()->receiveCommand($command);
                return;
            }

            throw $ge;
        } catch (\Throwable $e) {
            throw $e;
        }
    }
1232751
final public function handle(Command $command): void
    {
        if (!$command instanceof ReceivedCommand && $this->discriminator->shouldEnqueue($command)) {
            $this->queue->send($command);

            return;
        }

        if ($command instanceof ReceivedCommand) {
            $command = $command->getOriginalCommand();
        }

        $this->wrappedCommandBus->handle($command);
    }
800195
public void addCommand(Command command) {
        if(command == null)
            throw new IllegalArgumentException();

        if(_frozen)
            throw new IllegalStateException();

        Command[] results = new Command[_commands.length + 1];
        System.arraycopy(_commands, 0, results, 0, _commands.length);
        results[_commands.length] = command;
        _commands = results;
    }
487861
public function execute(KCommandInterface $command, KCommandChainInterface $chain)
    {
        $type    = '';
        $package = '';
        $subject = '';

        if ($command->getSubject())
        {
            $identifier = $command->getSubject()->getIdentifier()->toArray();
            $package    = $identifier['package'];

            if ($identifier['path'])
            {
                $type    = array_shift($identifier['path']);
                $subject = $identifier['name'];
            }
            else $type = $identifier['name'];
        }

        $parts  = explode('.', $command->getName());
        $when   = array_shift($parts);               // Before or After
        $name   = KStringInflector::implode($parts); // Read Dispatch Select etc.

        // Create Specific and Generic event names
        $event_specific = 'on'.ucfirst($when).ucfirst($package).ucfirst($subject).ucfirst($type).$name;
        $event_generic  = 'on'.ucfirst($when).ucfirst($type).$name;

        // Clone the context
        if($this->_immutable) {
            $event = clone($command);
        } else {
            $event = $command;
        }

        // Create event object to check for propagation
        $event = $this->getEventPublisher()->publishEvent($event_specific, $event->getAttributes(), $event->getSubject());

        // Ensure event can be propagated and event name is different
        if ($event->canPropagate() && $event_specific != $event_generic)
        {
            $event->setName($event_generic);
            $this->getEventPublisher()->publishEvent($event);
        }
    }
920336
protected function invokeDefinition(IDefinition $definition, $command) {
        foreach ($this->invokers as $invoker) {
            if ($invoker->supports($definition)) {
                return $invoker->invoke($definition, $command);
            }
        }

        throw new UnsupportedCommandHandlerException(
            s('Command handlers of type %s are not supported.',
                get_type($definition->getHandler()))
        );
    }
1295064
public function command($command)
    {
        if (! $command instanceof Command) {
            $command = $this[$command];
        }

        $this['console']->add($command);
    }
1151786
protected function execute(InputInterface $input, OutputInterface $output)
    {
        try
        {
            if (method_exists($this, 'start'))
            {
                $this->start();
            }
            else
            {
                throw new \RuntimeException('Command is not set correctly.');
            }
        }
        catch (\Exception $e)
        {
            $this->error($e->getMessage());
        }
    }
41124
private function setDefinitionArguments(Definition $definition, array $array)
    {
        if (true === array_key_exists('arguments', $array)) {
            foreach ($array['arguments'] as $arg) {
                $definition->addArgument($this->convertArgument($arg));
            }
        }
    }
530396
public function fire(Command $command)
    {
        if ($command->option('verbose')) {
            $command->call('key:generate');
            $command->call('api:key-generate');

            return;
        }
        $command->callSilent('key:generate');
        $command->callSilent('api:key-generate');
    }
761302
public function execute(InputInterface $input, OutputInterface $output)
    {
        $runner = $this->commandDefinition->getRunner();
        $runner();
    }
446090
private function hydrateDefinitionArguments(Definition $definition, array &$definitionArray)
    {
        foreach ($definition->getArguments() as $arg) {
            $definitionArray['arguments'][] = $this->convertArgument($arg);
        }
    }
766869
public function onPluginCommand(CommandEvent $event)
    {
        if ($this->config->get('enabled', true)) {
            ConfigBuilder::validate($this->io, $this->composer->getPackage(), $event->getCommandName());

            if (!\in_array($event->getCommandName(), array('install', 'update'), true)) {
                $this->packageFilter->setEnabled(false);
            }
        }
    }
833487
protected function addCommand($pluginId, $cmdTxt, ChatCommandInterface $command)
    {
        if (isset($this->commands[$cmdTxt])) {
            throw new CommandExistException(
                "$pluginId tries to register command '$cmdTxt' already registered"
            );
        }

        $this->commands[$cmdTxt] = $command;
        $this->commandPlugin[$pluginId][$cmdTxt] = $command;
    }