ILIAS  release_7 Revision v7.30-3-g800a261c036
ConsumerFactory.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4
9
15{
16
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),
48 $this->file_name_policy
49 );
50 }
51
56 public function inline(StorableResource $resource) : InlineConsumer
57 {
58 return new InlineConsumer(
59 $resource,
60 $this->storage_handler_factory->getHandlerForResource($resource),
61 $this->file_name_policy
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
83 {
84 return new AbsolutePathConsumer(
85 $resource,
86 $this->storage_handler_factory->getHandlerForResource($resource),
87 $this->file_name_policy
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}
An exception for terminatinating execution or to throw for unit testing.
__construct(StorageHandlerFactory $storage_handler_factory, FileNamePolicy $file_name_policy=null)
ConsumerFactory constructor.