ILIAS  release_8 Revision v8.23
AbstractIdentification.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 use LogicException;
26 
32 {
34  protected string $provider_presentation_name;
35  protected string $internal_identifier = '';
36  protected string $classname = '';
37 
45  public function __construct(string $internal_identifier, string $classname, SerializerInterface $serializer, string $provider_presentation_name)
46  {
47  $this->provider_presentation_name = $provider_presentation_name;
48  $this->serializer = $serializer;
49  $this->internal_identifier = $internal_identifier;
50  $this->classname = $classname;
51  }
52 
56  public function serialize()
57  {
58  return $this->serializer->serialize($this);
59  }
60 
64  public function unserialize($serialized)
65  {
66  throw new LogicException("Please use the identification factory to unserialize");
67  }
68 
72  public function getClassName(): string
73  {
74  return $this->classname;
75  }
76 
80  public function getInternalIdentifier(): string
81  {
83  }
84 
88  public function getProviderNameForPresentation(): string
89  {
90  global $DIC;
94  $provider = new $this->classname($DIC);
95 
96  return $provider->getProviderNameForPresentation();
97  }
98 
102  public function __serialize(): array
103  {
104  return ['data' => $this->serialize()];
105  }
106 
107  public function __unserialize(array $data): void
108  {
109  $this->unserialize($data['data']);
110  }
111 }
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
__construct(string $internal_identifier, string $classname, SerializerInterface $serializer, string $provider_presentation_name)
CoreIdentification constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...