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 
23 use Serializable;
24 
32 abstract class AbstractIdentification implements Serializable
33 {
34  private string $unique_id;
35 
36  final public function __construct(string $unique_id)
37  {
38  $this->unique_id = $unique_id;
39  }
40 
41 
42  final public function serialize(): string
43  {
44  return $this->unique_id;
45  }
46 
47 
48  final public function unserialize($serialized): void
49  {
50  $this->unique_id = $serialized;
51  }
52 
56  final public function __serialize(): array
57  {
58  return [
59  'unique_id' => $this->unique_id
60  ];
61  }
62 
63  final public function __unserialize(array $data): void
64  {
65  $this->unique_id = $data['unique_id'];
66  }
67 
68 
69  final public function __toString(): string
70  {
71  return $this->serialize();
72  }
73 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...