1 | <?php |
||
10 | class OptionsBuilder |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * Normal priority for the notification. |
||
15 | */ |
||
16 | const NORMAL = 'normal'; |
||
17 | |||
18 | /** |
||
19 | * High priority for the notification. |
||
20 | */ |
||
21 | const HIGH = 'high'; |
||
22 | |||
23 | /** |
||
24 | * This parameter identifies a group of messages. |
||
25 | * |
||
26 | * @var null|string |
||
27 | */ |
||
28 | protected $collapseKey; |
||
29 | |||
30 | /** |
||
31 | * Sets the priority of the message. |
||
32 | * |
||
33 | * @var null|string |
||
34 | */ |
||
35 | protected $priority; |
||
36 | |||
37 | /** |
||
38 | * When a notification or message is sent and this is set to true, |
||
39 | * an inactive client app is awoken. |
||
40 | * |
||
41 | * @var bool |
||
42 | */ |
||
43 | protected $contentAvailable = false; |
||
44 | |||
45 | /** |
||
46 | * This parameter specifies how long (in seconds) the message should be kept |
||
47 | * in FCM storage if the device is offline. |
||
48 | * |
||
49 | * @var null|int |
||
50 | */ |
||
51 | protected $timeToLive; |
||
52 | |||
53 | /** |
||
54 | * This parameter specifies the package name of the application where the registration |
||
55 | * tokens must match in order to receive the message. |
||
56 | * |
||
57 | * @var null|string |
||
58 | */ |
||
59 | protected $restrictedPackageName; |
||
60 | |||
61 | /** |
||
62 | * This parameter, when set to true, allows developers to test a request without |
||
63 | * actually sending a message. |
||
64 | * |
||
65 | * @var bool |
||
66 | */ |
||
67 | protected $dryRun = false; |
||
68 | |||
69 | /** |
||
70 | * Getter for collapseKey. |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getCollapseKey() |
||
78 | |||
79 | /** |
||
80 | * Setter for collapseKey. |
||
81 | * |
||
82 | * @param string $collapseKey Identifier for a group of messages. |
||
83 | * @return $this |
||
84 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidOptionsException |
||
85 | */ |
||
86 | public function setCollapseKey($collapseKey) |
||
95 | |||
96 | /** |
||
97 | * Getter for priority. |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getPriority() |
||
105 | |||
106 | /** |
||
107 | * Setter for priority. |
||
108 | * |
||
109 | * @param string $priority Priority of the message. |
||
110 | * @return $this |
||
111 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidOptionsException |
||
112 | */ |
||
113 | public function setPriority($priority) |
||
122 | |||
123 | /** |
||
124 | * Getter for contentAvailable. |
||
125 | * |
||
126 | * @return bool |
||
127 | */ |
||
128 | public function isContentAvailable() |
||
132 | |||
133 | /** |
||
134 | * Setter for contentAvailable. |
||
135 | * |
||
136 | * @param bool $contentAvailable Awake an inactive client app if set to `true`. |
||
137 | * @return $this |
||
138 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidOptionsException |
||
139 | */ |
||
140 | public function setContentAvailable($contentAvailable) |
||
149 | |||
150 | /** |
||
151 | * Getter for timeToLive. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getTimeToLive() |
||
159 | |||
160 | /** |
||
161 | * Setter for timeToLive. |
||
162 | * |
||
163 | * @param int $timeToLive How long (in seconds) the message should be kept in FCM storage. |
||
164 | * @return $this |
||
165 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidOptionsException |
||
166 | */ |
||
167 | public function setTimeToLive($timeToLive) |
||
176 | |||
177 | /** |
||
178 | * Getter for restrictedPackageName. |
||
179 | * |
||
180 | * @return string |
||
181 | */ |
||
182 | public function getRestrictedPackageName() |
||
186 | |||
187 | /** |
||
188 | * Setter for restrictedPackageName. |
||
189 | * |
||
190 | * @param string $restrictedPackageName Package name of the application. |
||
191 | * @return $this |
||
192 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidOptionsException |
||
193 | */ |
||
194 | public function setRestrictedPackageName($restrictedPackageName) |
||
203 | |||
204 | /** |
||
205 | * Getter for dryRun. |
||
206 | * |
||
207 | * @return bool |
||
208 | */ |
||
209 | public function isDryRun() |
||
213 | |||
214 | /** |
||
215 | * Setter for dryRun. |
||
216 | * |
||
217 | * @param bool $dryRun Test a request without sending a message if set to `true`. |
||
218 | * @return $this |
||
219 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidOptionsException |
||
220 | */ |
||
221 | public function setDryRun($dryRun) |
||
230 | } |
||
231 |