protected function sanitizeCommandArguments(array $arguments)
    {
        $args       = array();
        $files      = array();
        $fileMode   = false;
        foreach ($arguments as $k => $v) {
            if ($v === '--' || $k === '--') {
                $fileMode   = true;
                continue;
            }
            if (is_int($k)) {
                if (strpos($v, '-') === 0) {
                    $args[]  = $this->sanitizeCommandArgument($v, null);
                } else if ($fileMode) {
                    $files[] = escapeshellarg($v);
                } else {
                    $args[]  = escapeshellarg($v);
                }
            } else {
                if (strpos($k, '-') === 0) {
                    $args[] = $this->sanitizeCommandArgument($k, $v);
                }
            }
        }
        return array($args, $files);
    }
protected function sanitizeCommandArguments(array $arguments)
    {
        $args       = array();
        $files      = array();
        $fileMode   = false;
        foreach ($arguments as $k => $v) {
            if ($v === '--' || $k === '--') {
                $fileMode   = true;
                continue;
            }
            if (is_int($k)) {
                if (strpos($v, '-') === 0) {
                    $args[]  = $this->sanitizeCommandArgument($v, null);
                } else if ($fileMode) {
                    $files[] = escapeshellarg($v);
                } else {
                    $args[]  = escapeshellarg($v);
                }
            } else {
                if (strpos($k, '-') === 0) {
                    $args[] = $this->sanitizeCommandArgument($k, $v);
                }
            }
        }
        return array($args, $files);
    }
protected function sanitizeCommandArguments ( array $ arguments ) { $ args = array ( ) ; $ files = array ( ) ; $ fileMode = false ; foreach ( $ arguments as $ k => $ v ) { if ( $ v === '--' || $ k === '--' ) { $ fileMode = true ; continue ; } if ( is_int ( $ k ) ) { if ( strpos ( $ v , '-' ) === 0 ) { $ args [ ] = $ this -> sanitizeCommandArgument ( $ v , null ) ; } else if ( $ fileMode ) { $ files [ ] = escapeshellarg ( $ v ) ; } else { $ args [ ] = escapeshellarg ( $ v ) ; } } else { if ( strpos ( $ k , '-' ) === 0 ) { $ args [ ] = $ this -> sanitizeCommandArgument ( $ k , $ v ) ; } } } return array ( $ args , $ files ) ; }
Sanitizes a list of command line arguments and splits them into args and files

@param   array       $arguments      The list of arguments
@return  array                       An array with (args, files)
Sanitizes a list of command line arguments and splits them into args and files