1 | <?php |
||
17 | abstract class Entity { |
||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $type; |
||
22 | |||
23 | /** |
||
24 | * @var array<string,mixed>|null |
||
25 | */ |
||
26 | private $properties = []; |
||
27 | |||
28 | /** |
||
29 | * @param string $type |
||
30 | * @param array<string,mixed>|null $properties |
||
31 | */ |
||
32 | 91 | public function __construct($type, array $properties = null) { |
|
41 | |||
42 | /** |
||
43 | * Get the type. |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | 62 | public function type() { |
|
50 | |||
51 | /** |
||
52 | * Set a property. |
||
53 | * |
||
54 | * @param string $key |
||
55 | * @param mixed $value |
||
56 | * @return null |
||
57 | */ |
||
58 | 65 | private function set_property($key, $value) { |
|
62 | |||
63 | /** |
||
64 | * Get the properties. |
||
65 | * |
||
66 | * @return array<string,mixed> |
||
67 | */ |
||
68 | 8 | public function properties() { |
|
74 | |||
75 | /** |
||
76 | * Get one property. |
||
77 | * |
||
78 | * @param string $name |
||
79 | * @throws \InvalidArgumentException if named propery does not exist |
||
80 | * @return mixed |
||
81 | */ |
||
82 | 43 | public function property($name) { |
|
90 | |||
91 | /** |
||
92 | * Check if entity has a property. |
||
93 | * |
||
94 | * @param string $name |
||
95 | * @return bool |
||
96 | */ |
||
97 | 44 | public function has_property($name) { |
|
100 | } |
||
101 |