Skip to content

Commit ea47444

Browse files
committed
Merge pull request #15 from davgothic/patch-1
Fixed broken Iterator interface implementation in EnrichedActivity class
2 parents 684b1b5 + 9502f3f commit ea47444

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

src/GetStream/StreamLaravel/EnrichedActivity.php

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php namespace GetStream\StreamLaravel;
22

3-
class EnrichedActivity implements \ArrayAccess, \Iterator {
3+
class EnrichedActivity implements \ArrayAccess, \IteratorAggregate {
44
private $activityData = array();
55
private $notEnrichedData = array();
66

@@ -49,30 +49,9 @@ public function offsetGet($offset)
4949
return isset($this->activityData[$offset]) ? $this->activityData[$offset] : null;
5050
}
5151

52-
// Array iteration methods
53-
public function rewind()
54-
{
55-
reset($this->activityData);
56-
}
57-
58-
public function current()
59-
{
60-
return current($this->activityData);
61-
}
62-
63-
public function key()
64-
{
65-
return key($this->activityData);
66-
}
67-
68-
public function next()
69-
{
70-
return next($this->activityData);
71-
}
72-
73-
public function valid()
74-
{
75-
return (bool) $this->current();
52+
// Support iteration over private activityData array
53+
public function getIterator() {
54+
return new \ArrayIterator($this->activityData);
7655
}
7756

7857
}

0 commit comments

Comments
 (0)