@param AbstractCommand $command

{@inheritdoc}
352974
public function execute($command, callable $next)
    {
        if ($command->switchTo) {
            $command = $command->switchTo;
        }

        return $next($command);
    }
1157029
protected function _buildCommand($command)
    {
        $url = $command->receiver->getURL();

        $command->setAttribute('data-action', $command->action);
        $command->setAttribute('data-actor', $command->actor->id);

        if (!$this->_use_post && $this->getController()->getRequest()->getFormat() != 'json') {
            $url .= '&layout=list';
        }

        $command->href($url);
    }
691945
public function validate(BaseCommand $command)
  {
    if(isset(static::$rules) && is_array(static::$rules))
      $rules = static::$rules;
    elseif(isset(static::$rules) && Str::startsWith(static::$rules, '@'))
      $rules = $this->{substr(static::$rules, 1)}($command);
    else
      $rules = [];

    $validation = $this->validator->make($command->all(), $rules);

    if($validation->fails())
    {
      $this->throwException($validation);
    }
  }
910476
public function setCommand($command): void
    {
        $this->log(
            "The command attribute is deprecated.\nPlease use the executable attribute and nested arg elements.",
            Project::MSG_WARN
        );
        $this->commandline = new Commandline($command);
        $this->executable = $this->commandline->getExecutable();
    }
285224
private function call($command)
    {
        if (!in_array($command, static::COMMAND)) {
            $this->throwFailsCommand("The command '$command' not exists.", 'help');
        }

        if (!$this->arg->getParameter('action')) {
            if ($this->arg->getParameter('target') == 'help') {
                $this->help($command);

                exit(0);
            }
        }

        try {
            call_user_func_array(
                [$this, $command],
                [$this->arg->getParameter('target')]
            );
        } catch (\Exception $e) {
            echo $e->getMessage();

            exit(1);
        }
    }
992472
public function aExecuteCommandTo($command) {
        $this->restartKernel();
        $kernel = $this->getKernel();

        $application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
        $application->setAutoExit(false);

        $exploded = explode(" ", $command);

        $commandsParams = [
        ];
        foreach ($exploded as $value) {
            if (!isset($commandsParams["command"])) {
                $commandsParams["command"] = $value;
            } else {
                $e2 = explode("=", $value);
//                var_dump($e2);
                if (count($e2) == 1) {
                    $commandsParams[] = $e2[0];
                } else if (count($e2) == 2) {
                    $commandsParams[$e2[0]] = $e2[1];
                }
            }
        }
        foreach ($commandsParams as $key => $value) {
            $commandsParams[$key] = $value;
        }
        $input = new \Symfony\Component\Console\Input\ArrayInput($commandsParams);
        if ($output === null) {
            $output = new \Symfony\Component\Console\Output\ConsoleOutput();
        }
        $application->run($input, $output);
//         $content = $output->fetch();
    }
200881
protected function action($command) {
		if ($command === self::ACTION_DELETE_A_B
		    && $this->b === ' '
		    && ($this->a === '+' || $this->a === '-')
		) {
			// Note: we're at an addition/substraction operator; the inputIndex
			// will certainly be a valid index
			if ($this->input[$this->inputIndex] === $this->a) {
				// This is "+ +" or "- -". Don't delete the space.
				$command = self::ACTION_KEEP_A;
			}
		}
		switch ($command) {
			case self::ACTION_KEEP_A:
				$this->output .= $this->a;
				$this->lastByteOut = $this->a;

			// fallthrough
			case self::ACTION_DELETE_A:
				$this->a = $this->b;
				if ($this->a === "'" || $this->a === '"') { // string literal
					$str = $this->a; // in case needed for exception
					while (true) {
						$this->output .= $this->a;
						$this->lastByteOut = $this->a;

						$this->a = $this->get();
						if ($this->a === $this->b) { // end quote
							break;
						}
						if (ord($this->a) <= self::ORD_LF) {
							throw new JSMinUnterminatedStringException(
								"JSMin: Unterminated String at byte "
								. $this->inputIndex . ": {$str}");
						}
						$str .= $this->a;
						if ($this->a === '\\') {
							$this->output .= $this->a;
							$this->lastByteOut = $this->a;

							$this->a = $this->get();
							$str .= $this->a;
						}
					}
				}
			// fallthrough
			case self::ACTION_DELETE_A_B:
				$this->b = $this->next();
				if ($this->b === '/' && $this->isRegexpLiteral()) { // RegExp literal
					$this->output .= $this->a . $this->b;
					$pattern = '/'; // in case needed for exception
					while (true) {
						$this->a = $this->get();
						$pattern .= $this->a;
						if ($this->a === '/') { // end pattern
							break; // while (true)
						} elseif ($this->a === '\\') {
							$this->output .= $this->a;
							$this->a = $this->get();
							$pattern .= $this->a;
						} elseif (ord($this->a) <= self::ORD_LF) {
							throw new JSMinUnterminatedRegExpException(
								"JSMin: Unterminated RegExp at byte "
								. $this->inputIndex . ": {$pattern}");
						}
						$this->output .= $this->a;
						$this->lastByteOut = $this->a;
					}
					$this->b = $this->next();
				}
			// end case ACTION_DELETE_A_B
		}
	}
1130097
public function addCommand($command)
    {
        if (is_string($command)) {
            $command = $this->app->make($command);
        }

        if ($command instanceof Command) {
            $command->setLaravel($this->app);
        }

        $this->console->add($command);
    }
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;
	}
834187
public function execute($command, callable $next)
    {
        $migration = $command->getMigration();
        if (!$migration instanceof TransactionAwareInterface) {
            $next($command);
            return;
        }

        $result = null;
        try {
            $migration->begin();
            $next($command);
            $migration->finish();
        } catch (\Exception $e) {
            $migration->abort($e);
        }
    }
54513
protected function _commandDelete($command)
    {
        $entity = $this->getController()->getItem();

        $name = AnInflector::pluralize($this->getController()->getIdentifier()->name);
        $redirect = 'option=com_'.$this->getIdentifier()->package.'&view='.$name;

        $command->append(array('label' => AnTranslator::_('LIB-AN-ACTION-DELETE')))
        ->href(route($entity->getURL()))
        ->setAttribute('data-action', 'delete')
        ->setAttribute('data-redirect', route($redirect))
        ->class('action-delete');
    }
1302193
private function send(AbstractCommand $command)
    {
        $cmdId = $this->generateId();
        $this->commands->add($cmdId, $command);
        if (!$command->getClient()->send($this->serializeCommand($command, $cmdId))) {
            throw new \RuntimeException(sprintf('Fail run command "%s".', $command->getCommandName()));
        }
    }
781732
protected function validateCommand($command) {
        if ( ! is_string($command) && ! is_object($command)) {
            throw new InvalidCommandException(s(
                'Command must be either a class name or an instance, "%s" given.',
                get_type($command)
            ));
        }

        if (is_string($command) && ! class_exists($command)) {
            throw new InvalidCommandException(s(
                'Command "%s" does not exist.',
                $command
            ));
        }

        if ( ! method_exists($command, 'setup') || ! method_exists($command, 'run')) {
            throw new InvalidCommandException(s(
                'Command "%s" must implement methods "setup" and "run".',
                get_type($command)
            ));
        }
    }
765551
protected void fireCommandRegistered(AbstractCommand command) {
        
        Assert.notNull(command, "command");
        
        if (commandRegistryListeners.isEmpty()) {
            return;
        }
        
        CommandRegistryEvent event = new CommandRegistryEvent(this, command);
        
        for (Iterator i = commandRegistryListeners.iterator(); i.hasNext();) {
            ((CommandRegistryListener)i.next()).commandRegistered(event);
        }
        
    }
363173
protected function executeCommand($command) {
        $class = $this->config['commands'][$command]['class'];

        if (!class_exists($class) ||
            !is_subclass_of($class, __NAMESPACE__ . '\\Command\\Executes')
        ) {
            throw new RuntimeException(sprintf(
                'Command "%s" not found',
                $command
            ), ExitApp::BAD_USER_INTERACTION);
        }

        $this->config['command'] = $command;

        /** @var Executes $command */
        $command = new $class($this->config, $this->log);

        foreach ($this->config['args'] as $help) {
            if (in_array($help, ['-h', '--help'])) {
                $command->printUsage();
                return;
            }
        }

        $command->setup()->execute()->tearDown();
    }
716442
private function cleanExtraCommandArgument(Command $command): void
    {
        $arguments = $command->getDefinition()->getArguments();
        if (! isset($arguments['command'])) {
            return;
        }

        unset($arguments['command']);
        $command->getDefinition()->setArguments($arguments);
    }
773886
final public function execute($command, AnCommandContext $context)
    {
        $identifier = $context->caller->getIdentifier();

        if ($context->entity instanceof AnDomainEntityAbstract) {
            $identifier = $context->entity->getIdentifier();
        }

        $type = $identifier->path;
        $type = array_pop($type);

        $parts = explode('.', $command);
        $method = '_'.($parts[0]).ucfirst($type).ucfirst($parts[1]);

        $result = null;

        if (method_exists($this, $method)) {
            $result = $this->$method($context);
        }

        if ($context->entity) {
            $result = $context->entity->execute($command, $context);
        }

        return $result;
    }