ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ILIAS\GlobalScreen\Provider\ProviderFactory Class Reference

Class ProviderFactory. More...

+ Inheritance diagram for ILIAS\GlobalScreen\Provider\ProviderFactory:
+ Collaboration diagram for ILIAS\GlobalScreen\Provider\ProviderFactory:

Public Member Functions

 __construct (array $main_bar_providers, ItemInformation $main_menu_item_information)
 ProviderFactory constructor. More...
 
 getMainBarProvider ()
 
 getMainBarItemInformation ()
 
 getProviderByClassName (string $class_name)
 
 isInstanceCreationPossible (string $class_name)
 
 isRegistered (string $class_name)
 

Protected Member Functions

 registerInternal (array $providers)
 

Protected Attributes

 $all_providers
 

Private Attributes

 $main_bar_providers = []
 
 $main_menu_item_information = null
 

Detailed Description

Class ProviderFactory.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 13 of file ProviderFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\Provider\ProviderFactory::__construct ( array  $main_bar_providers,
ItemInformation  $main_menu_item_information 
)

ProviderFactory constructor.

Parameters
array$main_bar_providers
ItemInformation$main_menu_item_information

Definition at line 36 of file ProviderFactory.php.

References ILIAS\GlobalScreen\Provider\ProviderFactory\$main_bar_providers, ILIAS\GlobalScreen\Provider\ProviderFactory\$main_menu_item_information, and ILIAS\GlobalScreen\Provider\ProviderFactory\registerInternal().

37  {
38  $this->main_bar_providers = $main_bar_providers;
39  $this->main_menu_item_information = $main_menu_item_information;
40 
42  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getMainBarItemInformation()

ILIAS\GlobalScreen\Provider\ProviderFactory::getMainBarItemInformation ( )

◆ getMainBarProvider()

ILIAS\GlobalScreen\Provider\ProviderFactory::getMainBarProvider ( )

◆ getProviderByClassName()

ILIAS\GlobalScreen\Provider\ProviderFactory::getProviderByClassName ( string  $class_name)

Implements ILIAS\GlobalScreen\Provider\ProviderFactoryInterface.

Definition at line 80 of file ProviderFactory.php.

References ILIAS\GlobalScreen\Provider\ProviderFactory\isInstanceCreationPossible(), and ILIAS\GlobalScreen\Provider\ProviderFactory\isRegistered().

80  : Provider
81  {
82  if (!$this->isInstanceCreationPossible($class_name) || !$this->isRegistered($class_name)) {
83  throw new \LogicException("the GlobalScreen-Provider $class_name is not available");
84  }
85 
86  return $this->all_providers[$class_name];
87  }
+ Here is the call graph for this function:

◆ isInstanceCreationPossible()

ILIAS\GlobalScreen\Provider\ProviderFactory::isInstanceCreationPossible ( string  $class_name)

Implements ILIAS\GlobalScreen\Provider\ProviderFactoryInterface.

Definition at line 93 of file ProviderFactory.php.

Referenced by ilGSProviderFactory\appendPlugins(), and ILIAS\GlobalScreen\Provider\ProviderFactory\getProviderByClassName().

93  : bool
94  {
95  return class_exists($class_name);
96  }
+ Here is the caller graph for this function:

◆ isRegistered()

ILIAS\GlobalScreen\Provider\ProviderFactory::isRegistered ( string  $class_name)

Implements ILIAS\GlobalScreen\Provider\ProviderFactoryInterface.

Definition at line 102 of file ProviderFactory.php.

Referenced by ILIAS\GlobalScreen\Provider\ProviderFactory\getProviderByClassName().

102  : bool
103  {
104  return isset($this->all_providers[$class_name]);
105  }
+ Here is the caller graph for this function:

◆ registerInternal()

ILIAS\GlobalScreen\Provider\ProviderFactory::registerInternal ( array  $providers)
protected
Parameters
array$providers

Definition at line 48 of file ProviderFactory.php.

Referenced by ILIAS\GlobalScreen\Provider\ProviderFactory\__construct(), and ilGSProviderFactory\getMainBarProvider().

49  {
50  array_walk(
51  $providers,
52  function (Provider $item) {
53  $this->all_providers[get_class($item)] = $item;
54  }
55  );
56  }
+ Here is the caller graph for this function:

Field Documentation

◆ $all_providers

ILIAS\GlobalScreen\Provider\ProviderFactory::$all_providers
protected

Definition at line 27 of file ProviderFactory.php.

◆ $main_bar_providers

ILIAS\GlobalScreen\Provider\ProviderFactory::$main_bar_providers = []
private

◆ $main_menu_item_information

ILIAS\GlobalScreen\Provider\ProviderFactory::$main_menu_item_information = null
private

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