Skip to content
This repository was 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 5, 2017
1 parent c41bf0f commit 0e391df
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Slice/Slice.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ protected function walk($slice)
});
}

/**
* @return \Generator
* @throws \Deimos\Helper\Exceptions\ExceptionEmpty
*/
public function asGenerator()
{
foreach ($this->storage as $key => $object)
{
yield $key => $this->getSlice($key);
}
}

/**
* @return Slice[]
* @throws \Deimos\Helper\Exceptions\ExceptionEmpty
*/
public function asObject()
{
return iterator_to_array($this->asGenerator());
}

/**
* @return array
*/
Expand Down

0 comments on commit 0e391df

Please sign in to comment.