ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LegacyDelivery.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
28final class LegacyDelivery extends BaseDelivery
29{
30 public function attached(
31 string $path_to_file,
32 ?string $download_file_name = null,
33 ?string $mime_type = null,
34 ?bool $delete_file = false
35 ): never {
36 $this->deliver(
38 Disposition::ATTACHMENT,
42 );
43 }
44
45 public function inline(
46 string $path_to_file,
47 ?string $download_file_name = null,
48 ?string $mime_type = null,
49 ?bool $delete_file = false
50 ): never {
51 $this->deliver(
52 $path_to_file,
53 Disposition::INLINE,
57 );
58 }
59
60 private function deliver(
61 string $path_to_file,
63 ?string $download_file_name = null,
64 ?string $mime_type = null,
65 ?bool $delete_file = false
66 ): never {
67 $r = $this->setGeneralHeaders(
68 $this->http->response(),
70 $mime_type ?? mime_content_type($path_to_file),
73 );
74 $r = $this->response_builder->buildForStream(
75 $this->http->request(),
76 $r,
78 );
79 $this->saveAndClose($r, $delete_file ? $path_to_file : null);
80 }
81}
attached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, ?bool $delete_file=false)
deliver(string $path_to_file, Disposition $disposition, ?string $download_file_name=null, ?string $mime_type=null, ?bool $delete_file=false)
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Definition: Streams.php:32
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
Definition: Streams.php:64
static http()
Fetches the global http state from ILIAS.