1 | <?php |
||
7 | class EventStream implements EventStreamInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var EventInterface[] |
||
11 | */ |
||
12 | private $events; |
||
13 | |||
14 | /** |
||
15 | * @param EventInterface[] $events |
||
16 | */ |
||
17 | 86 | public function __construct(array $events) |
|
21 | |||
22 | /** |
||
23 | * @return EventStream |
||
24 | */ |
||
25 | 26 | public static function buildEmpty() |
|
29 | |||
30 | /** |
||
31 | * @param EventInterface|EventInterface[] $events |
||
32 | * @return EventStream |
||
33 | */ |
||
34 | 21 | public function append($events) |
|
41 | |||
42 | /** |
||
43 | * @return EventInterface[] |
||
44 | */ |
||
45 | 34 | public function events() |
|
49 | |||
50 | /** |
||
51 | * @param int $offset |
||
52 | * @return EventInterface |
||
53 | * @throws \OutOfBoundsException |
||
54 | */ |
||
55 | 31 | public function get($offset) |
|
62 | |||
63 | /** |
||
64 | * @return EventInterface |
||
65 | * @throws \OutOfBoundsException |
||
66 | */ |
||
67 | 8 | public function last() |
|
74 | |||
75 | /** |
||
76 | * @return bool |
||
77 | */ |
||
78 | 18 | public function isEmpty() |
|
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | 48 | public function count() |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 14 | public function getIterator() |
|
98 | |||
99 | /** |
||
100 | * @param \Closure $closure |
||
101 | * @return EventStream |
||
102 | */ |
||
103 | 4 | public function filter(\Closure $closure) |
|
107 | |||
108 | /** |
||
109 | * @param \Closure $closure |
||
110 | * @return EventStream |
||
111 | */ |
||
112 | 44 | public function map(\Closure $closure) |
|
116 | |||
117 | /** |
||
118 | * @param int $offset |
||
119 | * @param int|null $length |
||
120 | * @return EventStream |
||
121 | */ |
||
122 | 6 | public function slice($offset, $length = null) |
|
126 | } |
||
127 |