ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\MainMenu\Storage\Services Class Reference

Class Services. More...

+ Collaboration diagram for ILIAS\MainMenu\Storage\Services:

Public Member Functions

 __construct ()
 Services constructor. More...
 
 upload (UploadResult $result, ResourceStakeholder $stakeholder, string $title=null)
 this is the fast-lane: in most cases you want to store a uploaded file in the storage and use it's identification. More...
 
 find (string $identification)
 
 getRevision (ResourceIdentification $identification)
 
 remove (ResourceIdentification $identification)
 
 download (ResourceIdentification $identification)
 
 inline (ResourceIdentification $identification)
 
 stream (ResourceIdentification $identification)
 

Private Attributes

 $consumer_factory
 
 $resource_builder
 

Detailed Description

Class Services.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 29 of file Services.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MainMenu\Storage\Services::__construct ( )

Services constructor.

Definition at line 45 of file Services.php.

46  {
47  $this->resource_builder = new ResourceBuilder(
48  new FileSystemStorageHandler(),
49  new RevisionARRepository(),
50  new ResourceARRepository(),
51  new InformationARRepository()
52  );
53  $this->consumer_factory = new ConsumerFactory(new StorageHandlerFactory());
54  }

Member Function Documentation

◆ download()

ILIAS\MainMenu\Storage\Services::download ( ResourceIdentification  $identification)

Definition at line 123 of file Services.php.

123  : DownloadConsumer
124  {
125  return $this->consumer_factory->download($this->resource_builder->get($identification));
126  }

◆ find()

ILIAS\MainMenu\Storage\Services::find ( string  $identification)

Definition at line 81 of file Services.php.

81  : ?ResourceIdentification
82  {
83  $resource_identification = new ResourceIdentification($identification);
84 
85  if ($this->resource_builder->has($resource_identification)) {
86  return $resource_identification;
87  }
88 
89  return null;
90  }

◆ getRevision()

ILIAS\MainMenu\Storage\Services::getRevision ( ResourceIdentification  $identification)

Definition at line 93 of file Services.php.

93  : Revision
94  {
95  return $this->resource_builder->get($identification)->getCurrentRevision();
96  }

◆ inline()

ILIAS\MainMenu\Storage\Services::inline ( ResourceIdentification  $identification)

Definition at line 129 of file Services.php.

129  : InlineConsumer
130  {
131  return $this->consumer_factory->inline($this->resource_builder->get($identification));
132  }

◆ remove()

ILIAS\MainMenu\Storage\Services::remove ( ResourceIdentification  $identification)

Definition at line 99 of file Services.php.

99  : void
100  {
101  $this->resource_builder->remove($this->resource_builder->get($identification));
102  }

◆ stream()

ILIAS\MainMenu\Storage\Services::stream ( ResourceIdentification  $identification)

Definition at line 135 of file Services.php.

135  : FileStreamConsumer
136  {
137  return $this->consumer_factory->fileStream($this->resource_builder->get($identification));
138  }

◆ upload()

ILIAS\MainMenu\Storage\Services::upload ( UploadResult  $result,
ResourceStakeholder  $stakeholder,
string  $title = null 
)

this is the fast-lane: in most cases you want to store a uploaded file in the storage and use it's identification.

Parameters
UploadResult$result
ResourceStakeholder$stakeholder
string$title
Returns
ResourceIdentification

Definition at line 67 of file Services.php.

References ILIAS\FileUpload\DTO\UploadResult\getStatus(), and ILIAS\FileUpload\DTO\UploadResult\isOK().

67  : ResourceIdentification
68  {
69  if ($result->isOK()) {
70  $resource = $this->resource_builder->new($result);
71 
72  $this->resource_builder->store($resource);
73 
74  return $resource->getIdentification();
75  } else {
76  throw new LogicException("Can't handle UploadResult: " . $result->getStatus()->getMessage());
77  }
78  }
$result
+ Here is the call graph for this function:

Field Documentation

◆ $consumer_factory

ILIAS\MainMenu\Storage\Services::$consumer_factory
private

Definition at line 35 of file Services.php.

◆ $resource_builder

ILIAS\MainMenu\Storage\Services::$resource_builder
private

Definition at line 39 of file Services.php.


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