albumMapper->removeFile($this->album->getId(), $this->file->getFileId()); } private function getNode(): Node { $nodes = $this->rootFolder ->getUserFolder($this->albumFile->getOwner() ?: $this->album->getUserId()) ->getById($this->file->getFileId()); $node = current($nodes); if ($node) { return $node; } else { throw new NotFound('Photo not found for user'); } } public function get() { $node = $this->getNode(); if ($node instanceof File) { return $node->fopen('r'); } else { throw new NotFound('Photo is a folder'); } } public function getFileInfo(): Node { return $this->getNode(); } }