ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ToastCollector.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
21 
25 use Iterator;
27 
29 {
31  private array $toasts = [];
32 
36  public function __construct(private array $providers)
37  {
38  $this->collectOnce();
39  }
40 
44  private function returnToastsFromProviders(): Iterator
45  {
46  foreach ($this->providers as $provider) {
47  yield $provider->getToasts();
48  }
49  }
50 
51  public function collectStructure(): void
52  {
53  $this->toasts = array_merge([], ...iterator_to_array($this->returnToastsFromProviders()));
54  }
55 
56  public function filterItemsByVisibilty(bool $async_only = false): void
57  {
58  }
59 
60  public function prepareItemsForUIRepresentation(): void
61  {
62  }
63 
64  public function cleanupItemsForUIRepresentation(): void
65  {
66  }
67 
68  public function sortItemsForUIRepresentation(): void
69  {
70  }
71 
75  public function getToasts(): array
76  {
77  return $this->toasts;
78  }
79 }
collectOnce()
Runs the Collection of all items from the providers.
$provider
Definition: ltitoken.php:80