ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
IdentificationFactory.php
Go to the documentation of this file.
2 
7 
35 {
36 
40  protected $provider_factory;
48  protected $map;
49 
50 
57  {
58  $this->serializer_factory = new SerializerFactory();
59  $this->map = new IdentificationMap();
60  $this->provider_factory = $provider_factory;
61  }
62 
63 
72  final public function core(\ILIAS\GlobalScreen\Provider\Provider $provider) : IdentificationProviderInterface
73  {
74  return new CoreIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
75  }
76 
77 
89  final public function plugin(\ilPlugin $plugin, \ILIAS\GlobalScreen\Provider\Provider $provider) : IdentificationProviderInterface
90  {
91  return new PluginIdentificationProvider($provider, $plugin->getId(), $this->serializer_factory->plugin(), $this->map);
92  }
93 
94 
100  final public function fromSerializedIdentification($serialized_string) : IdentificationInterface
101  {
102  if ($serialized_string === null || $serialized_string === "") {
103  return new NullIdentification();
104  }
105  if ($this->map->isInMap($serialized_string)) {
106  return $this->map->getFromMap($serialized_string);
107  }
108 
109  return $this->serializer_factory->fromSerializedIdentification($serialized_string)->unserialize($serialized_string, $this->map, $this->provider_factory);
110  }
111 }
plugin(\ilPlugin $plugin, \ILIAS\GlobalScreen\Provider\Provider $provider)
Returns a IdentificationProvider for ILIAS-Plugins which takes care of the plugin_id for further iden...
Class BaseForm.
core(\ILIAS\GlobalScreen\Provider\Provider $provider)
Returns a IdentificationProvider for core components, only a Provider is needed.
__construct(ProviderFactoryInterface $provider_factory)
IdentificationFactory constructor.