push
travis-ci
7003 of 7671 relevant lines covered (91.29%)
419.83 hits per line
1 |
<?php
|
|
2 |
|
|
3 |
namespace Pinq\Iterators\Generators; |
|
4 |
|
|
5 |
use Pinq\Iterators\Common; |
|
6 |
|
|
7 |
/**
|
|
8 |
* Implementation of the grouped iterator using generators. |
|
9 |
* |
|
10 |
* @author Elliot Levin <elliotlevin@hotmail.com> |
|
11 |
*/ |
|
12 |
class GroupedIterator extends LazyGenerator |
|
13 |
{ |
|
14 |
use Common\GroupedIterator; |
|
15 |
|
|
16 |
public function __construct(IGenerator $iterator, callable $groupByFunction, callable $traversableFactory) |
|
17 |
{ |
× |
18 |
parent::__construct($iterator); |
78 all except 329.3 ✔ |
19 |
self::__constructIterator($groupByFunction, $traversableFactory); |
78 all except 329.3 ✔ |
20 |
} |
78 all except 329.3 ✔ |
21 |
|
|
22 |
protected function initializeGenerator(IGenerator $innerIterator) |
|
23 |
{ |
× |
24 |
$groupedMap = (new OrderedMap($innerIterator))->groupBy($this->groupKeyFunction); |
72 all except 329.3 ✔ |
25 |
|
|
26 |
return new ProjectionIterator( |
68 all except 329.3 ✔ |
27 |
$groupedMap,
|
68 all except 329.3 ✔ |
28 |
null,
|
68 all except 329.3 ✔ |
29 |
$this->traversableFactory);
|
68 all except 329.3 ✔ |
30 |
} |
× |
31 |
} |