1 | <?php |
||
20 | class Properties |
||
21 | { |
||
22 | /** |
||
23 | * Properties. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | private $properties = []; |
||
28 | |||
29 | /** |
||
30 | * Properties constructor. |
||
31 | * |
||
32 | * @param array $properties Properties. |
||
33 | */ |
||
34 | public function __construct(array $properties = []) |
||
38 | |||
39 | /** |
||
40 | * Get properties. |
||
41 | * |
||
42 | * @return array |
||
43 | */ |
||
44 | public function toArray(): array |
||
48 | |||
49 | /** |
||
50 | * Check if a property exists. |
||
51 | * |
||
52 | * @param string $propertyName Name of the property. |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | public function has(string $propertyName): bool |
||
60 | |||
61 | /** |
||
62 | * Set a property value. |
||
63 | * |
||
64 | * @param string $propertyName Name of the property. |
||
65 | * @param mixed $value Value of the property. |
||
66 | * |
||
67 | * @return Properties |
||
68 | */ |
||
69 | public function set(string $propertyName, $value): self |
||
75 | |||
76 | /** |
||
77 | * Get the property value. If property does not exist, null is returned. |
||
78 | * |
||
79 | * @param string $propertyName Name of the property. |
||
80 | * |
||
81 | * @return mixed |
||
82 | */ |
||
83 | public function get(string $propertyName) |
||
91 | } |
||
92 |