/** * Retrieves the file based on the given ID * * @param int $fileId * * @return File */ private function getFile($fileId) { try { /** @type File $file */ $file = $this->downloadService->getResourceFromId($fileId); } catch (ServiceException $exception) { $file = false; } return $file; }
/** * Generates the download data * * @param int $fileId the ID of the file of which we need a large preview of * @param string|null $filename * * @return array|false */ private function getDownload($fileId, $filename) { /** @type File $file */ $file = $this->downloadService->getResourceFromId($fileId); $this->configService->validateMimeType($file->getMimeType()); $download = $this->downloadService->downloadFile($file); if (is_null($filename)) { $filename = $file->getName(); } $download['name'] = $filename; return $download; }