Executa o algoritmo do comando de terminal.

@return mixed
778631
public function handle()
    {
        $command = new ObfuscatePkg;
        $command->setArguments($this->arguments());

        if ($command->execute() === true) {

            echo shell_exec("composer dump-autoload");

            $this->info("A aplicação foi ofuscada com sucesso");
            $path_backup = $command->getBackupPath();
            $this->info("Um backup da aplicação original se encontra em {$path_backup}");

            return true;
        }

        $errors = $command->getObfuscator()->getErrorMessages();
        foreach ($errors as $message) {
            $this->error($message);
        }

        $runtime = $command->getObfuscator()->getRuntimeMessages();
        foreach ($runtime as $message) {
            $this->info($message);
        }

        return false;

    }
467834
public function execute()
    {
        $curdir = getcwd();
        chdir($this->phpci->buildPath);

        $behat = $this->executable;

        if (!$behat) {
            $this->phpci->logFailure(Lang::get('could_not_find', 'behat'));

            return false;
        }

        $success = $this->phpci->executeCommand($behat . ' %s', $this->features);
        chdir($curdir);

        list($errorCount, $data) = $this->parseBehatOutput();

        $this->build->storeMeta('behat-warnings', $errorCount);
        $this->build->storeMeta('behat-data', $data);

        return $success;
    }
786166
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        if (preg_match('/\+A\w+-?/m', $this->value)) {
            if (function_exists('mb_convert_encoding')) {
                $this->value .= "\n".mb_convert_encoding($this->value, 'UTF-8', 'UTF-7');
            } else {
                //list of all critical UTF7 codepoints
                $schemes = [
                    '+ACI-'      => '"',
                    '+ADw-'      => '<',
                    '+AD4-'      => '>',
                    '+AFs-'      => '[',
                    '+AF0-'      => ']',
                    '+AHs-'      => '{',
                    '+AH0-'      => '}',
                    '+AFw-'      => '\\',
                    '+ADs-'      => ';',
                    '+ACM-'      => '#',
                    '+ACY-'      => '&',
                    '+ACU-'      => '%',
                    '+ACQ-'      => '$',
                    '+AD0-'      => '=',
                    '+AGA-'      => '`',
                    '+ALQ-'      => '"',
                    '+IBg-'      => '"',
                    '+IBk-'      => '"',
                    '+AHw-'      => '|',
                    '+ACo-'      => '*',
                    '+AF4-'      => '^',
                    '+ACIAPg-'   => '">',
                    '+ACIAPgA8-' => '">',
                ];

                $this->value = str_ireplace(
                    array_keys($schemes),
                    array_values($schemes),
                    $this->value
                );
            }
        }

        return $this->value;
    }
455391
public function getAvgExecutionTime(): float
    {
        return $this->getTotalExecutionTime() ? ($this->getTotalExecutionTime() / \count($this->data['commands'])) : (float) 0;
    }
416019
public function sniffCode() {
    $task = $this->taskExecStack()
      ->dir($this->bltRoot)
      ->exec("{$this->bin}/phpcs")
      ->exec("composer validate");
    $result = $task->run();

    return $result->getExitCode();
  }
869499
public function execute()
    {
        $curdir = getcwd();
        chdir($this->workingdir);

        $phpcsfixer = $this->phpci->findBinary('php-cs-fixer');

        $cmd = $phpcsfixer . ' fix . %s %s %s';
        $success = $this->phpci->executeCommand($cmd, $this->verbose, $this->diff, $this->level);

        chdir($curdir);

        return $success;
    }
624924
public function completeCommand()
    {
        $arguments = array_slice($GLOBALS['argv'], 3);
        $position = (int)$arguments[0];

        $arguments = array_slice($arguments, 1);

        $count = count($arguments);

        $controller = null;
        if ($count > 1) {
            $controller = $arguments[1];
        }

        $command = null;
        if ($count > 2) {
            $command = $arguments[2];
            if ($command !== '' && $command[0] === '-') {
                $command = 'default';
            }
        }

        $previous = $position > 0 ? $arguments[$position - 1] : null;

        $current = isset($arguments[$position]) ? $arguments[$position] : '';

        if ($position === 1) {
            $words = $this->_getControllers();
        } elseif ($current !== '' && $current[0] === '-') {
            $words = $this->_getArgumentNames($controller, $command);
        } elseif ($position === 2) {
            $words = $this->_getCommands($controller);
        } else {
            $words = $this->_getArgumentValues($controller, $command, $previous);
        }

        $this->console->writeLn(implode(' ', $this->_filterWords($words, $current)));

        return 0;
    }
817872
public function execute()
    {
        $cmd = $this->executable;

        if ($this->args !== null) {
            $cmd .= " {$this->args}";
        }
        if ($this->config !== null) {
            $cmd .= " -c '{$this->config}'";
        }
        if ($this->directory !== null) {
            $dirPath = $this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->directory;
            $cmd .= " -d '{$dirPath}'";
        }
        chdir($this->phpci->buildPath);
        $output = '';
        $status = true;
        exec($cmd, $output);

        if (count(preg_grep("/Success \(/", $output)) == 0) {
            $status = false;
            $this->phpci->log($output);
        }
        if (count($output) == 0) {
            $status = false;
            $this->phpci->log(Lang::get('no_tests_performed'));
        }
        
        return $status;
    }
774116
public function execute() {
        $this->log
            ->printAsMessage()
            ->info($this->getDescription())
            ->printEmptyLine()
            ->printAsOutput();

        ksort($this->config['commands']);

        $maxCommandLength = 0;

        foreach (array_keys($this->config['commands']) as $command) {
            if (is_string($command) && strlen($command) > $maxCommandLength) {
                $maxCommandLength = strlen($command);
            }
        }

        $tab = 4;
        $minLength = $tab * (int) ($maxCommandLength / $tab) + $tab;

        foreach ($this->config['commands'] as $command => $details) {
            $this->log->info(
                str_pad($command, $minLength) . '<dim>' . $details['description'] . '</dim>'
            );
        }

        return $this;
    }
604521
protected function executeCommand()
    {
        return $this->client->lrange($this->key, $this->position + 1, $this->position + $this->count);
    }
973456
public function run()
    {
        //Bogus variable set. The original value is never used, but IDEs complain
        $result = new Result();
        $resultArray = array();
        $max = count($this->commands);

        for ($i = 0; $i < $max; ++$i) {
            $cmd = $this->commands[$i];

            if ($i === 0) {
                $resultArray[] = $result = $cmd->run();
                continue;
            }

            if (($cmd->_runMode === RUN_IF_PREVIOUS_SUCCEEDS && $result->getExitCode() !== 0) ||
                ($cmd->_runMode === RUN_IF_PREVIOUS_FAILS && $result->getExitCode() === 0)
            ) {
                continue;
            }

            if ($cmd->_pipe) {
                $stdOut = trim($result->getStdOut());

                $isXArg = false;
                foreach ($cmd as $argIdx => $arg) {
                    if ($arg instanceof Argument) {
                        if (stripos($arg->getKey(true), PIPE_PH) !== false) {
                            $key = str_replace(PIPE_PH, $stdOut, $arg->getKey(true));
                            $arg->setKey($key);
                        }

                        $values = $arg->getValues();
                        foreach ($values as $index => $val) {
                            if (stripos($val, PIPE_PH) !== false) {
                                $val = str_replace(PIPE_PH, $stdOut, $val);
                                $arg->replaceValue($index, $val);
                                $isXArg = true;
                            }
                        }
                    }
                }
                if (!$isXArg) {
                    $cmd->setStdIn($stdOut);
                }
            }

            $resultArray[] = $result = $cmd->run();
        }

        return $resultArray;
    }
158802
public function executeCommand()
    {
        $this->adapter->setCommandArray($this->commandArray);
        $result = $this->adapter->execute();
        $commandArrayUsed = $this->adapter->getCommandArray();
        $this->clearCommandArray();
        $this->checkResultForError($result, $commandArrayUsed);
        return $result;
    }
88873
public function current()
    {
        if ($this->current instanceof TerminalBucket) {
            return null;
        }

        /** @var KeyValueBucket $current */
        $current = $this->current;

        return $current->value();
    }
65735
public function env()
    {
        $token = $this->Vault->getVaultToken();
        if (empty($token)) {
            return $this->abort('Token file does not exist - call "create" first');
        }

        $this->out('export VAULT_ADDR="http://127.0.0.1:8200" VAULT_TOKEN="' . $token . '";');
        $this->out('echo "You can now execute Vault commands using the \"vault\" CLI tool";');
    }
1328145
protected function _command() {
        $class = '\Gcs\Framework\Core\Terminal\Terminal' . ucfirst($this->_argv[0]);

        if (isset($this->_argv[1])) {
            $method = $this->_argv[1];
        }
        else if ($this->_argv[0] == 'help') {
            $method = 'help';
        }
        else {
            $method = '';
        }

        if (method_exists($class, $method)) {
            $instance = new $class($this->_argv);
            $instance->$method($this->_argv);
        }
        else {
            if (isset($this->_argv[1])) {
                echo '[ERROR] unrecognized command "' . $this->_argv[0] . ' ' . $this->_argv[1] . '"';
            }
            else {
                echo '[ERROR] unrecognized command "' . $this->_argv[0] . '"\n';
            }
        }
    }
514842
public function execute()
	{
		if (count($this->children) && count($this->input->args))
		{
			$name = $this->input->args[0];

			try
			{
				return $this->executeSubCommand($name);
			}
			catch (CommandNotFoundException $e)
			{
				$e->getCommand()->renderAlternatives($e->getChild(), $e);

				return $e->getCode();
			}
			catch (\Exception $e)
			{
				$this->renderException($e);

				return $e->getCode();
			}
		}

		if ($this->handler)
		{
			if ($this->handler instanceof \Closure)
			{
				$code = $this->handler;

				return $code($this);
			}
			elseif (is_callable($this->handler))
			{
				return call_user_func($this->handler, $this);
			}
		}

		return $this->doExecute();
	}
709767
protected function getPHPExecutable()
    {
        $validExecutable = false;
        $output = array();
        $exec = 'php';
        if ( !empty( $this->Options['php-exec'] ) )
        {
            $exec = $this->Options['php-exec'];
        }
        exec( $exec . ' -v', $output );

        if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
        {
            $validExecutable = true;
            $this->Executable = $exec;
        }

        while( !$validExecutable )
        {
            $input = readline( 'Enter path to PHP-CLI executable ( or [q] to quit )' );
            if ( $input === 'q' )
            {
                $this->Script->shutdown( 0 );
            }

            exec( $input . ' -v', $output );

            if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
            {
                $validExecutable = true;
                $this->Executable = $input;
            }
        }
    }