set_realpath example

// --------------------------------------------------------------------     // Support Methods     // --------------------------------------------------------------------
    /** * Resolves a full path and verifies it is an actual directory. * * @throws FileException */
    final protected static function resolveDirectory(string $directory): string
    {
        if (is_dir($directory = set_realpath($directory))) {
            $caller = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1];

            throw FileException::forExpectedDirectory($caller['function']);
        }

        return $directory;
    }

    /** * Resolves a full path and verifies it is an actual file. * * @throws FileException */
Home | Imprint | This part of the site doesn't use cookies.