Execute this command.

@return int

@throws \ReflectionException
@throws \Windwalker\DI\Exception\DependencyResolutionException
@since  3.2.8
435448
protected function doExecute()
    {
        $file = $this->getArgument(0);
        $to   = $this->getArgument(1, $this->console->get('language.locale', 'en-GB'));
        $from = $this->getArgument(2, $this->console->get('language.default', 'en-GB'));

        if (!$file) {
            throw new WrongArgumentException('Please provide file name or use `*`.');
        }

        $package     = null;
        $packageName = $this->getOption('p');

        if ($packageName) {
            $resolver = ConsoleHelper::getAllPackagesResolver();
            $package  = $resolver->getPackage($packageName);

            if (!$package) {
                throw new \RuntimeException('Package: ' . $packageName . ' not found.');
            }
        }

        $langPath = $package ? $package->getDir() . '/Resources/language' : WINDWALKER_RESOURCES . '/languages';

        if ($file === '*') {
            $files = Folder::files($langPath . '/' . $from, true, Folder::PATH_RELATIVE);
        } else {
            $files = [$file];
        }

        $this->out();

        foreach ($files as $file) {
            $fromPath = $langPath . '/' . $from;
            $fromFile = $fromPath . '/' . $file;

            $toPath = $langPath . '/' . $to;
            $toFile = $toPath . '/' . $file;

            if (!is_file($fromFile)) {
                throw new \RuntimeException('File: ' . $fromFile . ' not exists.');
            }

            $structure = new Structure();

            $flat = $this->getOption('f');
            $sort = $this->getOption('s');

            $fromData = $structure->loadFile($fromFile, 'ini', ['processSections' => !$flat]);

            if (is_file($toFile)) {
                $structure->loadFile($toFile, 'ini', ['processSections' => !$flat, 'only_exists' => true]);
            }

            $data = $structure->toArray();

            if ($sort) {
                foreach ($data as $k => &$v) {
                    if (\is_array($v)) {
                        ksort($v);
                    }
                }

                unset($v);

                ksort($data);
            }

            $data    = IniFormat::structToString($data);
            $replace = $this->getOption('r');

            $dest = $replace ? $toFile : WINDWALKER_TEMP . '/language/' . $to . '/' . $file;

            File::write($dest, rtrim($data) . "\n");

            $this->out(sprintf('File handled: <info>%s</info>', $dest));
        }

        if (!$replace) {
            $this->out()->out('(You can use -r|--replace to just override language file instead save to tmp.)');
        }

        return true;
    }
163990
public function execute()
    {
        $phingExecutable = $this->phpci->findBinary('phing');

        $cmd[] = $phingExecutable . ' -f ' . $this->getBuildFilePath();

        if ($this->getPropertyFile()) {
            $cmd[] = '-propertyfile ' . $this->getPropertyFile();
        }

        $cmd[] = $this->propertiesToString();

        $cmd[] = '-logger phing.listener.DefaultLogger';
        $cmd[] = $this->targetsToString();
        $cmd[] = '2>&1';

        return $this->phpci->executeCommand(implode(' ', $cmd), $this->directory, $this->targets);
    }
458375
public function handle()
    {
        if (!$this->confirmToProceed()) {
            return;
        }

        $this->migrator->setConnection($this->option('database'));

        // First, we'll make sure that the migration table actually exists before we
        // start trying to rollback and re-run all of the migrations. If it's not
        // present we'll just bail out with an info message for the developers.
        if (!$this->migrator->repositoryExists()) {
            return $this->comment('Migration table not found.');
        }

        $this->migrator->reset(
            $this->getMigrationPaths(), $this->option('pretend')
        );

        // Once the migrator has run we will grab the note output and send it out to
        // the console screen, since the migrator itself functions without having
        // any instances of the OutputInterface contract passed into the class.
        foreach ($this->getMigratorNotes() as $note) {
            $this->output->writeln($note);
        }
    }
863228
public function fire()
    {
        parent::fire();

        if ($this->option('install-ruleset')) {
            if ($this->installRuleset()) {
                $this->info('Copied ruleset to '.$this->pathRulesetLocal);
            }
        }

        $this->info('Runing PHP Mess Detector...');

        $command = $this->pathCli.' ';
        $command.= base_path().'/'.$this->option('path').' ';
        $command.= 'text ';
        $command.= $this->pathRuleset;

        passthru($command, $exitCode);

        $this->info('Done.');

        return $exitCode;
    }
473288
public function fire()
	{
		if ( ! $this->migrator->repositoryExists())
		{
			return $this->error('No migrations found.');
		}

		$ran = $this->migrator->getRepository()->getRan();

		$migrations = [];

		foreach ($this->getAllMigrationFiles() as $migration)
		{
			$migrations[] = in_array($migration, $ran) ? ['<info>Y</info>', $migration] : ['<fg=red>N</fg=red>', $migration];
		}

		if (count($migrations) > 0)
		{
			$this->table(['Ran?', 'Migration'], $migrations);
		}
		else
		{
			$this->error('No migrations found');
		}
	}
1205543
public function execute()
    {
        if (empty($this->_filecontent)) {
            return;
        }

        if (defined('PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT') && (PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT === true)) {
            /*
             Ubuntu Landscape format:
             - line 1: packages to update
             - line 2: security packages to update
             */
            if (count($this->_filecontent) == 2) {
                foreach ($this->_filecontent as $line) {
                    list($num, $text) = explode(" ", $line, 2);
                    $this->_result[] = $num;
                }
            } else {
                $this->global_error->addWarning("Unable to parse UpdateNotifier file");
            }
        } else {
            /*
             Universal format: A;B
             - A: packages to update
             - B: security packages to update
             */
            if (count($this->_filecontent) == 1 && strpos($this->_filecontent[0], ";") !== false) {
                $this->_result = explode(";", $this->_filecontent[0]);
            } else {
                $this->global_error->addWarning("Unable to parse UpdateNotifier file");
            }
        }
    }
1128862
public function execute()
    {
        /** @var $composer \Composer\Composer */
        $composer = $this->getComposer();
        $io = $this->getIO();
        $config = $composer->getConfig();

        $optimize = $this->getOptions()->optimizeAutoloader() || $config->get('optimize-autoloader');
        $authoritative = $this->getOptions()->classmapAuthoritative() || $config->get('classmap-authoritative');

        $install = Installer::create($io, $composer)
            ->setDryRun($this->getOptions()->dryRun())
            ->setVerbose($this->getOptions()->verbose())
            ->setPreferSource($this->getOptions()->preferSource())
            ->setPreferDist($this->getOptions()->preferDist())
            ->setDevMode(!$this->getOptions()->noDev())
            ->setDumpAutoloader(!$this->getOptions()->noAutoloader())
            ->setRunScripts(!$this->getOptions()->noScripts())
            ->setOptimizeAutoloader($optimize)
            ->setClassMapAuthoritative($authoritative)
            ->setIgnorePlatformRequirements($this->getOptions()->ignorePlatformReqs())
        ;

        try {
            return $install->run();
        } catch (\Exception $e) {
            $msg = sprintf('%s received an error from Composer: %s in %s::%s', __METHOD__, $e->getMessage(), $e->getFile(), $e->getLine());
            $this->app['logger.system']->critical($msg, ['event' => 'exception', 'exception' => $e]);
            throw new PackageManagerException($e->getMessage(), $e->getCode(), $e);
        }
    }
69481
public function handle()
    {
        $model = $this->getAttachableModelInstanceForClass($this->argument('class'));

        $attachmentKeys = $this->getAttachmentsToProcess($model);

        if (empty($attachmentKeys)) {
            $this->warn('No attachments selected or available for this model, nothing to process.');
            return;
        }

        $query = $this->getModelInstanceQuery($model);
        $count = $query->count();

        $this->progressStart($count);
        
        foreach ($this->generateModelInstances($query, $count) as $instances) {
            /** @var \Illuminate\Support\Collection|Model[]|AttachableInterface[] $instances */
            foreach ($instances as $instance) {

                foreach ($instance->getAttachedFiles() as $attachmentKey => $attachment) {

                    if ( ! in_array($attachmentKey, $attachmentKeys)) {
                        continue;
                    }

                    $this->processAttachmentOnModelInstance($instance, $attachment);
                }

                $this->progressAdvance();
            }
        }

        $this->progressFinish();

        $this->info('Done.');
    }
740008
public function execute()
	{
		putenv('LINES=' . $this->terminal->getHeight());
		putenv('COLUMNS=' . $this->terminal->getWidth());

		$this->configureIO();

		try
		{
			$this->dispatchEvent(ApplicationEvents::BEFORE_EXECUTE);

			// Perform application routines.
			$exitCode = $this->doExecute();

			$this->dispatchEvent(ApplicationEvents::AFTER_EXECUTE);
		}
		catch (\Throwable $throwable)
		{
			if (!$this->shouldCatchThrowables())
			{
				throw $throwable;
			}

			$event = new ApplicationErrorEvent($throwable, $this, $this->runningCommand);

			$this->dispatchEvent(ConsoleEvents::APPLICATION_ERROR, $event);

			$exitCode = $event->getExitCode();

			if (is_numeric($exitCode))
			{
				$exitCode = (int) $exitCode;

				if ($exitCode === 0)
				{
					$exitCode = 1;
				}
			}
			else
			{
				$exitCode = 1;
			}
		}
		finally
		{
			if ($this->shouldAutoExit() && isset($exitCode))
			{
				$exitCode = $exitCode > 255 ? 255 : $exitCode;
				$this->close($exitCode);
			}
		}
	}
1321559
public function execute()
    {
        if ($this->counting) {
            return $this->executeCount();
        }

        if ($this->single) {
            return $this->executeSingle($this->entity_class);
        }

        return $this->executeCollection($this->entity_class);
    }
1297533
public function run()
    {
        foreach ($this->getCommands() as $command)
        {
            $this->transformer->transform($command);

            $this->application->add($command);
        }

        return $this->application->run();
    }
429715
public function handle()
    {
        $vendor = $this->getVendor();
        $package = $this->getPackage();

        $vendorFolderName = $this->getVendorFolderName($vendor);
        $packageFolderName = $this->getPackageFolderName($package);

        $relPackagePath = "packages/$vendorFolderName/$packageFolderName";
        $packagePath = base_path($relPackagePath);

        try {
            $this->createPackageFolder($packagePath);
            $this->registerPackage($vendorFolderName, $packageFolderName, $relPackagePath);
            $this->copySkeleton($packagePath, $vendor, $package, $vendorFolderName, $packageFolderName);
            $this->initRepo($packagePath);
            $this->composerUpdatePackage($vendorFolderName, $packageFolderName);
            $this->composerDumpAutoload();

            $this->info('Finished. Are you ready to write awesome package?');
        } catch (Exception $e) {
            $this->error($e->getMessage());

            return -1;
        }

        return 0;
    }
922510
public function run() {
        try {
            $this->command->execute($this->console, $this->parser->getArguments());
        } catch (\Exception $e) {
            $this->writeException($e);
            if ($this->exitOnException) {
                exit($e->getCode() ? : 1);
            }
            throw $e;
        }
    }
1038029
public function execute()
    {
        $output = [];
        $code = 0;

        exec(sprintf($this->command, $this->hgPath, $this) . " 2>&1", $output, $code);

        if ($code != 0) {
            throw new \RuntimeException(
                'An error occurred while using VersionControl_HG; hg returned: '
                . implode(PHP_EOL, $output),
                $code
            );
        }

        return implode(PHP_EOL, $output);
    }
1313073
public function execute()
    {
        list($ignore, $standard, $suffixes) = $this->getFlags();

        $phpcs = $this->phpci->findBinary('phpcs');

        $this->phpci->logExecOutput(false);

        $cmd = $phpcs . ' --report=json %s %s %s %s %s "%s"';
        $this->phpci->executeCommand(
            $cmd,
            $standard,
            $suffixes,
            $ignore,
            $this->tab_width,
            $this->encoding,
            $this->phpci->buildPath . $this->path
        );

        $output = $this->phpci->getLastOutput();
        list($errors, $warnings) = $this->processReport($output);

        $this->phpci->logExecOutput(true);

        $success = true;
        $this->build->storeMeta('phpcs-warnings', $warnings);
        $this->build->storeMeta('phpcs-errors', $errors);

        if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) {
            $success = false;
        }

        if ($this->allowed_errors != -1 && $errors > $this->allowed_errors) {
            $success = false;
        }

        return $success;
    }
1159079
public function handle()
    {
        $pluginManager = PluginManager::instance();
        $pluginName = $this->argument('name');
        $pluginName = $pluginManager->normalizeIdentifier($pluginName);

        if (!$pluginManager->hasPlugin($pluginName)) {
            return $this->error(sprintf('Unable to find a registered plugin called "%s"', $pluginName));
        }

        if (!$this->confirmToProceed(sprintf('This will DELETE plugin "%s" from the filesystem and database.', $pluginName))) {
            return;
        }

        /*
         * Rollback plugin
         */
        $manager = UpdateManager::instance()->setNotesOutput($this->output);
        $manager->rollbackPlugin($pluginName);

        /*
         * Delete from file system
         */
        if ($pluginPath = $pluginManager->getPluginPath($pluginName)) {
            File::deleteDirectory($pluginPath);
            $this->output->writeln(sprintf('<info>Deleted: %s</info>', $pluginName));
        }
    }
845721
public function fire()
    {
        $this->generators = new Collection();

        $this->generators->push(new MigrationGenerator([
            'name'   => 'create_' . snake_case(str_plural($this->argument('name'))) . '_table',
            'fields' => $this->option('fillable'),
            'force'  => $this->option('force'),
        ]));

        $modelGenerator = new ModelGenerator([
            'name'     => $this->argument('name'),
            'fillable' => $this->option('fillable'),
            'force'    => $this->option('force')
        ]);

        $this->generators->push($modelGenerator);

        $this->generators->push(new RepositoryInterfaceGenerator([
            'name'  => $this->argument('name'),
            'force' => $this->option('force'),
        ]));

        foreach ($this->generators as $generator) {
            $generator->run();
        }

        $model = $modelGenerator->getRootNamespace() . '\\' . $modelGenerator->getName();
        $model = str_replace([
            "\\",
            '/'
        ], '\\', $model);

        try {
            (new RepositoryEloquentGenerator([
                'name'      => $this->argument('name'),
                'rules'     => $this->option('rules'),
                'validator' => $this->option('validator'),
                'presenter' => $this->option('presenter'),
                'force'     => $this->option('force'),
                'model'     => $model
            ]))->run();
            $this->info("Repository created successfully.");
        } catch (FileAlreadyExistsException $e) {
            $this->error($this->type . ' already exists!');

            return false;
        }
    }