src/Traits/PathTrait.php
private static function myParsePart(string $part, bool $isLastPart, callable $partValidator, ?callable $stringDecoder, ?bool $isAbsolute, ?int &$aboveBaseLevel, ?array &$directoryParts = null, ?string &$filename = null, ?string &$error = null): bool
    {
        // Skip empty and current directory parts.
        if ($part === '' || $part === '.') {
            return true;
        }

        // Handle parent directory-part.
        if ($part === '..') {
            return self::myHandleParentDirectoryPart($isAbsolute, $aboveBaseLevel, $directoryParts, $error);
        }

        // Handle directory part.
        if (!$isLastPart) {
            return self::myHandleDirectoryPart($part, $partValidator, $stringDecoder, $directoryParts, $error);
        }

        // Handle last (i.e. filename) part.
        return self::myHandleFilenamePart($part, $partValidator, $stringDecoder, $filename, $error);
    }
private static function myParsePart(string $part, bool $isLastPart, callable $partValidator, ?callable $stringDecoder, ?bool $isAbsolute, ?int &$aboveBaseLevel, ?array &$directoryParts = null, ?string &$filename = null, ?string &$error = null): bool
    {
        // Skip empty and current directory parts.
        if ($part === '' || $part === '.') {
            return true;
        }

        // Handle parent directory-part.
        if ($part === '..') {
            return self::myHandleParentDirectoryPart($isAbsolute, $aboveBaseLevel, $directoryParts, $error);
        }

        // Handle directory part.
        if (!$isLastPart) {
            return self::myHandleDirectoryPart($part, $partValidator, $stringDecoder, $directoryParts, $error);
        }

        // Handle last (i.e. filename) part.
        return self::myHandleFilenamePart($part, $partValidator, $stringDecoder, $filename, $error);
    }
private static function myParsePart ( string $ part , bool $ isLastPart , callable $ partValidator , ? callable $ stringDecoder , ? bool $ isAbsolute , ? int & $ aboveBaseLevel , ? array & $ directoryParts = null , ? string & $ filename = null , ? string & $ error = null ) : bool { // Skip empty and current directory parts. if ( $ part === '' || $ part === '.' ) { return true ; } // Handle parent directory-part. if ( $ part === '..' ) { return self :: myHandleParentDirectoryPart ( $ isAbsolute , $ aboveBaseLevel , $ directoryParts , $ error ) ; } // Handle directory part. if ( ! $ isLastPart ) { return self :: myHandleDirectoryPart ( $ part , $ partValidator , $ stringDecoder , $ directoryParts , $ error ) ; } // Handle last (i.e. filename) part. return self :: myHandleFilenamePart ( $ part , $ partValidator , $ stringDecoder , $ filename , $ error ) ; }
Tries to parse a part of a path and returns the result or error text.

@param string        $part           The part of the path.
@param bool          $isLastPart     True if this is the last part, false otherwise.
@param callable      $partValidator  The part validator.
@param callable|null $stringDecoder  The string decoding function or null if parts should not be decoded.
@param bool|null     $isAbsolute     Whether the path is absolute or relative if parsing was successful, undefined otherwise.
@param int|null      $aboveBaseLevel The number of directory parts above base level if parsing was successful, undefined otherwise.
@param string[]|null $directoryParts The directory parts if parsing was successful, undefined otherwise.
@param string|null   $filename       The file if parsing was not successful, undefined otherwise.
@param string|null   $error          The error text if validation was not successful, undefined otherwise.

@return bool True if parsing was successful, false otherwise.
Tries to parse a part of a path and returns the result or error text .