ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\ResourceStorage\Consumer\Consumers Class Reference
+ Collaboration diagram for ILIAS\ResourceStorage\Consumer\Consumers:

Public Member Functions

 __construct (private ConsumerFactory $consumer_factory, private ResourceBuilder $resource_builder, private CollectionBuilder $collection_builder, private SrcBuilder $src_builder=new InlineSrcBuilder())
 Consumers constructor. More...
 
 download (ResourceIdentification $identification)
 
 inline (ResourceIdentification $identification)
 
 stream (ResourceIdentification $identification)
 
 src (ResourceIdentification $identification)
 
 downloadCollection (ResourceCollectionIdentification $identification, ?string $zip_filename=null)
 
 downloadResources (array $identifications, ?string $zip_filename=null)
 
 flavourUrls (Flavour $flavour)
 
 containerZIP (ResourceIdentification $identification)
 @description This consumer can be used to obtain a StorageContainerResource as a ZIP. More...
 
 containerURI (ResourceIdentification $identification, string $start_file='index.html', float $valid_for_at_least_minutes=60.0)
 

Detailed Description

Definition at line 36 of file Consumers.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\ResourceStorage\Consumer\Consumers::__construct ( private ConsumerFactory  $consumer_factory,
private ResourceBuilder  $resource_builder,
private CollectionBuilder  $collection_builder,
private SrcBuilder  $src_builder = new InlineSrcBuilder() 
)

Consumers constructor.

Definition at line 41 of file Consumers.php.

42 {
43 }

Member Function Documentation

◆ containerURI()

ILIAS\ResourceStorage\Consumer\Consumers::containerURI ( ResourceIdentification  $identification,
string  $start_file = 'index.html',
float  $valid_for_at_least_minutes = 60.0 
)

Definition at line 113 of file Consumers.php.

117 : ContainerURIConsumer {
118 $resource = $this->resource_builder->get($identification);
119 if ($resource->getType() !== ResourceType::CONTAINER || !$resource instanceof StorableContainerResource) {
120 throw new \InvalidArgumentException('Expected StorableContainerResource');
121 }
122 return $this->consumer_factory->containerURI(
123 $resource,
124 $this->src_builder,
125 ltrim($start_file, '/'),
126 $valid_for_at_least_minutes
127 );
128 }

◆ containerZIP()

ILIAS\ResourceStorage\Consumer\Consumers::containerZIP ( ResourceIdentification  $identification)

@description This consumer can be used to obtain a StorageContainerResource as a ZIP.

Definition at line 101 of file Consumers.php.

101 : ContainerZIPAccessConsumer
102 {
103 $resource = $this->resource_builder->get($identification);
104 if ($resource->getType() !== ResourceType::CONTAINER || !$resource instanceof StorableContainerResource) {
105 throw new \InvalidArgumentException('Expected StorableContainerResource');
106 }
107
108 return $this->consumer_factory->containerZIP(
109 $resource
110 );
111 }

References ILIAS\ResourceStorage\Resource\CONTAINER.

◆ download()

ILIAS\ResourceStorage\Consumer\Consumers::download ( ResourceIdentification  $identification)

Definition at line 45 of file Consumers.php.

45 : DownloadConsumer
46 {
47 return $this->consumer_factory->download($this->resource_builder->get($identification));
48 }

◆ downloadCollection()

ILIAS\ResourceStorage\Consumer\Consumers::downloadCollection ( ResourceCollectionIdentification  $identification,
?string  $zip_filename = null 
)

Definition at line 65 of file Consumers.php.

68 : DownloadMultipleConsumer {
69 return $this->downloadResources(
70 iterator_to_array($this->collection_builder->getResourceIds($identification)),
71 $zip_filename
72 );
73 }
downloadResources(array $identifications, ?string $zip_filename=null)
Definition: Consumers.php:75

◆ downloadResources()

ILIAS\ResourceStorage\Consumer\Consumers::downloadResources ( array  $identifications,
?string  $zip_filename = null 
)

Definition at line 75 of file Consumers.php.

78 : DownloadMultipleConsumer {
79 $resources = [];
80 foreach ($identifications as $rid) {
81 if (!$rid instanceof ResourceIdentification) {
82 throw new \InvalidArgumentException('Expected ResourceIdentification');
83 }
84 $resources[] = $this->resource_builder->get($rid);
85 }
86
87 return $this->consumer_factory->downloadMultiple(
89 $zip_filename
90 );
91 }
$resources
Definition: ltiservices.php:68

References $resources.

◆ flavourUrls()

ILIAS\ResourceStorage\Consumer\Consumers::flavourUrls ( Flavour  $flavour)

Definition at line 93 of file Consumers.php.

93 : FlavourURLs
94 {
95 return $this->consumer_factory->flavourUrl($flavour, $this->src_builder);
96 }

◆ inline()

ILIAS\ResourceStorage\Consumer\Consumers::inline ( ResourceIdentification  $identification)

Definition at line 50 of file Consumers.php.

50 : InlineConsumer
51 {
52 return $this->consumer_factory->inline($this->resource_builder->get($identification));
53 }

◆ src()

ILIAS\ResourceStorage\Consumer\Consumers::src ( ResourceIdentification  $identification)

Definition at line 60 of file Consumers.php.

60 : SrcConsumer
61 {
62 return $this->consumer_factory->src($this->resource_builder->get($identification), $this->src_builder);
63 }

◆ stream()

ILIAS\ResourceStorage\Consumer\Consumers::stream ( ResourceIdentification  $identification)

Definition at line 55 of file Consumers.php.

55 : FileStreamConsumer
56 {
57 return $this->consumer_factory->fileStream($this->resource_builder->get($identification));
58 }

The documentation for this class was generated from the following file: