ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
CollectorFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
23 
33 use Throwable;
34 
40 {
41  use SingletonTrait;
42 
43  protected static array $instances = [];
45 
50  public function __construct(ProviderFactory $provider_factory)
51  {
52  $this->provider_factory = $provider_factory;
53  }
54 
59  public function mainmenu(): MainMenuMainCollector
60  {
61  if (!$this->has(MainMenuMainCollector::class)) {
62  $providers = $this->provider_factory->getMainBarProvider();
63  $information = $this->provider_factory->getMainBarItemInformation();
64 
65  return $this->getWithMultipleArguments(
66  MainMenuMainCollector::class,
67  [
68  $providers,
69  new MainMenuItemFactory(),
70  $information
71  ]
72  );
73  }
74 
75  return $this->get(MainMenuMainCollector::class);
76  }
77 
78  public function metaBar(): MetaBarMainCollector
79  {
80  return $this->getWithArgument(MetaBarMainCollector::class, $this->provider_factory->getMetaBarProvider());
81  }
82 
83  public function tool(): MainToolCollector
84  {
85  if (!$this->has(MainToolCollector::class)) {
86  $providers = $this->provider_factory->getToolProvider();
87  $information = $this->provider_factory->getMainBarItemInformation();
88 
89  return $this->getWithMultipleArguments(MainToolCollector::class, [$providers, $information]);
90  }
91 
92  return $this->get(MainToolCollector::class);
93  }
94 
95  public function layout(): MainLayoutCollector
96  {
97  return $this->getWithMultipleArguments(MainLayoutCollector::class, [$this->provider_factory->getModificationProvider()]);
98  }
99 
101  {
102  return $this->getWithArgument(MainNotificationCollector::class, $this->provider_factory->getNotificationsProvider());
103  }
104 
105  public function toasts(): ToastCollector
106  {
107  return $this->getWithArgument(ToastCollector::class, $this->provider_factory->getToastsProvider());
108  }
109 }
Class MainMenuMainCollector This Collector will collect and then provide all available slates from th...
getWithMultipleArguments(string $class_name, array $arguments)
has(string $class_name)
Class MainMenuItemFactory This factory provides you all available types for MainMenu GlobalScreen Ite...
trait SingletonTrait
Class SingletonTrait.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getWithArgument(string $class_name, $argument)
__construct(ProviderFactory $provider_factory)
CollectorFactory constructor.