1 | <?php |
||
20 | class GCM extends MessageBase |
||
21 | { |
||
22 | /** |
||
23 | * The maximum size allowed for an Android notification payload is 4096 bytes |
||
24 | */ |
||
25 | const PAYLOAD_MAX_LENGTH = 4096; |
||
26 | |||
27 | /** |
||
28 | * It`s possible to send the same message to up to 1000 registration IDs in one request |
||
29 | */ |
||
30 | const MAX_RECIPIENTS_PER_MESSAGE_COUNT = 1000; |
||
31 | |||
32 | /** |
||
33 | * Allow test the request without actually sending the message |
||
34 | * |
||
35 | * @var boolean |
||
36 | */ |
||
37 | private $dryRun = false; |
||
38 | |||
39 | /** |
||
40 | * If there is already a message with the same collapse key (and registration ID) |
||
41 | * stored and waiting for delivery, the old message will be discarded |
||
42 | * and the new message will take its place |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | private $collapseKey; |
||
47 | |||
48 | /** |
||
49 | * Message payload data |
||
50 | * |
||
51 | * @var array |
||
52 | */ |
||
53 | private $payloadData; |
||
54 | |||
55 | /** |
||
56 | * If the device is connected but idle, the message will still be delivered right away |
||
57 | * unless the delay_while_idle flag is set to true |
||
58 | * |
||
59 | * @var boolean |
||
60 | */ |
||
61 | private $delayWhileIdle; |
||
62 | |||
63 | /** |
||
64 | * Package name of you application |
||
65 | * |
||
66 | * @var string |
||
67 | */ |
||
68 | private $packageName; |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getMessageType() |
||
77 | |||
78 | /** |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getCollapseKey() |
||
85 | |||
86 | /** |
||
87 | * @param string $collapseKey |
||
88 | * @return $this |
||
89 | */ |
||
90 | public function setCollapseKey($collapseKey) |
||
95 | |||
96 | /** |
||
97 | * @return boolean |
||
98 | */ |
||
99 | public function isDelayWhileIdle() |
||
103 | |||
104 | /** |
||
105 | * @param boolean $delayWhileIdle |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function setDelayWhileIdle($delayWhileIdle) |
||
113 | |||
114 | /** |
||
115 | * @return boolean |
||
116 | */ |
||
117 | public function isDryRun() |
||
121 | |||
122 | /** |
||
123 | * @param boolean $dryRun |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function setDryRun($dryRun) |
||
131 | |||
132 | /** |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getPackageName() |
||
139 | |||
140 | /** |
||
141 | * @param string $packageName |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function setPackageName($packageName) |
||
149 | |||
150 | /** |
||
151 | * @return array |
||
152 | */ |
||
153 | public function getPayloadData() |
||
157 | |||
158 | /** |
||
159 | * @param array $payloadData |
||
160 | * @return $this |
||
161 | */ |
||
162 | public function setPayloadData($payloadData) |
||
167 | |||
168 | /** |
||
169 | * @param array $recipients |
||
170 | * @return array |
||
171 | */ |
||
172 | public function createMessage($recipients) |
||
196 | |||
197 | /** |
||
198 | * @param string $message |
||
199 | * @param array $recipients |
||
200 | * @return array |
||
201 | */ |
||
202 | public function packMessage($message, $recipients) |
||
209 | |||
210 | /** |
||
211 | * {@inheritdoc} |
||
212 | */ |
||
213 | public function validateRecipient($token) |
||
224 | } |
||
225 |