forked from prooph/event-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStreamEventsSlice.php
112 lines (92 loc) · 2.43 KB
/
StreamEventsSlice.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* This file is part of prooph/event-store.
* (c) 2014-2022 Alexander Miertsch <[email protected]>
* (c) 2015-2022 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Prooph\EventStore;
/** @psalm-immutable */
class StreamEventsSlice
{
private SliceReadStatus $status;
private string $stream;
private int $fromEventNumber;
private ReadDirection $readDirection;
/** @var list<ResolvedEvent> */
private array $events;
private int $nextEventNumber;
private int $lastEventNumber;
private bool $isEndOfStream;
/**
* @internal
*
* @param list<ResolvedEvent> $events
*/
public function __construct(
SliceReadStatus $status,
string $stream,
int $fromEventNumber,
ReadDirection $readDirection,
array $events,
int $nextEventNumber,
int $lastEventNumber,
bool $isEndOfStream
) {
$this->status = $status;
$this->stream = $stream;
$this->fromEventNumber = $fromEventNumber;
$this->readDirection = $readDirection;
$this->events = $events;
$this->nextEventNumber = $nextEventNumber;
$this->lastEventNumber = $lastEventNumber;
$this->isEndOfStream = $isEndOfStream;
}
/** @psalm-mutation-free */
public function status(): SliceReadStatus
{
return $this->status;
}
/** @psalm-mutation-free */
public function stream(): string
{
return $this->stream;
}
/** @psalm-mutation-free */
public function fromEventNumber(): int
{
return $this->fromEventNumber;
}
/** @psalm-mutation-free */
public function readDirection(): ReadDirection
{
return $this->readDirection;
}
/**
* @return list<ResolvedEvent>
*
* @psalm-mutation-free
*/
public function events(): array
{
return $this->events;
}
/** @psalm-mutation-free */
public function nextEventNumber(): int
{
return $this->nextEventNumber;
}
/** @psalm-mutation-free */
public function lastEventNumber(): int
{
return $this->lastEventNumber;
}
/** @psalm-mutation-free */
public function isEndOfStream(): bool
{
return $this->isEndOfStream;
}
}