@@ -30,8 +30,8 @@ public function __construct(array $data = null)
3030 /**
3131 * Set value or array of values to path
3232 *
33- * @param mixed $key Path or array of paths and values
34- * @param mixed $value Value to set if path is not an array
33+ * @param mixed $key Path or array of paths and values
34+ * @param mixed|null $value Value to set if path is not an array
3535 */
3636 public function set ($ key , $ value = null )
3737 {
@@ -65,9 +65,9 @@ public function set($key, $value = null)
6565 /**
6666 * Add value or array of values to path
6767 *
68- * @param mixed $key Path or array of paths and values
69- * @param mixed $value Value to set if path is not an array
70- * @param boolean $pop Helper to pop out last key if value is an array
68+ * @param mixed $key Path or array of paths and values
69+ * @param mixed|null $value Value to set if path is not an array
70+ * @param boolean $pop Helper to pop out last key if value is an array
7171 */
7272 public function add ($ key , $ value = null , $ pop = false )
7373 {
@@ -104,9 +104,9 @@ public function add($key, $value = null, $pop = false)
104104 /**
105105 * Get value of path, default value if path doesn't exist or all data
106106 *
107- * @param string $key Path
108- * @param mixed $default Default value
109- * @return mixed Value of path
107+ * @param mixed|null $key Path
108+ * @param mixed|null $default Default value
109+ * @return mixed Value of path
110110 */
111111 public function get ($ key = null , $ default = null )
112112 {
@@ -151,7 +151,7 @@ public function has(string $key)
151151 /**
152152 * Delete path or array of paths
153153 *
154- * @param mixed $key Path or array of paths to delete
154+ * @param mixed $key Path or array of paths to delete
155155 */
156156 public function delete ($ key )
157157 {
@@ -182,8 +182,8 @@ public function delete($key)
182182 * Delete all data, data from path or array of paths and
183183 * optionally format path if it doesn't exist
184184 *
185- * @param mixed $key Path or array of paths to clean
186- * @param boolean $format Format option
185+ * @param mixed|null $key Path or array of paths to clean
186+ * @param boolean $format Format option
187187 */
188188 public function clear ($ key = null , $ format = false )
189189 {
@@ -253,4 +253,24 @@ public function offsetUnset($offset)
253253 {
254254 $ this ->delete ($ offset );
255255 }
256+
257+ /**
258+ * Magic methods
259+ */
260+ public function __set ($ key , $ value = null )
261+ {
262+ $ this ->set ($ key , $ value );
263+ }
264+ public function __get ($ key )
265+ {
266+ return $ this ->get ($ key );
267+ }
268+ public function __isset ($ key )
269+ {
270+ return $ this ->has ($ key );
271+ }
272+ public function __unset ($ key )
273+ {
274+ $ this ->delete ($ key );
275+ }
256276}
0 commit comments