@@ -56,6 +56,8 @@ public function __construct(
56
56
57
57
/**
58
58
* @phpstan-param \Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_*|null $contentDisposition
59
+ *
60
+ * @return $this
59
61
*/
60
62
public function setFile (BinaryFile $ file , ?string $ contentDisposition = null , bool $ autoLastModified = true ): static
61
63
{
@@ -79,6 +81,8 @@ public function getFile(): BinaryFile
79
81
80
82
/**
81
83
* Automatically sets the Last-Modified header according the file modification date.
84
+ *
85
+ * @return $this
82
86
*/
83
87
public function setAutoLastModified (): static
84
88
{
@@ -94,6 +98,8 @@ public function setAutoLastModified(): static
94
98
*
95
99
* @param string $filename Optionally use this filename instead of the real name of the file
96
100
* @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename
101
+ *
102
+ * @return $this
97
103
*/
98
104
public function setContentDisposition (string $ disposition , string $ filename = '' , string $ filenameFallback = '' ): BinaryStreamResponse
99
105
{
@@ -111,6 +117,9 @@ public function setContentDisposition(string $disposition, string $filename = ''
111
117
return $ this ;
112
118
}
113
119
120
+ /**
121
+ * @return $this
122
+ */
114
123
public function prepare (Request $ request ): static
115
124
{
116
125
$ this ->headers ->set ('Content-Length ' , (string )$ this ->file ->size );
@@ -144,6 +153,8 @@ public function prepare(Request $request): static
144
153
* Sends the file.
145
154
*
146
155
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
156
+ *
157
+ * @return $this
147
158
*/
148
159
public function sendContent (): static
149
160
{
@@ -170,6 +181,8 @@ public function sendContent(): static
170
181
171
182
/**
172
183
* @throws \LogicException when the content is not null
184
+ *
185
+ * @return $this
173
186
*/
174
187
public function setContent (?string $ content ): static
175
188
{
@@ -216,12 +229,12 @@ private function processRangeRequest(Request $request): void
216
229
if ($ start < 0 || $ end > $ fileSize - 1 ) {
217
230
$ this ->setStatusCode (
218
231
Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
219
- ); // HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
232
+ );
220
233
} elseif ($ start !== 0 || $ end !== $ fileSize - 1 ) {
221
234
$ this ->maxlen = $ end < $ fileSize ? $ end - $ start + 1 : -1 ;
222
235
$ this ->offset = $ start ;
223
236
224
- $ this ->setStatusCode (Response::HTTP_PARTIAL_CONTENT ); // HTTP_PARTIAL_CONTENT
237
+ $ this ->setStatusCode (Response::HTTP_PARTIAL_CONTENT );
225
238
$ this ->headers ->set ('Content-Range ' , sprintf ('bytes %s-%s/%s ' , $ start , $ end , $ fileSize ));
226
239
$ this ->headers ->set ('Content-Length ' , $ end - $ start + 1 );
227
240
}
0 commit comments