public function call(string $command, array $parameters = [], ?OutputInterface $outputBuffer = null): int
    {
        if (\is_subclass_of($command, SymfonyCommand::class)) {
            /** @var \Symfony\Component\Console\Command\Command $symfonyCommand */
            $symfonyCommand = $command;

            if (($commandName = $symfonyCommand::getDefaultName()) !== null) {
                $command = $commandName;
            }
        }

        if (! $this->has($command)) {
            throw new CommandNotFoundException(\sprintf('The command [%s] does not exist.', $command));
        }

        $this->lastOutput = $outputBuffer ?: new BufferedOutput();

        $this->setCatchExceptions(false);

        \array_unshift($parameters, $command);

        $input = new ArrayInput($parameters);

        if ($input->hasParameterOption(['--no-interaction'], true)) {
            $input->setInteractive(false);
        }

        $result = $this->run($input, $this->lastOutput);

        $this->setCatchExceptions(true);

        return $result;
    }
public function call(string $command, array $parameters = [], ?OutputInterface $outputBuffer = null): int
    {
        if (\is_subclass_of($command, SymfonyCommand::class)) {
            /** @var \Symfony\Component\Console\Command\Command $symfonyCommand */
            $symfonyCommand = $command;

            if (($commandName = $symfonyCommand::getDefaultName()) !== null) {
                $command = $commandName;
            }
        }

        if (! $this->has($command)) {
            throw new CommandNotFoundException(\sprintf('The command [%s] does not exist.', $command));
        }

        $this->lastOutput = $outputBuffer ?: new BufferedOutput();

        $this->setCatchExceptions(false);

        \array_unshift($parameters, $command);

        $input = new ArrayInput($parameters);

        if ($input->hasParameterOption(['--no-interaction'], true)) {
            $input->setInteractive(false);
        }

        $result = $this->run($input, $this->lastOutput);

        $this->setCatchExceptions(true);

        return $result;
    }
public function call ( string $ command , array $ parameters = [ ] , ? OutputInterface $ outputBuffer = null ) : int { if ( \ is_subclass_of ( $ command , SymfonyCommand :: class ) ) { /** @var \Symfony\Component\Console\Command\Command $symfonyCommand */ $ symfonyCommand = $ command ; if ( ( $ commandName = $ symfonyCommand :: getDefaultName ( ) ) !== null ) { $ command = $ commandName ; } } if ( ! $ this -> has ( $ command ) ) { throw new CommandNotFoundException ( \ sprintf ( 'The command [%s] does not exist.' , $ command ) ) ; } $ this -> lastOutput = $ outputBuffer ? : new BufferedOutput ( ) ; $ this -> setCatchExceptions ( false ) ; \ array_unshift ( $ parameters , $ command ) ; $ input = new ArrayInput ( $ parameters ) ; if ( $ input -> hasParameterOption ( [ '--no-interaction' ] , true ) ) { $ input -> setInteractive ( false ) ; } $ result = $ this -> run ( $ input , $ this -> lastOutput ) ; $ this -> setCatchExceptions ( true ) ; return $ result ; }
Run an console command by name.

@param string                                                 $command
@param array                                                  $parameters
@param null|\Symfony\Component\Console\Output\OutputInterface $outputBuffer

@throws \Throwable

@return int
Run an console command by name .