aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/AppFramework/Http/FileDisplayResponse.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/AppFramework/Http/FileDisplayResponse.php')
-rw-r--r--lib/public/AppFramework/Http/FileDisplayResponse.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/public/AppFramework/Http/FileDisplayResponse.php b/lib/public/AppFramework/Http/FileDisplayResponse.php
index 41b452b5553..f194a23f1fe 100644
--- a/lib/public/AppFramework/Http/FileDisplayResponse.php
+++ b/lib/public/AppFramework/Http/FileDisplayResponse.php
@@ -4,6 +4,7 @@
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Kate Döen <kate.doeen@nextcloud.com>
*
* @license GNU AGPL version 3 or any later version
*
@@ -24,31 +25,33 @@
namespace OCP\AppFramework\Http;
use OCP\AppFramework\Http;
+use OCP\Files\File;
+use OCP\Files\SimpleFS\ISimpleFile;
/**
* Class FileDisplayResponse
*
* @since 11.0.0
+ * @template S of int
+ * @template H of array<string, mixed>
+ * @template-extends Response<int, array<string, mixed>>
*/
class FileDisplayResponse extends Response implements ICallbackResponse {
- /** @var \OCP\Files\File|\OCP\Files\SimpleFS\ISimpleFile */
+ /** @var File|ISimpleFile */
private $file;
/**
* FileDisplayResponse constructor.
*
- * @param \OCP\Files\File|\OCP\Files\SimpleFS\ISimpleFile $file
- * @param int $statusCode
- * @param array $headers
+ * @param File|ISimpleFile $file
+ * @param S $statusCode
+ * @param H $headers
* @since 11.0.0
*/
- public function __construct($file, $statusCode = Http::STATUS_OK,
- $headers = []) {
- parent::__construct();
+ public function __construct(File|ISimpleFile $file, int $statusCode = Http::STATUS_OK, array $headers = []) {
+ parent::__construct($statusCode, $headers);
$this->file = $file;
- $this->setStatus($statusCode);
- $this->setHeaders(array_merge($this->getHeaders(), $headers));
$this->addHeader('Content-Disposition', 'inline; filename="' . rawurldecode($file->getName()) . '"');
$this->setETag($file->getEtag());