Run the command.

@since  1.0.0

@param  InputInterface  $input  Command input.
@param  OutputInterface $output Command output.
@throws \Hodl\Exceptions\ContainerException
496129
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $created = $this->scaffold(
            'ajax',
            [
                'CLASSNAME' => $input->getArgument('name'),
            ],
            [
                'ACTION' => $input->getOption('action'),
            ]
        );

        if ($created === true) {
            $output->writeln("<info>{$input->getArgument('name')} was created successfully</info>");
        } else {
            $output->writeln("<error>{$input->getArgument('name')} could not be created</error>");
        }
    }
240834
public function run(
        ?string $command,
        $input = [],
        OutputInterface $output = null
    ): CommandOutput {
        if (is_array($input)) {
            $input = new ArrayInput($input + compact('command'));
        }
        $output = $output ?? new BufferedOutput();

        $command = $this->getApplication()->find($command);
        $code = ContainerScope::runScope($this->container, function () use (
            $command,
            $input,
            $output
        ) {
            return $command->run($input, $output);
        });

        return new CommandOutput($code ?? self::CODE_NONE, $output);
    }
1367468
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $aliasName = $input->getArgument('aliasName');
        $aliasClass = $input->getArgument('aliasClass');
        $this->alias($aliasName, $aliasClass);
    }
755651
public function doRun(InputInterface $input, OutputInterface $output)
    {
        if (!$this->commandsRegistered) {
            $this->registerCommands();

            $this->commandsRegistered = true;
        }

        return parent::doRun($input, $output);
    }
391571
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemaRelations($this->fetchSchemaOid()
        );
        $this->formatOutput($output, $info);
    }
174037
protected function execute(InputInterface $input, OutputInterface $output) : void
    {
        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'), true);
        $repo   = new Repository();
        $args   = new Config\Options(['file' => $input->getOption('message')]);
        $name   = $input->getArgument('hook');
        $class  = '\\CaptainHook\\App\\Runner\\Hook\\' . Util::getHookCommand($name);

        /** @var \CaptainHook\App\Runner\Hook $hook */
        $hook = new $class($io, $config, $repo, $args);
        $hook->run();
    }
623294
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $outputFile = null;
        if ($file = $input->getOption('output-file')) {
            $outputFile = $file;
        }
        $this->service($input->getArgument($this->argument), $outputFile);
    }
342706
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $runner = new RunCommand($this->logger);
        $runner->setMaxBuilds(1);
        $runner->setDaemon(false);

        /** @var \PHPCI\Store\BuildStore $store */
        $store = Factory::getStore('Build');
        $service = new BuildService($store);

        $builds = $store->getLatestBuilds(null, 1);
        $lastBuild = array_shift($builds);
        $service->createDuplicateBuild($lastBuild);

        $runner->run(new ArgvInput(array()), $output);
    }
538142
protected function runCommand(InputInterface $input, OutputInterface $output)
    {
        list($appUUID, $indices) = $this->getRepositoryAndIndices($input, $output);
        $endpoints = $this->getEndpoints($input);

        $this
            ->repositoryBucket->findRepository($input->getArgument('app-name'))
            ->addToken(
                new Token(
                    TokenUUID::createById($input->getArgument('uuid')),
                    $appUUID,
                    $indices,
                    $endpoints,
                    $input->getOption('plugin'),
                    (int) $input->getOption('ttl')
                )
            );
    }
653255
protected function runCommand(InputInterface $input, OutputInterface $output)
    {
        $repository = $this->getRepository($input, $output);
        $file = $input->getArgument('file');

        self::exportToFile(
            $file,
            $output,
            function (Query $query) use ($repository) {
                return $repository->query($query);
            }
        );
    }
186021
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dir = $input->getArgument('dir');

        Console::setCustomEnvDirectory($dir);

        $output->writeln('### ENV directory has been set to '.$dir.' ###');
    }
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());
        }
    }
99220
protected function execute(Input $input, Output $output)
    {
        $command = $this->container->get($this->serviceId);

        return $command($input, $output);
    }
267698
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $doctrine = $container->get('doctrine');
        $manager = $doctrine->getManager();

        /** @var Connection $connection */
        $connection = $doctrine->getConnection();

        /** @var JobRepository $jobsRepository */
        $jobsRepository = $manager->getRepository(Job::class);

        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $jobsRepository->createQueryBuilder('j');

        $queryBuilder->select('MAX(j.createdAt) AS createdAt , j.command, j.args');

        $queryBuilder->where($queryBuilder->expr()->notIn('j.state', ['new', 'pending', 'running']));

        $queryBuilder->orderBy('j.createdAt', 'desc');

        $queryBuilder->groupBy('j.command', 'j.args');

        $jobs = $queryBuilder->getQuery()->getArrayResult();

        /** @var Job $job */
        foreach ($jobs as $job) {
            $output->writeln($job['command'] . ' ' . implode(' ', $job['args']));

            $queryBuilder = $jobsRepository->createQueryBuilder('j');

            $queryBuilder->where($queryBuilder->expr()->notIn('j.state', ['new', 'pending', 'running']));

            $queryBuilder->andWhere('j.command = :command');
            $queryBuilder->andWhere('j.args = :args');

            $queryBuilder->andWhere('j.createdAt < :createdAt');

            $queryBuilder->setParameter('command', $job['command']);
            $queryBuilder->setParameter('args', $job['args'], Type::JSON_ARRAY);

            $queryBuilder->setParameter('createdAt', $job['createdAt']);

            $queryBuilder->select('j.id');

            $ids = $queryBuilder->getQuery()->getArrayResult();

            foreach ($ids as $item) {
                $connection->executeQuery('DELETE FROM jms_job_related_entities WHERE job_id = :id', ['id' => $item['id']]);
                $connection->executeQuery('DELETE FROM jms_job_dependencies WHERE dest_job_id = :id', ['id' => $item['id']]);
                $connection->executeQuery('DELETE FROM jms_jobs WHERE id = :id', ['id' => $item['id']]);
            }
        }
    }
392693
protected function execute(InputInterface $input, OutputInterface $output): void
    {
        $this->validateInput($input);

        if ($input->getOption('parameters')) {
            if (!$this->getContainer() instanceof Container) {
                return;
            }
            $parameters = $this->getContainer()->getParameterBag()->all();

            // Sort parameters alphabetically
            ksort($parameters);

            $this->outputParameters($output, $parameters);

            return;
        }

        $parameter = $input->getOption('parameter');
        if (null !== $parameter) {
            $output->write($this->formatParameter($this->getContainer()->getParameter($parameter)));

            return;
        }

        if ($input->getOption('tags')) {
            $this->outputTags($output, $input->getOption('show-private'));

            return;
        }

        $tag = $input->getOption('tag');
        $serviceIds = [];
        if ($this->getContainer() instanceof ContainerBuilder) {
            if (null !== $tag) {
                $serviceIds = array_keys($this->getContainer()->findTaggedServiceIds($tag));
            } else {
                $serviceIds = $this->getContainer()->getServiceIds();
            }
        }

        // sort so that it reads like an index of services
        asort($serviceIds);

        $name = $input->getArgument('name');
        if ($name) {
            $this->outputService($output, $name);
        } else {
            $this->outputServices($output, $serviceIds, $input->getOption('show-private'), $tag);
        }
    }
901798
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (! class_exists('ZipArchive')) {
            throw new RuntimeException('The Zip PHP extension is not installed. Please install it and try again.');
        }

        $directory = ($input->getArgument('name')) ? getcwd().'/'.$input->getArgument('name') : getcwd();

        if ($input->getOption('with-docker') || $input->getOption('docker-only')) {
            $output->writeln('<info>Creating docker-compose...</info>');
            $this->makeDocker($directory, $input);
            $output->writeln('<comment>Done!</comment>');
        }

        if (!$input->getOption('docker-only')) {
            $output->writeln('<info>Creating Laravel skeleton...</info>');

            $this->download($zipFile = $this->makeFilename())
                ->removeFiles($directory, $output)
                ->extract($zipFile, $directory, $output)
                ->removeUserModel($directory)
                ->cleanUp($zipFile);

            $composer = $this->findComposer();
            $commands = [
                $composer.' update',
            ];

            $process = new Process(implode(' && ', $commands), $directory, null, null, null);
            if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
                $process->setTty(true);
            }
            $process->run(
                function ($type, $line) use ($output) {
                    $output->write($line);
                }
            );

            $output->writeln('<comment>Done! Do something!</comment>');
        }
    }
1281580
public function run(InputInterface $input = null, OutputInterface $output = null)
    {
        if ($input !== null) {
            $in = $input;
        } else {
            $in = $this->getInput();
        }

        return parent::run($in, $output);
    }