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

        if ($this->hasDirectory($id)) {
            return $this->directories[$id] = new static($this->filesystem, $this->getDirectoryPath($id), $this->format);
        }

        throw new RuntimeException(sprintf('Directory "%s" not found', $id));
    }