ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\ResourceStorage\Consumer\Consumers Class Reference
+ Collaboration diagram for ILIAS\ResourceStorage\Consumer\Consumers:

Public Member Functions

 __construct (ConsumerFactory $consumer_factory, ResourceBuilder $resource_builder, CollectionBuilder $collection_builder, ?SrcBuilder $src_builder=null)
 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)
 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)
 

Private Attributes

ConsumerFactory $consumer_factory
 
ResourceBuilder $resource_builder
 
CollectionBuilder $collection_builder
 
SrcBuilder $src_builder
 

Detailed Description

Definition at line 36 of file Consumers.php.

Constructor & Destructor Documentation

◆ __construct()

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

Consumers constructor.

Definition at line 46 of file Consumers.php.

References ILIAS\ResourceStorage\Consumer\Consumers\$collection_builder, ILIAS\ResourceStorage\Consumer\Consumers\$consumer_factory, and ILIAS\ResourceStorage\Consumer\Consumers\$resource_builder.

51  {
52  $this->consumer_factory = $consumer_factory;
53  $this->resource_builder = $resource_builder;
54  $this->collection_builder = $collection_builder;
55  $this->src_builder = $src_builder ?? new InlineSrcBuilder();
56  }

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 126 of file Consumers.php.

References ILIAS\ResourceStorage\Resource\CONTAINER.

130  : ContainerURIConsumer {
131  $resource = $this->resource_builder->get($identification);
132  if ($resource->getType() !== ResourceType::CONTAINER || !$resource instanceof StorableContainerResource) {
133  throw new \InvalidArgumentException('Expected StorableContainerResource');
134  }
135  return $this->consumer_factory->containerURI(
136  $resource,
137  $this->src_builder,
138  ltrim($start_file, '/'),
139  $valid_for_at_least_minutes
140  );
141  }

◆ containerZIP()

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

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

Definition at line 114 of file Consumers.php.

References ILIAS\ResourceStorage\Resource\CONTAINER.

114  : ContainerZIPAccessConsumer
115  {
116  $resource = $this->resource_builder->get($identification);
117  if ($resource->getType() !== ResourceType::CONTAINER || !$resource instanceof StorableContainerResource) {
118  throw new \InvalidArgumentException('Expected StorableContainerResource');
119  }
120 
121  return $this->consumer_factory->containerZIP(
122  $resource
123  );
124  }

◆ download()

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

Definition at line 58 of file Consumers.php.

58  : DownloadConsumer
59  {
60  return $this->consumer_factory->download($this->resource_builder->get($identification));
61  }

◆ downloadCollection()

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

Definition at line 78 of file Consumers.php.

References ILIAS\ResourceStorage\Consumer\Consumers\downloadResources().

81  : DownloadMultipleConsumer {
82  return $this->downloadResources(
83  iterator_to_array($this->collection_builder->getResourceIds($identification)),
84  $zip_filename
85  );
86  }
downloadResources(array $identifications, ?string $zip_filename=null)
Definition: Consumers.php:88
+ Here is the call graph for this function:

◆ downloadResources()

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

Definition at line 88 of file Consumers.php.

References $resources.

Referenced by ILIAS\ResourceStorage\Consumer\Consumers\downloadCollection().

91  : DownloadMultipleConsumer {
92  $resources = [];
93  foreach ($identifications as $rid) {
94  if (!$rid instanceof ResourceIdentification) {
95  throw new \InvalidArgumentException('Expected ResourceIdentification');
96  }
97  $resources[] = $this->resource_builder->get($rid);
98  }
99 
100  return $this->consumer_factory->downloadMultiple(
101  $resources,
102  $zip_filename
103  );
104  }
$resources
Definition: ltiservices.php:68
+ Here is the caller graph for this function:

◆ flavourUrls()

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

Definition at line 106 of file Consumers.php.

106  : FlavourURLs
107  {
108  return $this->consumer_factory->flavourUrl($flavour, $this->src_builder);
109  }

◆ inline()

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

Definition at line 63 of file Consumers.php.

63  : InlineConsumer
64  {
65  return $this->consumer_factory->inline($this->resource_builder->get($identification));
66  }

◆ src()

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

Definition at line 73 of file Consumers.php.

References ILIAS\ResourceStorage\Consumer\Consumers\$src_builder.

73  : SrcConsumer
74  {
75  return $this->consumer_factory->src($this->resource_builder->get($identification), $this->src_builder);
76  }

◆ stream()

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

Definition at line 68 of file Consumers.php.

68  : FileStreamConsumer
69  {
70  return $this->consumer_factory->fileStream($this->resource_builder->get($identification));
71  }

Field Documentation

◆ $collection_builder

CollectionBuilder ILIAS\ResourceStorage\Consumer\Consumers::$collection_builder
private

Definition at line 40 of file Consumers.php.

Referenced by ILIAS\ResourceStorage\Consumer\Consumers\__construct().

◆ $consumer_factory

ConsumerFactory ILIAS\ResourceStorage\Consumer\Consumers::$consumer_factory
private

Definition at line 38 of file Consumers.php.

Referenced by ILIAS\ResourceStorage\Consumer\Consumers\__construct().

◆ $resource_builder

ResourceBuilder ILIAS\ResourceStorage\Consumer\Consumers::$resource_builder
private

Definition at line 39 of file Consumers.php.

Referenced by ILIAS\ResourceStorage\Consumer\Consumers\__construct().

◆ $src_builder

SrcBuilder ILIAS\ResourceStorage\Consumer\Consumers::$src_builder
private

Definition at line 41 of file Consumers.php.

Referenced by ILIAS\ResourceStorage\Consumer\Consumers\src().


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