ILIAS  release_7 Revision v7.30-3-g800a261c036
IdentificationFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
21
26
48{
60 protected $map;
61
67 {
68 $this->serializer_factory = new SerializerFactory();
69 $this->map = new IdentificationMap();
70 $this->provider_factory = $provider_factory;
71 }
72
77 final public function core(Provider $provider) : CoreIdentificationProvider
78 {
79 return new CoreIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
80 }
81
86 final public function tool(Provider $provider) : ToolIdentificationProvider
87 {
88 return new ToolIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
89 }
90
97 final public function plugin(string $plugin_id, Provider $provider) : PluginIdentificationProvider
98 {
99 return new PluginIdentificationProvider($provider, $plugin_id, $this->serializer_factory->plugin(), $this->map);
100 }
101
106 final public function fromSerializedIdentification($serialized_string) : IdentificationInterface
107 {
108 if ($serialized_string === null || $serialized_string === "") {
109 return new NullIdentification();
110 }
111 if ($this->map->isInMap($serialized_string)) {
112 return $this->map->getFromMap($serialized_string);
113 }
114
115 return $this->serializer_factory->fromSerializedIdentification($serialized_string)->unserialize($serialized_string, $this->map, $this->provider_factory);
116 }
117}
An exception for terminatinating execution or to throw for unit testing.
Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the sup...
plugin(string $plugin_id, Provider $provider)
Returns a IdentificationProvider for ILIAS-Plugins which takes care of the plugin_id for further iden...
core(Provider $provider)
Returns a IdentificationProvider for core components, only a Provider is needed.
tool(Provider $provider)
Returns a IdentificationProvider for core tools, only a Provider is needed.
__construct(ProviderFactory $provider_factory)
IdentificationFactory constructor.