1 | <?php |
||
8 | final class Message |
||
9 | { |
||
10 | /** |
||
11 | * @var ObjectId |
||
12 | */ |
||
13 | private $id; |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private $payload; |
||
19 | |||
20 | /** |
||
21 | * @var UTCDateTime |
||
22 | */ |
||
23 | private $earliestGet; |
||
24 | |||
25 | /** |
||
26 | * @var float |
||
27 | */ |
||
28 | private $priority; |
||
29 | |||
30 | /** |
||
31 | * Construct a new Message instance. |
||
32 | * |
||
33 | * @param ObjectId $id The unique id of the message. |
||
34 | * @param array $payload The data to store in the message. |
||
35 | * @param UTCDateTime $earliestGet The earliest unix timestamp time which the message can be retreived. |
||
36 | * @param float $priority The priority for order out of get(). 0 is higher priority than 1. |
||
37 | */ |
||
38 | public function __construct( |
||
49 | |||
50 | /** |
||
51 | * Gets the unique id of the message. |
||
52 | * |
||
53 | * @return ObjectId |
||
54 | */ |
||
55 | public function getId() : ObjectId |
||
59 | |||
60 | /** |
||
61 | * Gets the data to store in the message. |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | public function getPayload() : array |
||
69 | |||
70 | /** |
||
71 | * Gets the earliest unix timestamp time which the message can be retreived. |
||
72 | * |
||
73 | * @return UTCDateTime |
||
74 | */ |
||
75 | public function getEarliestGet() : UTCDateTime |
||
79 | |||
80 | /** |
||
81 | * Gets the priority for order out of get(). 0 is higher priority than 1. |
||
82 | * |
||
83 | * @return float |
||
84 | */ |
||
85 | public function getPriority() : float |
||
89 | |||
90 | /** |
||
91 | * Create a clone of this message with the data to store in the message. |
||
92 | * |
||
93 | * @param array $payload The data to store in the message. |
||
94 | * |
||
95 | * @return Message |
||
96 | */ |
||
97 | public function withPayload(array $payload) : Message |
||
103 | |||
104 | /** |
||
105 | * Create a clone of this message with the earliest unix timestamp time which the message can be retreived. |
||
106 | * |
||
107 | * @param UTCDateTIme $earliestGet The earliest unix timestamp time which the message can be retreived. |
||
108 | * |
||
109 | * @return Message |
||
110 | */ |
||
111 | public function withEarliestGet(UTCDateTime $earliestGet) : Message |
||
117 | |||
118 | /** |
||
119 | * Create a clone of this message with the priority for order out of get(). 0 is higher priority than 1. |
||
120 | * |
||
121 | * @param float $priority The priority for order out of get(). 0 is higher priority than 1. |
||
122 | * |
||
123 | * @return Message |
||
124 | */ |
||
125 | public function withPriority(float $priority) : Message |
||
131 | |||
132 | private function validatePriority(float $priority) : float |
||
140 | } |
||
141 |