src/Traits/PathTrait.php
private function myDirectoryToString(string $directorySeparator, ?callable $stringEncoder = null): string
    {
        $result = '';

        if ($this->myAboveBaseLevel > 0) {
            $result .= str_repeat('..' . $directorySeparator, $this->myAboveBaseLevel);
        }

        if ($this->myIsAbsolute) {
            $result .= $directorySeparator;
        }

        $result .= implode($directorySeparator, $stringEncoder !== null ?
            array_map($stringEncoder, $this->myDirectoryParts) :
            $this->myDirectoryParts);

        if (count($this->myDirectoryParts) > 0) {
            $result .= $directorySeparator;
        }

        return $result;
    }
private function myDirectoryToString(string $directorySeparator, ?callable $stringEncoder = null): string
    {
        $result = '';

        if ($this->myAboveBaseLevel > 0) {
            $result .= str_repeat('..' . $directorySeparator, $this->myAboveBaseLevel);
        }

        if ($this->myIsAbsolute) {
            $result .= $directorySeparator;
        }

        $result .= implode($directorySeparator, $stringEncoder !== null ?
            array_map($stringEncoder, $this->myDirectoryParts) :
            $this->myDirectoryParts);

        if (count($this->myDirectoryParts) > 0) {
            $result .= $directorySeparator;
        }

        return $result;
    }
private function myDirectoryToString ( string $ directorySeparator , ? callable $ stringEncoder = null ) : string { $ result = '' ; if ( $ this -> myAboveBaseLevel > 0 ) { $ result .= str_repeat ( '..' . $ directorySeparator , $ this -> myAboveBaseLevel ) ; } if ( $ this -> myIsAbsolute ) { $ result .= $ directorySeparator ; } $ result .= implode ( $ directorySeparator , $ stringEncoder !== null ? array_map ( $ stringEncoder , $ this -> myDirectoryParts ) : $ this -> myDirectoryParts ) ; if ( count ( $ this -> myDirectoryParts ) > 0 ) { $ result .= $ directorySeparator ; } return $ result ; }
Returns the directory as a string.

@param string        $directorySeparator The directory separator.
@param callable|null $stringEncoder      The string encoding function or null if parts should not be encoded.

@return string The directory as a string.
Returns the directory as a string .