ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
StorableFlavourDecorator.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
21 
25 
30 final class StorableFlavourDecorator extends Flavour
31 {
32  private array $streams = [];
33 
34  public function __construct(protected Flavour $flavour)
35  {
36  }
37 
38  public function getFlavour(): Flavour
39  {
40  return $this->flavour;
41  }
42 
43  #[\Override]
44  public function getPersistingName(): string
45  {
46  return $this->flavour->getPersistingName();
47  }
48 
49  #[\Override]
50  public function getName(): string
51  {
52  return $this->flavour->getName();
53  }
54 
55  #[\Override]
57  {
58  return $this->flavour->getResourceId();
59  }
60 
61  #[\Override]
62  public function getDefinition(): FlavourDefinition
63  {
64  return $this->flavour->getDefinition();
65  }
66 
67  #[\Override]
68  public function getRevision(): int
69  {
70  return $this->flavour->getRevision();
71  }
72 
73  // STREAMS
74 
78  public function filterStreams(\Closure $filter): void
79  {
80  $this->streams = array_filter(
81  $this->streams,
82  $filter
83  );
84  }
85 
86  public function setStreams(array $streams): void
87  {
88  foreach ($streams as $index => $stream) {
89  $this->addStream($index, $stream);
90  }
91  }
92 
93 
94  public function addStream(int $index, FileStream $stream): self
95  {
96  $this->streams[$index] = $stream;
97 
98  return $this;
99  }
100 
101  public function getStream(int $index = 0): ?FileStream
102  {
103  return $this->streams[$index] ?? null;
104  }
105 
109  public function getStreams(): array
110  {
111  return $this->streams;
112  }
113 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
filterStreams(\Closure $filter)
Filter Streams with a Closure which accepts a FileStream and returns bool
The base interface for all filesystem streams.
Definition: FileStream.php:31