classes/phing/types/Commandline.php
public static function quoteArgument($argument, $escape = false)
    {
        if ($escape) {
            return escapeshellarg($argument);
        }

        if (strpos($argument, '"') !== false) {
            if (strpos($argument, "'") !== false) {
                throw new BuildException("Can't handle single and double quotes in same argument");
            }

            return '\'' . $argument . '\'';
        }

        if (strpos($argument, "'") !== false
            || strpos($argument, ' ') !== false
            // WIN9x uses a bat file for executing commands
            || (OsCondition::isFamily('win32') && strpos($argument, ';') !== false)
        ) {
            return '"' . $argument . '"';
        }

        return $argument;
    }
public static function quoteArgument($argument, $escape = false)
    {
        if ($escape) {
            return escapeshellarg($argument);
        }

        if (strpos($argument, '"') !== false) {
            if (strpos($argument, "'") !== false) {
                throw new BuildException("Can't handle single and double quotes in same argument");
            }

            return '\'' . $argument . '\'';
        }

        if (strpos($argument, "'") !== false
            || strpos($argument, ' ') !== false
            // WIN9x uses a bat file for executing commands
            || (OsCondition::isFamily('win32') && strpos($argument, ';') !== false)
        ) {
            return '"' . $argument . '"';
        }

        return $argument;
    }
public static function quoteArgument ( $ argument , $ escape = false ) { if ( $ escape ) { return escapeshellarg ( $ argument ) ; } if ( strpos ( $ argument , '"' ) !== false ) { if ( strpos ( $ argument , "'" ) !== false ) { throw new BuildException ( "Can't handle single and double quotes in same argument" ) ; } return '\'' . $ argument . '\'' ; } if ( strpos ( $ argument , "'" ) !== false || strpos ( $ argument , ' ' ) !== false // WIN9x uses a bat file for executing commands || ( OsCondition :: isFamily ( 'win32' ) && strpos ( $ argument , ';' ) !== false ) ) { return '"' . $ argument . '"' ; } return $ argument ; }
Put quotes around the given String if necessary.

<p>If the argument doesn't include spaces or quotes, return it
as is. If it contains double quotes, use single quotes - else
surround the argument by double quotes.</p>

@param $argument

@return string

@throws BuildException if the argument contains both, single
and double quotes.
Put quotes around the given String if necessary .