classes/phing/system/io/WindowsFileSystem.php
protected function normalizer($strPath, $len, $offset)
    {
        if ($len == 0) {
            return $strPath;
        }
        if ($offset < 3) {
            $offset = 0; //Avoid fencepost cases with UNC pathnames
        }
        $src = 0;
        $slash = $this->slash;
        $sb = "";

        if ($offset == 0) {
            // Complete normalization, including prefix
            $src = $this->normalizePrefix($strPath, $len, $sb);
        } else {
            // Partial normalization
            $src = $offset;
            $sb .= substr($strPath, 0, $offset);
        }

        // Remove redundant slashes from the remainder of the path, forcing all
        // slashes into the preferred slash
        while ($src < $len) {
            $c = $strPath{$src++};
            if ($this->isSlash($c)) {
                while (($src < $len) && $this->isSlash($strPath{$src})) {
                    $src++;
                }
                if ($src === $len) {
                    /* Check for trailing separator */
                    $sn = (int) strlen($sb);
                    if (($sn == 2) && ($sb{1} === ':')) {
                        // "z:\\"
                        $sb .= $slash;
                        break;
                    }
                    if ($sn === 0) {
                        // "\\"
                        $sb .= $slash;
                        break;
                    }
                    if (($sn === 1) && ($this->isSlash($sb{0}))) {
                        /* "\\\\" is not collapsed to "\\" because "\\\\" marks
                        the beginning of a UNC pathname.  Even though it is
                        not, by itself, a valid UNC pathname, we leave it as
                        is in order to be consistent with the win32 APIs,
                        which treat this case as an invalid UNC pathname
                        rather than as an alias for the root directory of
                        the current drive. */
                        $sb .= $slash;
                        break;
                    }
                    // Path does not denote a root directory, so do not append
                    // trailing slash
                    break;
                } else {
                    $sb .= $slash;
                }
            } else {
                $sb .= $c;
            }
        }
        $rv = (string) $sb;

        return $rv;
    }
protected function normalizer($strPath, $len, $offset)
    {
        if ($len == 0) {
            return $strPath;
        }
        if ($offset < 3) {
            $offset = 0; //Avoid fencepost cases with UNC pathnames
        }
        $src = 0;
        $slash = $this->slash;
        $sb = "";

        if ($offset == 0) {
            // Complete normalization, including prefix
            $src = $this->normalizePrefix($strPath, $len, $sb);
        } else {
            // Partial normalization
            $src = $offset;
            $sb .= substr($strPath, 0, $offset);
        }

        // Remove redundant slashes from the remainder of the path, forcing all
        // slashes into the preferred slash
        while ($src < $len) {
            $c = $strPath{$src++};
            if ($this->isSlash($c)) {
                while (($src < $len) && $this->isSlash($strPath{$src})) {
                    $src++;
                }
                if ($src === $len) {
                    /* Check for trailing separator */
                    $sn = (int) strlen($sb);
                    if (($sn == 2) && ($sb{1} === ':')) {
                        // "z:\\"
                        $sb .= $slash;
                        break;
                    }
                    if ($sn === 0) {
                        // "\\"
                        $sb .= $slash;
                        break;
                    }
                    if (($sn === 1) && ($this->isSlash($sb{0}))) {
                        /* "\\\\" is not collapsed to "\\" because "\\\\" marks
                        the beginning of a UNC pathname.  Even though it is
                        not, by itself, a valid UNC pathname, we leave it as
                        is in order to be consistent with the win32 APIs,
                        which treat this case as an invalid UNC pathname
                        rather than as an alias for the root directory of
                        the current drive. */
                        $sb .= $slash;
                        break;
                    }
                    // Path does not denote a root directory, so do not append
                    // trailing slash
                    break;
                } else {
                    $sb .= $slash;
                }
            } else {
                $sb .= $c;
            }
        }
        $rv = (string) $sb;

        return $rv;
    }
protected function normalizer ( $ strPath , $ len , $ offset ) { if ( $ len == 0 ) { return $ strPath ; } if ( $ offset < 3 ) { $ offset = 0 ; //Avoid fencepost cases with UNC pathnames } $ src = 0 ; $ slash = $ this -> slash ; $ sb = "" ; if ( $ offset == 0 ) { // Complete normalization, including prefix $ src = $ this -> normalizePrefix ( $ strPath , $ len , $ sb ) ; } else { // Partial normalization $ src = $ offset ; $ sb .= substr ( $ strPath , 0 , $ offset ) ; } // Remove redundant slashes from the remainder of the path, forcing all // slashes into the preferred slash while ( $ src < $ len ) { $ c = $ strPath { $ src ++ } ; if ( $ this -> isSlash ( $ c ) ) { while ( ( $ src < $ len ) && $ this -> isSlash ( $ strPath { $ src } ) ) { $ src ++ ; } if ( $ src === $ len ) { /* Check for trailing separator */ $ sn = ( int ) strlen ( $ sb ) ; if ( ( $ sn == 2 ) && ( $ sb { 1 } === ':' ) ) { // "z:\\" $ sb .= $ slash ; break ; } if ( $ sn === 0 ) { // "\\" $ sb .= $ slash ; break ; } if ( ( $ sn === 1 ) && ( $ this -> isSlash ( $ sb { 0 } ) ) ) { /* "\\\\" is not collapsed to "\\" because "\\\\" marks
                        the beginning of a UNC pathname.  Even though it is
                        not, by itself, a valid UNC pathname, we leave it as
                        is in order to be consistent with the win32 APIs,
                        which treat this case as an invalid UNC pathname
                        rather than as an alias for the root directory of
                        the current drive. */ $ sb .= $ slash ; break ; } // Path does not denote a root directory, so do not append // trailing slash break ; } else { $ sb .= $ slash ; } } else { $ sb .= $ c ; } } $ rv = ( string ) $ sb ; return $ rv ; }
Normalize the given pathname, whose length is len, starting at the given
offset; everything before this offset is already normal.

@param  $strPath
@param  $len
@param  $offset
@return string
Normalize the given pathname whose length is len starting at the given offset ; everything before this offset is already normal .