| Conditions | 6 |
| Paths | 8 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 2 | public function getIterator() |
|
| 27 | { |
||
| 28 | 2 | $groupedEvents = $this->groupedEventsArray; |
|
| 29 | |||
| 30 | 2 | if ($this->groupedEventsArray instanceof \Iterator || $this->groupedEventsArray instanceof \IteratorAggregate) { |
|
| 31 | 1 | $groupedEvents = iterator_to_array($this->groupedEventsArray); |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | if ($this->skip) { |
|
|
|
|||
| 35 | 1 | $groupedEvents = array_slice($groupedEvents, $this->skip); |
|
| 36 | } |
||
| 37 | |||
| 38 | 2 | if ($this->limit) { |
|
| 39 | 1 | $groupedEvents = array_slice($groupedEvents, 0, $this->limit); |
|
| 40 | } |
||
| 41 | |||
| 42 | 2 | $deGrouper = new IteratorExpander(function ($group) { |
|
| 43 | 2 | foreach ($group as $event) { |
|
| 44 | 2 | yield $event; |
|
| 45 | } |
||
| 46 | 2 | }); |
|
| 47 | |||
| 48 | 2 | $events = iterator_to_array($deGrouper($groupedEvents)); |
|
| 49 | |||
| 50 | 2 | return new \ArrayIterator($events); |
|
| 51 | } |
||
| 52 | |||
| 62 | } |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: