public function hasDirectory(string $id): bool
    {
        if (isset($this->directories[$id])) {
            return true;
        }

        $path = $this->getDirectoryPath($id);

        if ($this->filesystem->has($path)) {
            $info = $this->filesystem->getMetadata($path);

            return $info['type'] === 'dir';
        }

        return false;
    }