1 | <?php |
||
20 | class Notification |
||
21 | { |
||
22 | const PRIORITY_HIGH = 10; |
||
23 | const PRIORITY_LOW = 5; |
||
24 | |||
25 | /** |
||
26 | * Notification payload. |
||
27 | * |
||
28 | * @var Payload |
||
29 | */ |
||
30 | private $payload; |
||
31 | |||
32 | /** |
||
33 | * Token of device. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $deviceToken; |
||
38 | |||
39 | /** |
||
40 | * A canonical UUID that identifies the notification. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | private $id; |
||
45 | |||
46 | /** |
||
47 | * This value identifies the date when the notification is no longer valid and can be discarded. |
||
48 | * |
||
49 | * @var DateTime |
||
50 | */ |
||
51 | private $expirationAt; |
||
52 | |||
53 | /** |
||
54 | * The priority of the notification. |
||
55 | * |
||
56 | * @var int |
||
57 | */ |
||
58 | private $priority; |
||
59 | |||
60 | /** |
||
61 | * Id for the coalescing of similar notifications. |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | private $collapseId; |
||
66 | |||
67 | /** |
||
68 | * Notification constructor. |
||
69 | * |
||
70 | * @param Payload $payload |
||
71 | * @param string $deviceToken |
||
72 | */ |
||
73 | public function __construct(Payload $payload, string $deviceToken) |
||
78 | |||
79 | /** |
||
80 | * Get device token. |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getDeviceToken(): string |
||
88 | |||
89 | /** |
||
90 | * Get payload. |
||
91 | * |
||
92 | * @return Payload |
||
93 | */ |
||
94 | public function getPayload(): Payload |
||
98 | |||
99 | /** |
||
100 | * Get notification id. |
||
101 | * |
||
102 | * @return string|null |
||
103 | */ |
||
104 | public function getId() |
||
108 | |||
109 | /** |
||
110 | * Set notification id. |
||
111 | * |
||
112 | * @param string $id |
||
113 | * @return Notification |
||
114 | */ |
||
115 | public function setId(string $id): Notification |
||
121 | |||
122 | /** |
||
123 | * Get expiration DateTime. |
||
124 | * |
||
125 | * @return DateTime|null |
||
126 | */ |
||
127 | public function getExpirationAt(): ?DateTime |
||
131 | |||
132 | /** |
||
133 | * Set expiration DateTime. |
||
134 | * |
||
135 | * @param DateTime $expirationAt |
||
136 | * @return Notification |
||
137 | */ |
||
138 | public function setExpirationAt(DateTime $expirationAt): Notification |
||
144 | |||
145 | /** |
||
146 | * Get notification priority. |
||
147 | * |
||
148 | * @return int|null |
||
149 | */ |
||
150 | public function getPriority() |
||
154 | |||
155 | /** |
||
156 | * Set high priority. |
||
157 | * |
||
158 | * @return Notification |
||
159 | */ |
||
160 | public function setHighPriority(): Notification |
||
166 | |||
167 | /** |
||
168 | * Set low priority. |
||
169 | * |
||
170 | * @return Notification |
||
171 | */ |
||
172 | public function setLowPriority(): Notification |
||
178 | |||
179 | /** |
||
180 | * @return string|null |
||
181 | */ |
||
182 | public function getCollapseId() |
||
186 | |||
187 | /** |
||
188 | * @param string $collapseId |
||
189 | * @return Notification |
||
190 | */ |
||
191 | public function setCollapseId(string $collapseId): Notification |
||
197 | } |
||
198 |