push
travis-ci
5877 of 6564 relevant lines covered (89.53%)
442.56 hits per line
1 |
<?php
|
|
2 |
|
|
3 |
namespace Pinq\Iterators\Generators; |
|
4 |
|
|
5 |
use Pinq\Iterators\Common; |
|
6 |
|
|
7 |
/**
|
|
8 |
* Implementation of the array compatible iterator using generators. |
|
9 |
* |
|
10 |
* @author Elliot Levin <elliotlevin@hotmail.com> |
|
11 |
*/ |
|
12 |
class ArrayCompatibleIterator extends IteratorGenerator |
|
13 |
{ |
|
14 |
use Common\ArrayCompatibleIterator; |
|
15 |
|
|
16 |
public function __construct(IGenerator $iterator) |
|
17 |
{ |
× |
18 |
parent::__construct($iterator); |
1,436 all except 238.3 ✔ |
19 |
} |
1,436 all except 238.3 ✔ |
20 |
|
|
21 |
protected function &iteratorGenerator(IGenerator $iterator) |
|
22 |
{ |
× |
23 |
$maxKey = 0; |
1,436 all except 238.3 ✔ |
24 |
$nonScalarKeyMap = new OrderedMap(); |
1,436 all except 238.3 ✔ |
25 |
|
|
26 |
foreach ($iterator as $key => &$value) { |
1,436 all except 238.3 ✔ |
27 |
$this->makeKeyCompatible($key, $maxKey, $nonScalarKeyMap); |
1,120 all except 238.3 ✔ |
28 |
|
|
29 |
yield $key => $value; |
1,120 all except 238.3 ✔ |
30 |
} |
1,380 all except 238.3 ✔ |
31 |
} |
1,380 all except 238.3 ✔ |
32 |
} |