ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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(Provider $provider) : IdentificationProviderInterface
73  {
74  return new CoreIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
75  }
76 
77 
86  final public function tool(Provider $provider) : IdentificationProviderInterface
87  {
88  return new ToolIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
89  }
90 
91 
103  final public function plugin(string $plugin_id, Provider $provider) : IdentificationProviderInterface
104  {
105  return new PluginIdentificationProvider($provider, $plugin_id, $this->serializer_factory->plugin(), $this->map);
106  }
107 
108 
114  final public function fromSerializedIdentification($serialized_string) : IdentificationInterface
115  {
116  if ($serialized_string === null || $serialized_string === "") {
117  return new NullIdentification();
118  }
119  if ($this->map->isInMap($serialized_string)) {
120  return $this->map->getFromMap($serialized_string);
121  }
122 
123  return $this->serializer_factory->fromSerializedIdentification($serialized_string)->unserialize($serialized_string, $this->map, $this->provider_factory);
124  }
125 }
plugin(string $plugin_id, Provider $provider)
Returns a IdentificationProvider for ILIAS-Plugins which takes care of the plugin_id for further iden...
__construct(ProviderFactory $provider_factory)
IdentificationFactory constructor.
tool(Provider $provider)
Returns a IdentificationProvider for core tools, only a Provider is needed.
core(Provider $provider)
Returns a IdentificationProvider for core components, only a Provider is needed.