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