1 | <?php |
||
7 | final class StreamFeedIterator implements \Iterator |
||
8 | { |
||
9 | private $eventStore; |
||
10 | |||
11 | private $streamName; |
||
12 | |||
13 | private $feed; |
||
14 | |||
15 | private $innerIterator; |
||
16 | |||
17 | private $startingRelation; |
||
18 | |||
19 | private $navigationRelation; |
||
20 | |||
21 | private $arraySortingFunction; |
||
22 | |||
23 | private $rewinded; |
||
24 | |||
25 | 9 | private function __construct( |
|
38 | |||
39 | 5 | public static function forward(EventStoreInterface $eventStore, $streamName) |
|
40 | { |
||
41 | 5 | return new self( |
|
42 | $eventStore, |
||
43 | $streamName, |
||
44 | 5 | LinkRelation::LAST(), |
|
45 | 5 | LinkRelation::PREVIOUS(), |
|
46 | 5 | 'array_reverse' |
|
47 | ); |
||
48 | } |
||
49 | |||
50 | 4 | public static function backward(EventStoreInterface $eventStore, $streamName) |
|
51 | { |
||
52 | 4 | return new self( |
|
53 | $eventStore, |
||
54 | $streamName, |
||
55 | 4 | LinkRelation::FIRST(), |
|
56 | 4 | LinkRelation::NEXT(), |
|
57 | function (array $array) { |
||
58 | 3 | return $array; |
|
59 | 4 | } |
|
60 | ); |
||
61 | } |
||
62 | |||
63 | 5 | public function current() |
|
67 | |||
68 | 6 | public function next() |
|
69 | { |
||
70 | 6 | $this->rewinded = false; |
|
71 | 6 | $this->innerIterator->next(); |
|
72 | |||
73 | 6 | if (!$this->innerIterator->valid()) { |
|
74 | 6 | $this->feed = $this |
|
75 | 6 | ->eventStore |
|
76 | 6 | ->navigateStreamFeed( |
|
77 | 6 | $this->feed, |
|
78 | 6 | $this->navigationRelation |
|
79 | ) |
||
80 | ; |
||
81 | |||
82 | 6 | $this->createInnerIterator(); |
|
83 | } |
||
84 | 6 | } |
|
85 | |||
86 | 5 | public function key() |
|
90 | |||
91 | 6 | public function valid() |
|
95 | |||
96 | 7 | public function rewind() |
|
97 | { |
||
98 | 7 | if ($this->rewinded) { |
|
118 | |||
119 | 7 | private function createInnerIterator() |
|
166 | } |
||
167 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.