@@ -52,6 +52,7 @@ public function __construct($items = [], $parse = false)
5252 *
5353 * @param array|int|string $keys
5454 * @param mixed $value
55+ * @return Dot
5556 */
5657 public function add ($ keys , $ value = null )
5758 {
@@ -62,6 +63,8 @@ public function add($keys, $value = null)
6263 } elseif ($ this ->get ($ keys ) === null ) {
6364 $ this ->set ($ keys , $ value );
6465 }
66+
67+ return $ this ;
6568 }
6669
6770 /**
@@ -78,26 +81,30 @@ public function all()
7881 * Delete the contents of a given key or keys
7982 *
8083 * @param array|int|string|null $keys
84+ * @return Dot
8185 */
8286 public function clear ($ keys = null )
8387 {
8488 if ($ keys === null ) {
8589 $ this ->items = [];
8690
87- return ;
91+ return $ this ;
8892 }
8993
9094 $ keys = (array ) $ keys ;
9195
9296 foreach ($ keys as $ key ) {
9397 $ this ->set ($ key , []);
9498 }
99+
100+ return $ this ;
95101 }
96102
97103 /**
98104 * Delete the given key or keys
99105 *
100106 * @param array|int|string $keys
107+ * @return Dot
101108 */
102109 public function delete ($ keys )
103110 {
@@ -124,6 +131,8 @@ public function delete($keys)
124131
125132 unset($ items [$ lastSegment ]);
126133 }
134+
135+ return $ this ;
127136 }
128137
129138 /**
@@ -280,6 +289,7 @@ public function isEmpty($keys = null)
280289 *
281290 * @param array|string|self $key
282291 * @param array|self $value
292+ * @return Dot
283293 */
284294 public function merge ($ key , $ value = [])
285295 {
@@ -293,6 +303,8 @@ public function merge($key, $value = [])
293303 } elseif ($ key instanceof self) {
294304 $ this ->items = array_merge ($ this ->items , $ key ->all ());
295305 }
306+
307+ return $ this ;
296308 }
297309
298310 /**
@@ -303,6 +315,7 @@ public function merge($key, $value = [])
303315 *
304316 * @param array|string|self $key
305317 * @param array|self $value
318+ * @return Dot
306319 */
307320 public function mergeRecursive ($ key , $ value = [])
308321 {
@@ -316,6 +329,8 @@ public function mergeRecursive($key, $value = [])
316329 } elseif ($ key instanceof self) {
317330 $ this ->items = array_merge_recursive ($ this ->items , $ key ->all ());
318331 }
332+
333+ return $ this ;
319334 }
320335
321336 /**
@@ -327,6 +342,7 @@ public function mergeRecursive($key, $value = [])
327342 *
328343 * @param array|string|self $key
329344 * @param array|self $value
345+ * @return Dot
330346 */
331347 public function mergeRecursiveDistinct ($ key , $ value = [])
332348 {
@@ -340,6 +356,8 @@ public function mergeRecursiveDistinct($key, $value = [])
340356 } elseif ($ key instanceof self) {
341357 $ this ->items = $ this ->arrayMergeRecursiveDistinct ($ this ->items , $ key ->all ());
342358 }
359+
360+ return $ this ;
343361 }
344362
345363 /**
@@ -395,13 +413,14 @@ public function pull($key = null, $default = null)
395413 *
396414 * @param mixed $key
397415 * @param mixed $value
416+ * @return Dot
398417 */
399418 public function push ($ key , $ value = null )
400419 {
401420 if ($ value === null ) {
402421 $ this ->items [] = $ key ;
403422
404- return ;
423+ return $ this ;
405424 }
406425
407426 $ items = $ this ->get ($ key );
@@ -410,6 +429,8 @@ public function push($key, $value = null)
410429 $ items [] = $ value ;
411430 $ this ->set ($ key , $ items );
412431 }
432+
433+ return $ this ;
413434 }
414435
415436 /**
@@ -418,6 +439,7 @@ public function push($key, $value = null)
418439 *
419440 * @param array|string|self $key
420441 * @param array|self $value
442+ * @return Dot
421443 */
422444 public function replace ($ key , $ value = [])
423445 {
@@ -431,13 +453,16 @@ public function replace($key, $value = [])
431453 } elseif ($ key instanceof self) {
432454 $ this ->items = array_replace ($ this ->items , $ key ->all ());
433455 }
456+
457+ return $ this ;
434458 }
435459
436460 /**
437461 * Set a given key / value pair or pairs
438462 *
439463 * @param array|int|string $keys
440464 * @param mixed $value
465+ * @return Dot
441466 */
442467 public function set ($ keys , $ value = null )
443468 {
@@ -446,7 +471,7 @@ public function set($keys, $value = null)
446471 $ this ->set ($ key , $ value );
447472 }
448473
449- return ;
474+ return $ this ;
450475 }
451476
452477 $ items = &$ this ->items ;
@@ -460,26 +485,34 @@ public function set($keys, $value = null)
460485 }
461486
462487 $ items = $ value ;
488+
489+ return $ this ;
463490 }
464491
465492 /**
466493 * Replace all items with a given array
467494 *
468495 * @param mixed $items
496+ * @return Dot
469497 */
470498 public function setArray ($ items )
471499 {
472500 $ this ->items = $ this ->getArrayItems ($ items );
501+
502+ return $ this ;
473503 }
474504
475505 /**
476506 * Replace all items with a given array as a reference
477507 *
478508 * @param array $items
509+ * @return Dot
479510 */
480511 public function setReference (array &$ items )
481512 {
482513 $ this ->items = &$ items ;
514+
515+ return $ this ;
483516 }
484517
485518 /**
0 commit comments