ILIAS  release_7 Revision v7.30-3-g800a261c036
AbstractIdentification.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use LogicException;
26
32{
36 protected $serializer;
44 protected $internal_identifier = '';
48 protected $classname = '';
49
58 {
59 $this->provider_presentation_name = $provider_presentation_name;
60 $this->serializer = $serializer;
61 $this->internal_identifier = $internal_identifier;
62 $this->classname = $classname;
63 }
64
68 public function serialize()
69 {
70 return $this->serializer->serialize($this);
71 }
72
76 public function unserialize($serialized)
77 {
78 throw new LogicException("Please use the identification factory to unserialize");
79 }
80
84 public function getClassName() : string
85 {
86 return $this->classname;
87 }
88
92 public function getInternalIdentifier() : string
93 {
95 }
96
100 public function getProviderNameForPresentation() : string
101 {
102 global $DIC;
106 $provider = new $this->classname($DIC);
107
108 return $provider->getProviderNameForPresentation();
109 }
110
114 public function __serialize() : array
115 {
116 return ['data' => $this->serialize()];
117 }
118
119 public function __unserialize(array $data) : void
120 {
121 $this->unserialize($data['data']);
122 }
123}
An exception for terminatinating execution or to throw for unit testing.
__construct(string $internal_identifier, string $classname, SerializerInterface $serializer, string $provider_presentation_name)
CoreIdentification constructor.
global $DIC
Definition: goto.php:24
$data
Definition: storeScorm.php:23