1 | <?php |
||
17 | class MslsGetSet extends MslsRegistryInstance { |
||
18 | |||
19 | /** |
||
20 | * Generic container for all properties of an instance |
||
21 | * @var array $arr |
||
22 | */ |
||
23 | protected $arr = []; |
||
24 | |||
25 | /** |
||
26 | * Overloads the set method. |
||
27 | * |
||
28 | * @param string $key |
||
29 | * @param mixed $value |
||
30 | */ |
||
31 | public function __set( $key, $value ) { |
||
38 | |||
39 | /** |
||
40 | * Overloads the get method. |
||
41 | * |
||
42 | * @param string $key |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function __get( $key ) { |
||
48 | |||
49 | /** |
||
50 | * Overloads the isset method. |
||
51 | * |
||
52 | * @param string $key |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function __isset( $key ) { |
||
58 | |||
59 | /** |
||
60 | * Overloads the unset method. |
||
61 | * |
||
62 | * @param string $key |
||
63 | */ |
||
64 | public function __unset( $key ) { |
||
69 | |||
70 | /** |
||
71 | * Resets the properties container to an empty array. |
||
72 | * |
||
73 | * @return MslsGetSet |
||
74 | */ |
||
75 | public function reset() { |
||
80 | |||
81 | /** |
||
82 | * Checks if the array has an non empty item with the specified key name. |
||
83 | * |
||
84 | * This is method is similar to the overloaded __isset-method since |
||
85 | * __set cleans empty properties but I use for example |
||
86 | * |
||
87 | * $obj->has_value( $temp ) |
||
88 | * |
||
89 | * and not |
||
90 | * |
||
91 | * isset( $obj->$temp ) |
||
92 | * |
||
93 | * which is the same but in my opinion a little bit ugly. |
||
94 | * |
||
95 | * @param string $key |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function has_value( $key ) { |
||
101 | |||
102 | /** |
||
103 | * Checks if the properties-container is empty. |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function is_empty() { |
||
110 | |||
111 | /** |
||
112 | * Gets the complete properties-container as an array. |
||
113 | * |
||
114 | * @return array |
||
115 | */ |
||
116 | public function get_arr() { |
||
119 | |||
120 | } |
||
121 |