1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the FirebaseCloudMessagingBundle. |
4
|
|
|
* |
5
|
|
|
* (c) Artem Henvald <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
declare(strict_types=1); |
12
|
|
|
|
13
|
|
|
namespace Fresh\FirebaseCloudMessagingBundle\Message\Part\Payload\Notification; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* AbstractMobileNotificationPayload. |
17
|
|
|
* |
18
|
|
|
* @author Artem Henvald <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
abstract class AbstractMobileNotificationPayload extends AbstractCommonNotificationPayload |
21
|
|
|
{ |
22
|
|
|
private ?string $sound = null; |
|
|
|
|
23
|
|
|
|
24
|
|
|
private ?string $bodyLocKey = null; |
25
|
|
|
|
26
|
|
|
/** @var string[]|null */ |
27
|
|
|
private ?array $bodyLocArgs = null; |
28
|
|
|
|
29
|
|
|
private ?string $titleLocKey = null; |
30
|
|
|
|
31
|
|
|
/** @var string[]|null */ |
32
|
|
|
private ?array $titleLocArgs = null; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param string $sound |
36
|
|
|
* |
37
|
|
|
* @return $this |
38
|
|
|
*/ |
39
|
|
|
public function setSound(string $sound): self |
40
|
|
|
{ |
41
|
|
|
$this->sound = $sound; |
42
|
|
|
|
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return string|null |
48
|
|
|
*/ |
49
|
|
|
public function getSound(): ?string |
50
|
|
|
{ |
51
|
|
|
return $this->sound; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param string $bodyLocKey |
56
|
|
|
* |
57
|
|
|
* @return $this |
58
|
|
|
*/ |
59
|
|
|
public function setBodyLocKey(string $bodyLocKey): self |
60
|
|
|
{ |
61
|
|
|
$this->bodyLocKey = $bodyLocKey; |
62
|
|
|
|
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return string|null |
68
|
|
|
*/ |
69
|
|
|
public function getBodyLocKey(): ?string |
70
|
|
|
{ |
71
|
|
|
return $this->bodyLocKey; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param string[] $bodyLocArgs |
76
|
|
|
* |
77
|
|
|
* @return $this |
78
|
|
|
*/ |
79
|
|
|
public function setBodyLocArgs(array $bodyLocArgs): self |
80
|
|
|
{ |
81
|
|
|
foreach ($bodyLocArgs as &$bodyLocArg) { |
82
|
|
|
$bodyLocArg = (string) $bodyLocArg; |
83
|
|
|
} |
84
|
|
|
unset($bodyLocArg); |
85
|
|
|
$this->bodyLocArgs = $bodyLocArgs; |
86
|
|
|
|
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return string[]|null |
92
|
|
|
*/ |
93
|
|
|
public function getBodyLocArgs(): ?array |
94
|
|
|
{ |
95
|
|
|
return $this->bodyLocArgs; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string $titleLocKey |
100
|
|
|
* |
101
|
|
|
* @return $this |
102
|
|
|
*/ |
103
|
|
|
public function setTitleLocKey(string $titleLocKey): self |
104
|
|
|
{ |
105
|
|
|
$this->titleLocKey = $titleLocKey; |
106
|
|
|
|
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return string|null |
112
|
|
|
*/ |
113
|
|
|
public function getTitleLocKey(): ?string |
114
|
|
|
{ |
115
|
|
|
return $this->titleLocKey; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @param string[] $titleLocArgs |
120
|
|
|
* |
121
|
|
|
* @return $this |
122
|
|
|
*/ |
123
|
|
|
public function setTitleLocArgs(array $titleLocArgs): self |
124
|
|
|
{ |
125
|
|
|
foreach ($titleLocArgs as &$titleLocArg) { |
126
|
|
|
$titleLocArg = (string) $titleLocArg; |
127
|
|
|
} |
128
|
|
|
unset($titleLocArg); |
129
|
|
|
$this->titleLocArgs = $titleLocArgs; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string[]|null |
136
|
|
|
*/ |
137
|
|
|
public function getTitleLocArgs(): ?array |
138
|
|
|
{ |
139
|
|
|
return $this->titleLocArgs; |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|