1 | <?php |
||
11 | final class UserMapping implements ArrayAccess |
||
12 | { |
||
13 | public const FIELD_ID = 'id'; |
||
14 | public const FILED_EMAIL = 'email'; |
||
15 | public const FIELD_PASSWORD = 'password'; |
||
16 | public const FIELD_USERNAME = 'username'; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $className; |
||
20 | |||
21 | /** @var array */ |
||
22 | private $fields = [ |
||
23 | self::FIELD_ID => 'id', |
||
24 | self::FILED_EMAIL => 'email', |
||
25 | self::FIELD_PASSWORD => 'password', |
||
26 | self::FIELD_USERNAME => 'username', |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * @param string $className |
||
31 | * @param array $fields |
||
32 | */ |
||
33 | public function __construct(string $className, array $fields) |
||
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getClassName(): string |
||
46 | |||
47 | /** |
||
48 | * @param mixed $name |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function __isset($name): bool |
||
56 | |||
57 | /** |
||
58 | * @param mixed $name |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function __get($name): string |
||
73 | |||
74 | /** |
||
75 | * @param mixed $name |
||
76 | * @param mixed $value |
||
77 | * |
||
78 | * @return void |
||
79 | * @throws \SixtyEightPublishers\User\Common\Exception\RuntimeException |
||
80 | */ |
||
81 | public function __set($name, $value): void |
||
88 | |||
89 | /** |
||
90 | * @param mixed $name |
||
91 | * |
||
92 | * @return void |
||
93 | * @throws \SixtyEightPublishers\User\Common\Exception\RuntimeException |
||
94 | */ |
||
95 | public function __unset($name): void |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function offsetExists($offset): bool |
||
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | public function offsetGet($offset): string |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function offsetSet($offset, $value): void |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function offsetUnset($offset): void |
||
134 | } |
||
135 |