ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StorableFlavourDecorator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
32{
33 private array $streams = [];
34
35 public function __construct(protected Flavour $flavour)
36 {
37 }
38
39 public function getFlavour(): Flavour
40 {
41 return $this->flavour;
42 }
43
44 #[\Override]
45 public function getPersistingName(): string
46 {
47 return $this->flavour->getPersistingName();
48 }
49
50 #[\Override]
51 public function getName(): string
52 {
53 return $this->flavour->getName();
54 }
55
56 #[\Override]
58 {
59 return $this->flavour->getResourceId();
60 }
61
62 #[\Override]
64 {
65 return $this->flavour->getDefinition();
66 }
67
68 #[\Override]
69 public function getRevision(): int
70 {
71 return $this->flavour->getRevision();
72 }
73
74 // STREAMS
75
79 public function filterStreams(\Closure $filter): void
80 {
81 $this->streams = array_filter(
82 $this->streams,
83 $filter
84 );
85 }
86
87 public function setStreams(array $streams): void
88 {
89 foreach ($streams as $index => $stream) {
90 $this->addStream($index, $stream);
91 }
92 }
93
94
95 public function addStream(int $index, FileStream $stream): self
96 {
97 $this->streams[$index] = $stream;
98
99 return $this;
100 }
101
102 public function getStream(int $index = 0): ?FileStream
103 {
104 return $this->streams[$index] ?? null;
105 }
106
110 public function getStreams(): array
111 {
112 return $this->streams;
113 }
114}
filterStreams(\Closure $filter)
@description Filter Streams with a Closure which accepts a FileStream and returns bool
getPersistingName()
Flavours are stored in the file system by the StroageHandler.
The base interface for all filesystem streams.
Definition: FileStream.php:32