ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ConsumerFactory.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 
4 
9 
15 {
16 
24  protected $file_name_policy;
25 
31  public function __construct(
34  ) {
35  $this->storage_handler_factory = $storage_handler_factory;
36  $this->file_name_policy = $file_name_policy ?? new NoneFileNamePolicy();
37  }
38 
43  public function download(StorableResource $resource) : DownloadConsumer
44  {
45  return new DownloadConsumer(
46  $resource,
47  $this->storage_handler_factory->getHandlerForResource($resource),
49  );
50  }
51 
56  public function inline(StorableResource $resource) : InlineConsumer
57  {
58  return new InlineConsumer(
59  $resource,
60  $this->storage_handler_factory->getHandlerForResource($resource),
62  );
63  }
64 
69  public function fileStream(StorableResource $resource) : FileStreamConsumer
70  {
71  return new FileStreamConsumer(
72  $resource,
73  $this->storage_handler_factory->getHandlerForResource($resource)
74  );
75  }
76 
82  public function absolutePath(StorableResource $resource) : AbsolutePathConsumer
83  {
84  return new AbsolutePathConsumer(
85  $resource,
86  $this->storage_handler_factory->getHandlerForResource($resource),
88  );
89  }
90 
95  public function src(StorableResource $resource) : SrcConsumer
96  {
97  return new SrcConsumer(
98  $resource,
99  $this->storage_handler_factory->getHandlerForResource($resource)
100  );
101  }
102 }
__construct(StorageHandlerFactory $storage_handler_factory, FileNamePolicy $file_name_policy=null)
ConsumerFactory constructor.