src/Traits/PathTrait.php
private function myCombineDirectoryPart(string $part, ?int &$aboveBaseLevel = null, ?array &$directoryParts = null, ?string &$error = null): bool
    {
        if ($part === '..') {
            if (count($directoryParts) === 0) {
                if ($this->myIsAbsolute) {
                    $error = 'Absolute path is above root level.';

                    return false;
                }

                $aboveBaseLevel++;

                return true;
            }

            array_pop($directoryParts);

            return true;
        }

        $directoryParts[] = $part;

        return true;
    }
private function myCombineDirectoryPart(string $part, ?int &$aboveBaseLevel = null, ?array &$directoryParts = null, ?string &$error = null): bool
    {
        if ($part === '..') {
            if (count($directoryParts) === 0) {
                if ($this->myIsAbsolute) {
                    $error = 'Absolute path is above root level.';

                    return false;
                }

                $aboveBaseLevel++;

                return true;
            }

            array_pop($directoryParts);

            return true;
        }

        $directoryParts[] = $part;

        return true;
    }
private function myCombineDirectoryPart ( string $ part , ? int & $ aboveBaseLevel = null , ? array & $ directoryParts = null , ? string & $ error = null ) : bool { if ( $ part === '..' ) { if ( count ( $ directoryParts ) === 0 ) { if ( $ this -> myIsAbsolute ) { $ error = 'Absolute path is above root level.' ; return false ; } $ aboveBaseLevel ++ ; return true ; } array_pop ( $ directoryParts ) ; return true ; } $ directoryParts [ ] = $ part ; return true ; }
Tries to combine a directory part with another path.

@param string        $part           The part.
@param int|null      $aboveBaseLevel The number of directory parts above base level if combining was successful, undefined otherwise.
@param string[]|null $directoryParts The directory parts if combining was successful, undefined otherwise.
@param string|null   $error          The error text if combining was not successful, undefined otherwise.

@return bool True if combining was successful, false otherwise.
Tries to combine a directory part with another path .