| @@ 7-31 (lines=25) @@ | ||
| 4 | ||
| 5 | use Collections\KeyedIterable; |
|
| 6 | ||
| 7 | class LazySkipKeyedIterable implements KeyedIterable |
|
| 8 | { |
|
| 9 | use LazyKeyedIterableTrait; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @var KeyedIterable |
|
| 13 | */ |
|
| 14 | private $Enumerable; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @var int |
|
| 18 | */ |
|
| 19 | private $n; |
|
| 20 | ||
| 21 | public function __construct($Enumerable, $n) |
|
| 22 | { |
|
| 23 | $this->Enumerable = $Enumerable; |
|
| 24 | $this->n = $n; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function getIterator() |
|
| 28 | { |
|
| 29 | return new LazySkipKeyedIterator($this->Enumerable->getIterator(), $this->n); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 7-31 (lines=25) @@ | ||
| 4 | ||
| 5 | use Collections\KeyedIterable; |
|
| 6 | ||
| 7 | class LazyTakeKeyedIterable implements KeyedIterable |
|
| 8 | { |
|
| 9 | use LazyKeyedIterableTrait; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @var KeyedIterable |
|
| 13 | */ |
|
| 14 | private $Enumerable; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @var int |
|
| 18 | */ |
|
| 19 | private $n; |
|
| 20 | ||
| 21 | public function __construct($Enumerable, $n) |
|
| 22 | { |
|
| 23 | $this->Enumerable = $Enumerable; |
|
| 24 | $this->n = $n; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function getIterator() |
|
| 28 | { |
|
| 29 | return new LazyTakeKeyedIterator($this->Enumerable->getIterator(), $this->n); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||