1 | <?php |
||
18 | class Notification |
||
19 | { |
||
20 | const PRIORITY_HIGH = 10; |
||
21 | const PRIORITY_LOW = 5; |
||
22 | |||
23 | /** |
||
24 | * Notification payload. |
||
25 | * |
||
26 | * @var Payload |
||
27 | */ |
||
28 | private $payload; |
||
29 | |||
30 | /** |
||
31 | * Token of device. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | private $deviceToken; |
||
36 | |||
37 | /** |
||
38 | * A canonical UUID that identifies the notification. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | private $id; |
||
43 | |||
44 | /** |
||
45 | * This value identifies the date when the notification is no longer valid and can be discarded. |
||
46 | * |
||
47 | * @var \DateTime |
||
48 | */ |
||
49 | private $expirationAt; |
||
50 | |||
51 | /** |
||
52 | * The priority of the notification. |
||
53 | * |
||
54 | * @var int |
||
55 | */ |
||
56 | private $priority; |
||
57 | |||
58 | /** |
||
59 | * Id for the coalescing of similar notifications. |
||
60 | * |
||
61 | * @var string |
||
62 | */ |
||
63 | private $collapseId; |
||
64 | |||
65 | /** |
||
66 | * Notification constructor. |
||
67 | * |
||
68 | * @param Payload $payload |
||
69 | * @param string $deviceToken |
||
70 | */ |
||
71 | public function __construct(Payload $payload, string $deviceToken) |
||
76 | |||
77 | /** |
||
78 | * Get device token. |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getDeviceToken(): string |
||
86 | |||
87 | /** |
||
88 | * Get payload. |
||
89 | * |
||
90 | * @return Payload |
||
91 | */ |
||
92 | public function getPayload(): Payload |
||
96 | |||
97 | /** |
||
98 | * Get notification id. |
||
99 | * |
||
100 | * @return string|null |
||
101 | */ |
||
102 | public function getId() |
||
106 | |||
107 | /** |
||
108 | * Set notification id. |
||
109 | * |
||
110 | * @param string $id |
||
111 | * @return Notification |
||
112 | */ |
||
113 | public function setId(string $id): Notification |
||
119 | |||
120 | /** |
||
121 | * Get expiration DateTime. |
||
122 | * |
||
123 | * @return \DateTime |
||
124 | */ |
||
125 | public function getExpirationAt() |
||
129 | |||
130 | /** |
||
131 | * Set expiration DateTime. |
||
132 | * |
||
133 | * @param \DateTime $expirationAt |
||
134 | * @return Notification |
||
135 | */ |
||
136 | public function setExpirationAt(\DateTime $expirationAt): Notification |
||
142 | |||
143 | /** |
||
144 | * Get notification priority. |
||
145 | * |
||
146 | * @return int|null |
||
147 | */ |
||
148 | public function getPriority(): int |
||
152 | |||
153 | /** |
||
154 | * Set high priority. |
||
155 | * |
||
156 | * @return Notification |
||
157 | */ |
||
158 | public function setHighPriority(): Notification |
||
164 | |||
165 | /** |
||
166 | * Set low priority. |
||
167 | * |
||
168 | * @return Notification |
||
169 | */ |
||
170 | public function setLowPriority(): Notification |
||
176 | |||
177 | /** |
||
178 | * @return string|null |
||
179 | */ |
||
180 | public function getCollapseId() |
||
184 | |||
185 | /** |
||
186 | * @param string $collapseId |
||
187 | * @return Notification |
||
188 | */ |
||
189 | public function setCollapseId(string $collapseId): Notification |
||
195 | } |
||
196 |