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 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();
|
692 all except 238.3 ✔ |
19 |
self::__constructIterator($array); |
692 all except 238.3 ✔ |
20 |
} |
692 all except 238.3 ✔ |
21 |
|
|
22 |
public function &getIterator() |
|
23 |
{ |
× |
24 |
foreach ($this->array as $key => &$value) { |
1,636 all except 238.3 ✔ |
25 |
yield $key => $value; |
1,460 all except 238.3 ✔ |
26 |
} |
1,560 all except 238.3 ✔ |
27 |
} |
1,508 all except 238.3 ✔ |
28 |
} |