forExpectedDirectory example


    /** * 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 */
    final protected static function resolveFile(string $file): string
    {
Home | Imprint | This part of the site doesn't use cookies.