Conditions | 5 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
36 | public function replayEvents(Identity $identity, $offset = null, $max = null) |
||
37 | { |
||
38 | $events = $this->store->getAggregateHistoryFor($identity, $offset, $max); |
||
39 | |||
40 | foreach ($events as $event) { |
||
41 | $method = 'when' . ClassToString::short($event); |
||
42 | |||
43 | if (!isset($this->listeners[$method])) { |
||
44 | continue; |
||
45 | } |
||
46 | |||
47 | if (is_array($this->listeners[$method])) { |
||
48 | foreach ($this->listeners[$method] as $listener) { |
||
49 | call_user_func($listener, $event); |
||
50 | } |
||
51 | } else { |
||
52 | call_user_func($this->listeners[$method], $event); |
||
53 | } |
||
54 | } |
||
55 | |||
56 | return $this; |
||
57 | } |
||
58 | } |
||
59 |