ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ConsumerFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30
36{
40 private Services $http;
41
46 public function __construct(
47 private StreamAccess $stream_access,
48 protected FileNamePolicy $file_name_policy = new NoneFileNamePolicy()
49 ) {
50 global $DIC;
51 $this->http = $DIC->http();
52 }
53
54 public function download(StorableResource $resource): DownloadConsumer
55 {
56 return new DownloadConsumer(
57 $this->http,
58 $resource,
59 $this->stream_access,
60 $this->file_name_policy
61 );
62 }
63
64 public function inline(StorableResource $resource): InlineConsumer
65 {
66 return new InlineConsumer(
67 $this->http,
68 $resource,
69 $this->stream_access,
70 $this->file_name_policy
71 );
72 }
73
75 {
76 return new FileStreamConsumer(
77 $resource,
78 $this->stream_access
79 );
80 }
81
86 {
87 return new AbsolutePathConsumer(
88 $resource,
89 $this->stream_access,
90 $this->file_name_policy
91 );
92 }
93
94 public function src(StorableResource $resource, SrcBuilder $src_builder): SrcConsumer
95 {
96 return new SrcConsumer(
97 $src_builder,
98 $resource,
99 $this->stream_access
100 );
101 }
102
103 public function flavourUrl(Flavour $flavour, SrcBuilder $src_builder): FlavourURLs
104 {
105 return new FlavourURLs(
106 $src_builder,
107 $flavour
108 );
109 }
110
111 public function downloadMultiple(
112 array $resources,
113 ?string $zip_filename = null
117 $this->stream_access,
118 $this->file_name_policy,
119 $zip_filename ?? 'Download.zip'
120 );
121 }
122
123 public function containerZIP(
127 $resource,
128 $this->stream_access
129 );
130 }
131
132 public function containerURI(
134 SrcBuilder $src_builder,
135 string $start_file = 'index.html',
136 float $valid_for_at_least_minutes = 120.0
139 $src_builder,
140 $resource,
141 $this->stream_access,
142 $start_file,
143 $valid_for_at_least_minutes
144 );
145 }
146}
Class Services.
Definition: Services.php:38
containerZIP(StorableContainerResource $resource,)
__construct(private StreamAccess $stream_access, protected FileNamePolicy $file_name_policy=new NoneFileNamePolicy())
ConsumerFactory constructor.
containerURI(StorableContainerResource $resource, SrcBuilder $src_builder, string $start_file='index.html', float $valid_for_at_least_minutes=120.0)
src(StorableResource $resource, SrcBuilder $src_builder)
downloadMultiple(array $resources, ?string $zip_filename=null)
flavourUrl(Flavour $flavour, SrcBuilder $src_builder)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$resources
Definition: ltiservices.php:68
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26