ILIAS  release_8 Revision v8.24
ToastCollector.php
Go to the documentation of this file.
1<?php
18declare(strict_types=1);
19
21
24use Iterator;
26
28{
30 private array $providers;
32 private array $toasts = [];
33
37 public function __construct(array $providers)
38 {
39 $this->providers = $providers;
40 $this->collectOnce();
41 }
42
46 private function returnToastsFromProviders(): Iterator
47 {
48 foreach ($this->providers as $provider) {
49 yield $provider->getToasts();
50 }
51 }
52
53 public function collectStructure(): void
54 {
55 $this->toasts = array_merge([], ...iterator_to_array($this->returnToastsFromProviders()));
56 }
57
58 public function filterItemsByVisibilty(bool $async_only = false): void
59 {
60 }
61
62 public function prepareItemsForUIRepresentation(): void
63 {
64 }
65
66 public function cleanupItemsForUIRepresentation(): void
67 {
68 }
69
70 public function sortItemsForUIRepresentation(): void
71 {
72 }
73
77 public function getToasts(): array
78 {
79 return $this->toasts;
80 }
81}
collectOnce()
Runs the Collection of all items from the providers.
$provider
Definition: ltitoken.php:83