src/Rocketeer/Services/Connections/Shell/Modules/Core.php
public function processCommands($commands)
    {
        $separator = $this->environment->getSeparator();
        $shell = $this->config->getContextually('remote.shell');
        $shelled = $this->config->getContextually('remote.shelled');
        $sudo = $this->config->getContextually('remote.sudo');
        $sudoed = $this->config->getContextually('remote.sudoed');

        // Prepare paths replacer
        $pattern = sprintf('#\%s([\w\d\s])#', DS);
        $replacement = sprintf('\%s$1', $separator);

        // Cast commands to array
        if (!is_array($commands)) {
            $commands = [$commands];
        }

        // Flatten and process commands
        $commands = Arr::flatten($commands);
        foreach ($commands as &$command) {
            // Replace directory separators
            if (DS !== $separator) {
                $command = preg_replace($pattern, $replacement, $command);
            }

            // Let framework process commands
            if ($framework = $this->getFramework()) {
                $command = $framework->processCommand($command);
            }

            // Create shell if asked
            $forceShell = $this->modulable->getOption('shelled', true);
            if ($forceShell || $shell && Str::contains($command, $shelled)) {
                $command = $this->shellCommand($command);
            }

            if ($sudo && Str::contains($command, $sudoed)) {
                $command = $this->sudoCommand($sudo, $command);
            }
        }

        return $commands;
    }
public function processCommands($commands)
    {
        $separator = $this->environment->getSeparator();
        $shell = $this->config->getContextually('remote.shell');
        $shelled = $this->config->getContextually('remote.shelled');
        $sudo = $this->config->getContextually('remote.sudo');
        $sudoed = $this->config->getContextually('remote.sudoed');

        // Prepare paths replacer
        $pattern = sprintf('#\%s([\w\d\s])#', DS);
        $replacement = sprintf('\%s$1', $separator);

        // Cast commands to array
        if (!is_array($commands)) {
            $commands = [$commands];
        }

        // Flatten and process commands
        $commands = Arr::flatten($commands);
        foreach ($commands as &$command) {
            // Replace directory separators
            if (DS !== $separator) {
                $command = preg_replace($pattern, $replacement, $command);
            }

            // Let framework process commands
            if ($framework = $this->getFramework()) {
                $command = $framework->processCommand($command);
            }

            // Create shell if asked
            $forceShell = $this->modulable->getOption('shelled', true);
            if ($forceShell || $shell && Str::contains($command, $shelled)) {
                $command = $this->shellCommand($command);
            }

            if ($sudo && Str::contains($command, $sudoed)) {
                $command = $this->sudoCommand($sudo, $command);
            }
        }

        return $commands;
    }
public function processCommands ( $ commands ) { $ separator = $ this -> environment -> getSeparator ( ) ; $ shell = $ this -> config -> getContextually ( 'remote.shell' ) ; $ shelled = $ this -> config -> getContextually ( 'remote.shelled' ) ; $ sudo = $ this -> config -> getContextually ( 'remote.sudo' ) ; $ sudoed = $ this -> config -> getContextually ( 'remote.sudoed' ) ; // Prepare paths replacer $ pattern = sprintf ( '#\%s([\w\d\s])#' , DS ) ; $ replacement = sprintf ( '\%s$1' , $ separator ) ; // Cast commands to array if ( ! is_array ( $ commands ) ) { $ commands = [ $ commands ] ; } // Flatten and process commands $ commands = Arr :: flatten ( $ commands ) ; foreach ( $ commands as & $ command ) { // Replace directory separators if ( DS !== $ separator ) { $ command = preg_replace ( $ pattern , $ replacement , $ command ) ; } // Let framework process commands if ( $ framework = $ this -> getFramework ( ) ) { $ command = $ framework -> processCommand ( $ command ) ; } // Create shell if asked $ forceShell = $ this -> modulable -> getOption ( 'shelled' , true ) ; if ( $ forceShell || $ shell && Str :: contains ( $ command , $ shelled ) ) { $ command = $ this -> shellCommand ( $ command ) ; } if ( $ sudo && Str :: contains ( $ command , $ sudoed ) ) { $ command = $ this -> sudoCommand ( $ sudo , $ command ) ; } } return $ commands ; }
Process an array of commands.

@param string|array $commands

@return array
Process an array of commands .