ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilGSProviderFactory Class Reference

Class ilGSProviderFactory. More...

+ Inheritance diagram for ilGSProviderFactory:
+ Collaboration diagram for ilGSProviderFactory:

Public Member Functions

 __construct (Container $dic)
 @inheritDoc More...
 
 getMainBarProvider ()
 @inheritDoc More...
 
 getMetaBarProvider ()
 @inheritDoc More...
 
 getToolProvider ()
 @inheritDoc More...
 
 getModificationProvider ()
 @inheritDoc More...
 
 getNotificationsProvider ()
 @inheritDoc More...
 
 getMainBarItemInformation ()
 @inheritDoc More...
 
 getProviderByClassName (string $class_name)
 @inheritDoc More...
 
 isInstanceCreationPossible (string $class_name)
 @inheritDoc More...
 
 isRegistered (string $class_name)
 @inheritDoc More...
 
 getModificationProvider ()
 
 getMainBarProvider ()
 
 getMainBarItemInformation ()
 
 getToolProvider ()
 
 getMetaBarProvider ()
 
 getNotificationsProvider ()
 
 getProviderByClassName (string $class_name)
 
 isInstanceCreationPossible (string $class_name)
 
 isRegistered (string $class_name)
 

Protected Member Functions

 registerInternal (array $providers)
 

Protected Attributes

 $all_providers
 

Private Member Functions

 initPlugins ()
 
 appendPlugins (array &$array_of_core_providers, string $interface)
 
 appendCore (array &$array_of_providers, string $interface)
 

Private Attributes

 $plugin_provider_collections = null
 
 $class_loader
 
 $dic
 
 $main_menu_item_information = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGSProviderFactory::__construct ( Container  $dic)

@inheritDoc

Definition at line 45 of file class.ilGSProviderFactory.php.

46 {
47 $this->dic = $dic;
48 $this->main_menu_item_information = new ilMMItemInformation();
49 $this->class_loader = include "Services/GlobalScreen/artifacts/global_screen_providers.php";
50 }
Class ilMMItemInformation.

References $dic.

Member Function Documentation

◆ appendCore()

ilGSProviderFactory::appendCore ( array &  $array_of_providers,
string  $interface 
)
private
Parameters
array$array_of_providers
string$interface

Definition at line 210 of file class.ilGSProviderFactory.php.

210 : void
211 {
212 foreach ($this->class_loader[$interface] as $class_name) {
213 if ($this->isInstanceCreationPossible($class_name)) {
214 try {
215 $array_of_providers[] = new $class_name($this->dic);
216 } catch (Throwable $e) {
217 $i = $e;
218 }
219 }
220 }
221 }
isInstanceCreationPossible(string $class_name)
@inheritDoc
$i
Definition: metadata.php:24

References Vendor\Package\$e, $i, and isInstanceCreationPossible().

Referenced by getMainBarProvider(), getMetaBarProvider(), getModificationProvider(), getNotificationsProvider(), and getToolProvider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendPlugins()

ilGSProviderFactory::appendPlugins ( array &  $array_of_core_providers,
string  $interface 
)
private
Parameters
array$array_of_core_providers
string$interface

Definition at line 192 of file class.ilGSProviderFactory.php.

192 : void
193 {
194 // Plugins
195 static $plugin_providers;
196
197 $plugin_providers = $plugin_providers ?? ilPluginAdmin::getAllGlobalScreenProviders();
198
199 foreach ($plugin_providers as $provider) {
200 if (is_a($provider, $interface)) {
201 $array_of_core_providers[] = $provider;
202 }
203 }
204 }
static getAllGlobalScreenProviders()

References ilPluginAdmin\getAllGlobalScreenProviders().

+ Here is the call graph for this function:

◆ getMainBarItemInformation()

ilGSProviderFactory::getMainBarItemInformation ( )

◆ getMainBarProvider()

ilGSProviderFactory::getMainBarProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 78 of file class.ilGSProviderFactory.php.

78 : array
79 {
80 $providers = [];
81 // Core
82 $this->appendCore($providers, StaticMainMenuProvider::class);
83
84 // Plugins
85 $this->initPlugins();
86 foreach ($this->plugin_provider_collections as $collection) {
87 $provider = $collection->getMainBarProvider();
88 if ($provider) {
89 $providers[] = $provider;
90 }
91 }
92
93 $this->registerInternal($providers);
94
95 return $providers;
96 }
registerInternal(array $providers)
appendCore(array &$array_of_providers, string $interface)

References appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getMetaBarProvider()

ilGSProviderFactory::getMetaBarProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 101 of file class.ilGSProviderFactory.php.

101 : array
102 {
103 $providers = [];
104 // Core
105 $this->appendCore($providers, StaticMetaBarProvider::class);
106
107 // Plugins
108 $this->initPlugins();
109 foreach ($this->plugin_provider_collections as $collection) {
110 $provider = $collection->getMetaBarProvider();
111 if ($provider) {
112 $providers[] = $provider;
113 }
114 }
115
116 $this->registerInternal($providers);
117
118 return $providers;
119 }

References appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getModificationProvider()

ilGSProviderFactory::getModificationProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 147 of file class.ilGSProviderFactory.php.

147 : array
148 {
149 $providers = [];
150 // Core
151 $this->appendCore($providers, ModificationProvider::class);
152
153 // Plugins
154 $this->initPlugins();
155 foreach ($this->plugin_provider_collections as $collection) {
156 $provider = $collection->getModificationProvider();
157 if ($provider) {
158 $providers[] = $provider;
159 }
160 }
161
162 return $providers;
163 }

References appendCore(), and initPlugins().

+ Here is the call graph for this function:

◆ getNotificationsProvider()

ilGSProviderFactory::getNotificationsProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 168 of file class.ilGSProviderFactory.php.

168 : array
169 {
170 $providers = [];
171 // Core
172 $this->appendCore($providers, NotificationProvider::class);
173
174 // Plugins
175 $this->initPlugins();
176 foreach ($this->plugin_provider_collections as $collection) {
177 $provider = $collection->getNotificationProvider();
178 if ($provider) {
179 $providers[] = $provider;
180 }
181 }
182
183 $this->registerInternal($providers);
184
185 return $providers;
186 }

References appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ getProviderByClassName()

ilGSProviderFactory::getProviderByClassName ( string  $class_name)

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 234 of file class.ilGSProviderFactory.php.

234 : Provider
235 {
236 if (!$this->isInstanceCreationPossible($class_name) || !$this->isRegistered($class_name)) {
237 throw new \LogicException("the GlobalScreen-Provider $class_name is not available");
238 }
239
240 return $this->all_providers[$class_name];
241 }
isRegistered(string $class_name)
@inheritDoc

References isInstanceCreationPossible(), and isRegistered().

+ Here is the call graph for this function:

◆ getToolProvider()

ilGSProviderFactory::getToolProvider ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 124 of file class.ilGSProviderFactory.php.

124 : array
125 {
126 $providers = [];
127 // Core
128 $this->appendCore($providers, DynamicToolProvider::class);
129
130 // Plugins
131 $this->initPlugins();
132 foreach ($this->plugin_provider_collections as $collection) {
133 $provider = $collection->getToolProvider();
134 if ($provider) {
135 $providers[] = $provider;
136 }
137 }
138
139 $this->registerInternal($providers);
140
141 return $providers;
142 }

References appendCore(), initPlugins(), and registerInternal().

+ Here is the call graph for this function:

◆ initPlugins()

ilGSProviderFactory::initPlugins ( )
private

Definition at line 52 of file class.ilGSProviderFactory.php.

52 : void
53 {
54 if (!is_array($this->plugin_provider_collections)) {
55 $this->plugin_provider_collections = [];
56 foreach (ilPluginAdmin::getGlobalScreenProviderCollections() as $collection) {
57 $this->plugin_provider_collections[] = $collection;
58 }
59 }
60 }

Referenced by getMainBarProvider(), getMetaBarProvider(), getModificationProvider(), getNotificationsProvider(), and getToolProvider().

+ Here is the caller graph for this function:

◆ isInstanceCreationPossible()

ilGSProviderFactory::isInstanceCreationPossible ( string  $class_name)

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 246 of file class.ilGSProviderFactory.php.

246 : bool
247 {
248 try {
249 return class_exists($class_name) && $class_name !== ilPluginGlobalScreenNullProvider::class;
250 } catch (\Throwable $e) {
251 return false;
252 }
253 }

References Vendor\Package\$e.

Referenced by appendCore(), and getProviderByClassName().

+ Here is the caller graph for this function:

◆ isRegistered()

ilGSProviderFactory::isRegistered ( string  $class_name)

@inheritDoc

Implements ILIAS\GlobalScreen\Provider\ProviderFactory.

Definition at line 258 of file class.ilGSProviderFactory.php.

258 : bool
259 {
260 return isset($this->all_providers[$class_name]);
261 }

Referenced by getProviderByClassName().

+ Here is the caller graph for this function:

◆ registerInternal()

ilGSProviderFactory::registerInternal ( array  $providers)
protected
Parameters
array$providers

Definition at line 65 of file class.ilGSProviderFactory.php.

66 {
67 array_walk(
68 $providers,
69 function (Provider $item) {
70 $this->all_providers[get_class($item)] = $item;
71 }
72 );
73 }

Referenced by getMainBarProvider(), getMetaBarProvider(), getNotificationsProvider(), and getToolProvider().

+ Here is the caller graph for this function:

Field Documentation

◆ $all_providers

ilGSProviderFactory::$all_providers
protected

Definition at line 40 of file class.ilGSProviderFactory.php.

◆ $class_loader

ilGSProviderFactory::$class_loader
private

Definition at line 28 of file class.ilGSProviderFactory.php.

◆ $dic

ilGSProviderFactory::$dic
private

Definition at line 32 of file class.ilGSProviderFactory.php.

Referenced by __construct().

◆ $main_menu_item_information

ilGSProviderFactory::$main_menu_item_information = null
private

Definition at line 36 of file class.ilGSProviderFactory.php.

Referenced by getMainBarItemInformation().

◆ $plugin_provider_collections

ilGSProviderFactory::$plugin_provider_collections = null
private

Definition at line 24 of file class.ilGSProviderFactory.php.


The documentation for this class was generated from the following file: