VersionPress\Utils\ProcessUtils::escapeshellargLinux PHP Method

escapeshellargLinux() private static method

Linux shell escaping from Drush: http://drupalcontrib.org/api/drupal/contributions!drush!includes!exec.inc/function/_drush_escapeshellarg_linux/7
private static escapeshellargLinux ( $arg ) : mixed | string
$arg
return mixed | string
    private static function escapeshellargLinux($arg)
    {
        // For single quotes existing in the string, we will "exit"
        // single-quote mode, add a \' and then "re-enter"
        // single-quote mode.  The result of this is that
        // 'quote' becomes '\''quote'\''
        $arg = preg_replace('/\'/', '\'\\\'\'', $arg);
        // Replace "\t", "\n", "\r", "\0", "\x0B" with a whitespace.
        // Note that this replacement makes Drush's escapeshellarg work differently
        // than the built-in escapeshellarg in PHP on Linux, as these characters
        // usually are NOT replaced. However, this was done deliberately to be more
        // conservative when running _drush_escapeshellarg_linux on Windows
        // (this can happen when generating a command to run on a remote Linux server.)
        $arg = str_replace(["\t", "\n", "\r", "", "\v"], ' ', $arg);
        // Add surrounding quotes.
        $arg = "'" . $arg . "'";
        return $arg;
    }