src/Rocketeer/Services/Connections/Shell/Modules/Core.php
public function run($commands, $silent = false, $array = false)
    {
        $commands = $this->processCommands($commands);
        $verbose = $this->getOption('verbose') && !$silent;
        $pretend = $this->getOption('pretend');

        // Gather any extra output of the server
        // to be able to clean it up after
        if ($this->extraOutput === null && !$pretend) {
            $this->extraOutput = $this->getExtraOutput();
        }

        // Log the commands
        if (!$silent) {
            $this->modulable->toHistory($commands);
        }

        // Display the commands if necessary
        if ($verbose || ($pretend && !$silent)) {
            $this->modulable->toOutput($commands);
            $this->displayCommands($commands);

            if ($pretend) {
                return count($commands) === 1 ? $commands[0] : $commands;
            }
        }

        // Run commands
        $output = null;
        $this->modulable->getConnection()->run($commands, function ($results) use (&$output, $verbose) {
            $output .= $results;

            if ($verbose) {
                $display = $this->cleanOutput($results);
                $this->explainer->server(trim($display));
            }
        });

        // Process and log the output and commands
        $output = $this->processOutput($output, $array, true);
        $this->modulable->toOutput($output);

        return $output;
    }
public function run($commands, $silent = false, $array = false)
    {
        $commands = $this->processCommands($commands);
        $verbose = $this->getOption('verbose') && !$silent;
        $pretend = $this->getOption('pretend');

        // Gather any extra output of the server
        // to be able to clean it up after
        if ($this->extraOutput === null && !$pretend) {
            $this->extraOutput = $this->getExtraOutput();
        }

        // Log the commands
        if (!$silent) {
            $this->modulable->toHistory($commands);
        }

        // Display the commands if necessary
        if ($verbose || ($pretend && !$silent)) {
            $this->modulable->toOutput($commands);
            $this->displayCommands($commands);

            if ($pretend) {
                return count($commands) === 1 ? $commands[0] : $commands;
            }
        }

        // Run commands
        $output = null;
        $this->modulable->getConnection()->run($commands, function ($results) use (&$output, $verbose) {
            $output .= $results;

            if ($verbose) {
                $display = $this->cleanOutput($results);
                $this->explainer->server(trim($display));
            }
        });

        // Process and log the output and commands
        $output = $this->processOutput($output, $array, true);
        $this->modulable->toOutput($output);

        return $output;
    }
public function run ( $ commands , $ silent = false , $ array = false ) { $ commands = $ this -> processCommands ( $ commands ) ; $ verbose = $ this -> getOption ( 'verbose' ) && ! $ silent ; $ pretend = $ this -> getOption ( 'pretend' ) ; // Gather any extra output of the server // to be able to clean it up after if ( $ this -> extraOutput === null && ! $ pretend ) { $ this -> extraOutput = $ this -> getExtraOutput ( ) ; } // Log the commands if ( ! $ silent ) { $ this -> modulable -> toHistory ( $ commands ) ; } // Display the commands if necessary if ( $ verbose || ( $ pretend && ! $ silent ) ) { $ this -> modulable -> toOutput ( $ commands ) ; $ this -> displayCommands ( $ commands ) ; if ( $ pretend ) { return count ( $ commands ) === 1 ? $ commands [ 0 ] : $ commands ; } } // Run commands $ output = null ; $ this -> modulable -> getConnection ( ) -> run ( $ commands , function ( $ results ) use ( & $ output , $ verbose ) { $ output .= $ results ; if ( $ verbose ) { $ display = $ this -> cleanOutput ( $ results ) ; $ this -> explainer -> server ( trim ( $ display ) ) ; } } ) ; // Process and log the output and commands $ output = $ this -> processOutput ( $ output , $ array , true ) ; $ this -> modulable -> toOutput ( $ output ) ; return $ output ; }
Run actions on the remote server and gather the ouput.

@param string|array $commands One or more commands
@param bool         $silent   Whether the command should stay silent no matter what
@param bool         $array    Whether the output should be returned as an array

@return string|null
Run actions on the remote server and gather the ouput .