ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilGSProviderStorage.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
14  public function getCache() : ilGlobalCache
15  {
17  }
18 
19 
24  public static function registerIdentifications(string $class_name, string $purpose)
25  {
26  if (!class_exists($class_name)) {
27  throw new LogicException("Cannot store unknown provider {$class_name}");
28  }
29 
30  $gsp = ilGSProviderStorage::find($class_name);
31  if ($gsp === null) {
32  $gsp = new ilGSProviderStorage();
33  $gsp->setProviderClass($class_name);
34  $gsp->create();
35  }
36  $gsp->setProviderClass($class_name);
37  $gsp->setPurpose($purpose);
38  $gsp->setDynamic(in_array(DynamicProvider::class, class_implements($class_name)));
39  $gsp->update();
40 
41  $instance = $gsp->getInstance();
42 
43  foreach ($instance->getAllIdentifications() as $identification) {
45  }
46  }
47 
48 
58  protected $provider_class;
66  protected $purpose = '';
74  protected $dynamic = false;
78  protected $instance;
82  protected $connector_container_name = "il_gs_providers";
83 
84 
88  final public function getConnectorContainerName()
89  {
91  }
92 
93 
97  public function getProviderClass() : string
98  {
99  return $this->provider_class;
100  }
101 
102 
109  {
110  $this->provider_class = $provider_class;
111 
112  return $this;
113  }
114 
115 
119  public function getPurpose() : string
120  {
121  return $this->purpose;
122  }
123 
124 
130  public function setPurpose(string $purpose) : ilGSProviderStorage
131  {
132  $this->purpose = $purpose;
133 
134  return $this;
135  }
136 
137 
141  public function isDynamic() : bool
142  {
143  return $this->dynamic;
144  }
145 
146 
152  public function setDynamic(bool $dynamic) : ilGSProviderStorage
153  {
154  $this->dynamic = $dynamic;
155 
156  return $this;
157  }
158 
159 
163  public function getInstance() : ILIAS\GlobalScreen\Provider\Provider
164  {
165  global $DIC;
166  if (!$this->instance instanceof ILIAS\GlobalScreen\Provider\Provider) {
167  $class_name = $this->provider_class;
168  $this->instance = new $class_name($DIC);
169  }
170 
171  return $this->instance;
172  }
173 }
static find($primary_key, array $add_constructor_args=array())
Class CachedActiveRecord.
global $DIC
Definition: saml.php:7
static registerIdentifications(string $class_name, string $purpose)
Class BaseForm.
static getInstance($component)
Class ilGSProviderStorage.
setProviderClass(string $provider_class)
instance(Loop $newLoop=null)
Retrieves or sets the global Loop object.
Definition: functions.php:173
static registerIdentification(\ILIAS\GlobalScreen\Identification\IdentificationInterface $identification, \ILIAS\GlobalScreen\Provider\Provider $provider)