Commit 5ea9c439 authored by Andrzej Prusinowski's avatar Andrzej Prusinowski

EntryList - add limit()

parent 561403a7
......@@ -2,8 +2,6 @@
namespace Avris\Esse\Entity;
use Traversable;
final class EntryList implements \IteratorAggregate, \Countable, \JsonSerializable
{
/** @var Entry[] */
......@@ -35,6 +33,14 @@ final class EntryList implements \IteratorAggregate, \Countable, \JsonSerializab
return $newList;
}
public function limit(int $offset, int $length): self
{
$newList = new self();
$newList->entries = array_slice($this->entries, $offset, $length);
return $newList;
}
public function getIterator()
{
return new \ArrayIterator($this->entries);
......@@ -54,4 +60,4 @@ final class EntryList implements \IteratorAggregate, \Countable, \JsonSerializab
{
return $this->entries;
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment