Skip to content

Commit 4b7d272

Browse files
authored
Add huawei platform (#11)
* Add huawei platform
1 parent 2c36e4d commit 4b7d272

File tree

6 files changed

+495
-8
lines changed

6 files changed

+495
-8
lines changed
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
<?php
2+
3+
namespace Gomoob\Pushwoosh\Model\Notification;
4+
5+
final class Huawei implements \JsonSerializable
6+
{
7+
/**
8+
* @var bool|null
9+
*/
10+
private $badges;
11+
12+
/**
13+
* @var string|null
14+
*/
15+
private $banner;
16+
17+
/**
18+
* @var string|null
19+
*/
20+
private $customIcon;
21+
22+
/**
23+
* @var int|null
24+
*/
25+
private $gcmTtl;
26+
27+
/**
28+
* @var string|null
29+
*/
30+
private $header;
31+
32+
/**
33+
* @var string|null
34+
*/
35+
private $ibc;
36+
37+
/**
38+
* @var string|null
39+
*/
40+
private $icon;
41+
42+
/**
43+
* @var string|null
44+
*/
45+
private $led;
46+
47+
/**
48+
* @var int|null
49+
*/
50+
private $priority;
51+
52+
/**
53+
* @var array|null
54+
*/
55+
private $rootParams;
56+
57+
/**
58+
* @var string|null
59+
*/
60+
private $sound;
61+
62+
/**
63+
* @var boolean
64+
*/
65+
private $vibration;
66+
67+
public static function create()
68+
{
69+
return new self();
70+
}
71+
72+
public function getBadges()
73+
{
74+
return $this->badges;
75+
}
76+
77+
public function getBanner()
78+
{
79+
return $this->banner;
80+
}
81+
82+
public function getCustomIcon()
83+
{
84+
return $this->customIcon;
85+
}
86+
87+
public function getGcmTtl()
88+
{
89+
return $this->gcmTtl;
90+
}
91+
92+
public function getHeader()
93+
{
94+
return $this->header;
95+
}
96+
97+
public function getIbc()
98+
{
99+
return $this->ibc;
100+
}
101+
102+
public function getIcon()
103+
{
104+
return $this->icon;
105+
}
106+
107+
public function getLed()
108+
{
109+
return $this->led;
110+
}
111+
112+
public function getPriority()
113+
{
114+
return $this->priority;
115+
}
116+
117+
public function getRootParams()
118+
{
119+
return $this->rootParams;
120+
}
121+
122+
public function getSound()
123+
{
124+
return $this->sound;
125+
}
126+
127+
public function isVibration()
128+
{
129+
return $this->vibration;
130+
}
131+
132+
public function jsonSerialize()
133+
{
134+
$json = [];
135+
136+
if ($this->badges !== null) {
137+
$json['huawei_android_badges'] = $this->badges;
138+
}
139+
140+
if ($this->banner !== null) {
141+
$json['huawei_android_banner'] = $this->banner;
142+
}
143+
144+
if ($this->customIcon !== null) {
145+
$json['huawei_android_custom_icon'] = $this->customIcon;
146+
}
147+
148+
if ($this->gcmTtl !== null) {
149+
$json['huawei_android_gcm_ttl'] = $this->gcmTtl;
150+
}
151+
152+
if ($this->header !== null) {
153+
$json['huawei_android_header'] = $this->header;
154+
}
155+
156+
if ($this->ibc !== null) {
157+
$json['huawei_android_ibc'] = $this->ibc;
158+
}
159+
160+
if ($this->icon !== null) {
161+
$json['huawei_android_icon'] = $this->icon;
162+
}
163+
164+
if ($this->led !== null) {
165+
$json['huawei_android_led'] = $this->led;
166+
}
167+
168+
if ($this->priority !== null) {
169+
$json['huawei_android_priority'] = $this->priority;
170+
}
171+
172+
if ($this->rootParams !== null) {
173+
$json['huawei_android_root_params'] = $this->rootParams;
174+
}
175+
176+
if ($this->sound !== null) {
177+
$json['huawei_android_sound'] = $this->sound;
178+
}
179+
180+
if ($this->vibration !== null) {
181+
$json['huawei_android_vibration'] = $this->vibration ? 1 : 0;
182+
}
183+
184+
return $json;
185+
}
186+
187+
public function setBadges($badges)
188+
{
189+
$this->badges = $badges;
190+
191+
return $this;
192+
}
193+
194+
public function setBanner($banner)
195+
{
196+
$this->banner = $banner;
197+
198+
return $this;
199+
}
200+
201+
public function setCustomIcon($customIcon)
202+
{
203+
$this->customIcon = $customIcon;
204+
205+
return $this;
206+
}
207+
208+
public function setGcmTtl($gcmTtl)
209+
{
210+
$this->gcmTtl = $gcmTtl;
211+
212+
return $this;
213+
}
214+
215+
public function setHeader($header)
216+
{
217+
$this->header = $header;
218+
219+
return $this;
220+
}
221+
222+
public function setIbc($ibc)
223+
{
224+
$this->ibc = $ibc;
225+
226+
return $this;
227+
}
228+
229+
public function setIcon($icon)
230+
{
231+
$this->icon = $icon;
232+
233+
return $this;
234+
}
235+
236+
public function setLed($led)
237+
{
238+
$this->led = $led;
239+
240+
return $this;
241+
}
242+
243+
public function setPriority($priority)
244+
{
245+
$this->priority = $priority;
246+
247+
return $this;
248+
}
249+
250+
public function setRootParams($rootParams)
251+
{
252+
$this->rootParams = $rootParams;
253+
254+
return $this;
255+
}
256+
257+
public function setSound($sound)
258+
{
259+
$this->sound = $sound;
260+
261+
return $this;
262+
}
263+
264+
public function setVibration($vibration)
265+
{
266+
$this->vibration = $vibration;
267+
268+
return $this;
269+
}
270+
}

src/main/php/Gomoob/Pushwoosh/Model/Notification/Notification.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ class Notification implements \JsonSerializable
260260
*/
261261
private $wP;
262262

263+
/**
264+
* @var Huawei
265+
*/
266+
private $huawei;
267+
263268
/**
264269
* Utility function used to create a new notification.
265270
*
@@ -647,6 +652,14 @@ public function getWP()
647652
{
648653
return $this->wP;
649654
}
655+
656+
/**
657+
* @return Huawei
658+
*/
659+
public function getHuawei()
660+
{
661+
return $this->huawei;
662+
}
650663

651664
/**
652665
* Creates a JSON representation of this request.
@@ -707,7 +720,8 @@ public function jsonSerialize()
707720
$this->mac,
708721
$this->safari,
709722
$this->wNS,
710-
$this->wP
723+
$this->wP,
724+
$this->huawei
711725
);
712726
}
713727

@@ -1162,4 +1176,15 @@ public function setWP(WP $wP)
11621176

11631177
return $this;
11641178
}
1179+
1180+
/**
1181+
* @param Huawei $huawei
1182+
* @return $this
1183+
*/
1184+
public function setHuawei(Huawei $huawei)
1185+
{
1186+
$this->huawei = $huawei;
1187+
1188+
return $this;
1189+
}
11651190
}

src/main/php/Gomoob/Pushwoosh/Model/Notification/Platform.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class Platform
6060
*/
6161
const FIREFOX = 12;
6262

63+
/**
64+
* @const string Huawei
65+
*/
66+
const HUAWEI = 17;
67+
6368
/**
6469
* The value of the platform, this can be equal to :
6570
* - 1 : iOS
@@ -73,7 +78,7 @@ class Platform
7378
* - 10: Safari
7479
* - 11: Chrome
7580
* - 12: Firefox
76-
*
81+
* - 17: Huawei
7782
* @var int
7883
*/
7984
private $value;
@@ -198,6 +203,11 @@ public static function firefox()
198203
return new Platform(self::FIREFOX);
199204
}
200205

206+
public static function huawei()
207+
{
208+
return new Platform(self::HUAWEI);
209+
}
210+
201211
/**
202212
* Gets the value of the plateform, this can be equal to :
203213
* - 1 : iOS
@@ -211,6 +221,7 @@ public static function firefox()
211221
* - 10: Safari
212222
* - 11: Chrome
213223
* - 12: Firefox
224+
* - 17: Huawei
214225
*
215226
* @return int the value of the platform.
216227
*/

0 commit comments

Comments
 (0)