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 array iterator using generators. |
|
9 |
* |
|
10 |
* @author Elliot Levin <elliotlevin@hotmail.com> |
|
11 |
*/ |
|
12 |
class ArrayIterator extends Generator |
|
13 |
{ |
|
14 |
use Common\ArrayIterator; |
|
15 |
|
|
16 |
public function __construct(array $array) |
|
17 |
{ |
× |
18 |
parent::__construct();
|
700 all except 329.3 ✔ |
19 |
self::__constructIterator($array); |
700 all except 329.3 ✔ |
20 |
} |
700 all except 329.3 ✔ |
21 |
|
|
22 |
public function &getIterator() |
|
23 |
{ |
× |
24 |
foreach ($this->array as $key => &$value) { |
1,648 all except 329.3 ✔ |
25 |
yield $key => $value; |
1,472 all except 329.3 ✔ |
26 |
} |
1,572 all except 329.3 ✔ |
27 |
} |
1,520 all except 329.3 ✔ |
28 |
} |