1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* PHP APNS. |
4
|
|
|
* |
5
|
|
|
* @author Gennady Telegin <[email protected]> |
6
|
|
|
* |
7
|
|
|
* This source file is subject to the license that is bundled |
8
|
|
|
* with this source code in the file LICENSE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Apns; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class MessageAlert. |
15
|
|
|
*/ |
16
|
|
|
class MessageAlert implements \JsonSerializable |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected $title; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected $body; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
protected $titleLocKey; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $titleLocArgs; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $actionLocKey; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $locKey; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected $locArgs; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
protected $launchImage; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return array |
60
|
|
|
*/ |
61
|
9 |
|
public function jsonSerialize() |
62
|
|
|
{ |
63
|
9 |
|
return array_filter([ |
64
|
9 |
|
'title' => $this->title, |
65
|
9 |
|
'body' => $this->body, |
66
|
9 |
|
'title-loc-key' => $this->titleLocKey, |
67
|
9 |
|
'title-loc-args' => $this->titleLocArgs, |
68
|
9 |
|
'action-loc-key' => $this->actionLocKey, |
69
|
9 |
|
'loc-key' => $this->locKey, |
70
|
9 |
|
'loc-args' => $this->locArgs, |
71
|
9 |
|
'laungh-image' => $this->launchImage, |
72
|
9 |
|
]); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
1 |
|
public function getTitle() |
79
|
|
|
{ |
80
|
1 |
|
return $this->title; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string $title |
85
|
|
|
* |
86
|
|
|
* @return self |
87
|
|
|
*/ |
88
|
1 |
|
public function setTitle($title) |
89
|
|
|
{ |
90
|
1 |
|
$this->title = $title; |
91
|
|
|
|
92
|
1 |
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
1 |
|
public function getBody() |
99
|
|
|
{ |
100
|
1 |
|
return $this->body; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param string $body |
105
|
|
|
* |
106
|
|
|
* @return self |
107
|
|
|
*/ |
108
|
2 |
|
public function setBody($body) |
109
|
|
|
{ |
110
|
2 |
|
$this->body = $body; |
111
|
|
|
|
112
|
2 |
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return string |
117
|
|
|
*/ |
118
|
1 |
|
public function getTitleLocKey() |
119
|
|
|
{ |
120
|
1 |
|
return $this->titleLocKey; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param string $titleLocKey |
125
|
|
|
* |
126
|
|
|
* @return self |
127
|
|
|
*/ |
128
|
1 |
|
public function setTitleLocKey($titleLocKey) |
129
|
|
|
{ |
130
|
1 |
|
$this->titleLocKey = $titleLocKey; |
131
|
|
|
|
132
|
1 |
|
return $this; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return string |
137
|
|
|
*/ |
138
|
1 |
|
public function getTitleLocArgs() |
139
|
|
|
{ |
140
|
1 |
|
return $this->titleLocArgs; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param string $titleLocArgs |
145
|
|
|
* |
146
|
|
|
* @return self |
147
|
|
|
*/ |
148
|
1 |
|
public function setTitleLocArgs($titleLocArgs) |
149
|
|
|
{ |
150
|
1 |
|
$this->titleLocArgs = $titleLocArgs; |
151
|
|
|
|
152
|
1 |
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
1 |
|
public function getActionLocKey() |
159
|
|
|
{ |
160
|
1 |
|
return $this->actionLocKey; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $actionLocKey |
165
|
|
|
* |
166
|
|
|
* @return self |
167
|
|
|
*/ |
168
|
1 |
|
public function setActionLocKey($actionLocKey) |
169
|
|
|
{ |
170
|
1 |
|
$this->actionLocKey = $actionLocKey; |
171
|
|
|
|
172
|
1 |
|
return $this; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return string |
177
|
|
|
*/ |
178
|
1 |
|
public function getLocKey() |
179
|
|
|
{ |
180
|
1 |
|
return $this->locKey; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @param string $locKey |
185
|
|
|
* |
186
|
|
|
* @return self |
187
|
|
|
*/ |
188
|
1 |
|
public function setLocKey($locKey) |
189
|
|
|
{ |
190
|
1 |
|
$this->locKey = $locKey; |
191
|
|
|
|
192
|
1 |
|
return $this; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
1 |
|
public function getLocArgs() |
199
|
|
|
{ |
200
|
1 |
|
return $this->locArgs; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param string $locArgs |
205
|
|
|
* |
206
|
|
|
* @return self |
207
|
|
|
*/ |
208
|
1 |
|
public function setLocArgs($locArgs) |
209
|
|
|
{ |
210
|
1 |
|
$this->locArgs = $locArgs; |
211
|
|
|
|
212
|
1 |
|
return $this; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return string |
217
|
|
|
*/ |
218
|
1 |
|
public function getLaunchImage() |
219
|
|
|
{ |
220
|
1 |
|
return $this->launchImage; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @param string $launchImage |
225
|
|
|
* |
226
|
|
|
* @return self |
227
|
|
|
*/ |
228
|
1 |
|
public function setLaunchImage($launchImage) |
229
|
|
|
{ |
230
|
1 |
|
$this->launchImage = $launchImage; |
231
|
|
|
|
232
|
1 |
|
return $this; |
233
|
|
|
} |
234
|
|
|
} |
235
|
|
|
|