Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Update Slice.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 authored Apr 6, 2017
1 parent 240f61d commit d8221c6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Slice/Slice.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ public function getRequired($path)
return $this->helper->arr()->getRequired($this->storage, $path);
}

/**
* @param array $storage
*
* @return static
*/
public function make(array $storage)
{
return (clone $this)->setData($storage);
}

/**
* @param string $path
*
Expand All @@ -131,8 +141,7 @@ public function getRequired($path)
*/
public function getSlice($path)
{
return (clone $this)
->setData($this->getRequired($path));
return $this->make($this->getRequired($path));
}

/**
Expand Down

0 comments on commit d8221c6

Please sign in to comment.