-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathChrome.php
295 lines (257 loc) · 6.64 KB
/
Chrome.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?php
/**
* gomoob/php-pushwoosh
*
* @copyright Copyright (c) 2014, GOMOOB SARL (http://gomoob.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE.md file)
*/
namespace Gomoob\Pushwoosh\Model\Notification;
/**
* Class which represents specific Pushwoosh notification informations for Google Chrome.
*
* @author Baptiste GAILLARD ([email protected])
*/
class Chrome implements \JsonSerializable
{
/**
* The time to live parameter - the maximum lifespan of a message in seconds.
*
* @var int
*/
private $gcmTtl;
/**
* The full path URL to the icon, or the path to the file in resources of the extension.
*
* @var string
*/
private $icon;
/**
* The header of the message.
*
* @var string
*/
private $title;
/**
* The image of the message.
*
* @var string
*/
private $image;
/**
* Text of the first button
*
* @var string
*/
private $buttonTextOne;
/**
* Url of the first button
*
* @var
*/
private $buttonUrlOne;
/**
* Text of the second button
*
* @var string
*/
private $buttonTextTwo;
/**
* Url of the second button
*
* @var
*/
private $buttonUrlTwo;
/**
* Utility function used to create a new Chrome instance.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome the new created instance.
*/
public static function create()
{
return new Chrome();
}
/**
* Gets the time to live parameter - the maximum lifespan of a message in seconds.
*
* @return int The time to live parameter.
*/
public function getGcmTtl()
{
return $this->gcmTtl;
}
/**
* Gets the full path URL to the icon, or the path to the file in resources of the extension.
*
* @return string the full path URL to the icon, or the path to the file in resources of the extension.
*/
public function getIcon()
{
return $this->icon;
}
/**
* Gets the header of the message.
*
* @var string The header of the message.
*/
public function getTitle()
{
return $this->title;
}
/**
* Gets the image of the message.
*
* @var string The image of the message.
*/
public function getImage()
{
return $this->image;
}
/**
* Gets the text of the first button.
*
* @return string $text The text of the first button.
*/
public function getButtonTextOne()
{
return $this->buttonTextOne;
}
/**
* Gets the url of the first button.
*
* @return string $url The url of the first button.*
*/
public function getButtonUrlOne()
{
return $this->buttonUrlOne;
}
/**
* Gets the text of the second button.
*
* @return string $text The text of the second button.*
*/
public function getButtonTextTwo()
{
return $this->buttonTextTwo;
}
/**
* Gets the url of the second button.
*
* @return string $url The url of the second button.
*/
public function getButtonUrlTwo()
{
return $this->buttonUrlTwo;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize()
{
$json = [];
isset($this->gcmTtl) ? $json['chrome_gcm_ttl'] = $this->gcmTtl : false;
isset($this->icon) ? $json['chrome_icon'] = $this->icon : false;
isset($this->title) ? $json['chrome_title'] = $this->title : false;
isset($this->image) ? $json['chrome_image'] = $this->image : false;
isset($this->buttonTextOne) ? $json['chrome_button_text1'] = $this->buttonTextOne : false;
isset($this->buttonUrlOne) ? $json['chrome_button_url1'] = $this->buttonUrlOne : false;
isset($this->buttonTextTwo) ? $json['chrome_button_text2'] = $this->buttonTextTwo : false;
isset($this->buttonUrlTwo) ? $json['chrome_button_url2'] = $this->buttonUrlTwo : false;
return $json;
}
/**
* Sets the time to live parameter - the maximum lifespan of a message in seconds.
*
* @param int $gcmTtl The time to live parameter.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setGcmTtl($gcmTtl)
{
$this->gcmTtl = $gcmTtl;
return $this;
}
/**
* Sets the full path URL to the icon, or the path to the file in resources of the extension.
*
* @param string $icon the full path URL to the icon, or the path to the file in resources of the extension.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setIcon($icon)
{
$this->icon = $icon;
return $this;
}
/**
* Sets the header of the message.
*
* @param string $title The header of the message.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Sets the image of the message.
*
* @param string $image The image of the message.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
/**
* Sets the text of the first button.
*
* @param string $text The text of the first button.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setButtonTextOne($text)
{
$this->buttonTextOne = $text;
return $this;
}
/**
* Sets the url of the first button.
*
* @param string $url The url of the first button.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setButtonUrlOne($url)
{
$this->buttonUrlOne = $url;
return $this;
}
/**
* Sets the text of the second button.
*
* @param string $text The text of the second button.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setButtonTextTwo($text)
{
$this->buttonTextTwo = $text;
return $this;
}
/**
* Sets the url of the second button.
*
* @param string $url The url of the second button.
*
* @return \Gomoob\Pushwoosh\Model\Notification\Chrome this instance.
*/
public function setButtonUrlTwo($url)
{
$this->buttonUrlTwo = $url;
return $this;
}
}