1 | <?php |
||
11 | class Notification |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * Indicates notification title. |
||
16 | * |
||
17 | * @var null|string |
||
18 | */ |
||
19 | protected $title; |
||
20 | |||
21 | /** |
||
22 | * Indicates notification body text. |
||
23 | * |
||
24 | * @var null|string |
||
25 | */ |
||
26 | protected $body; |
||
27 | |||
28 | /** |
||
29 | * Indicates a sound to play when the device receives a notification. |
||
30 | * |
||
31 | * @var null|string |
||
32 | */ |
||
33 | protected $sound; |
||
34 | |||
35 | /** |
||
36 | * Indicates the badge on the client app home icon. (iOS) |
||
37 | * |
||
38 | * @var null|string |
||
39 | */ |
||
40 | protected $badge; |
||
41 | |||
42 | /** |
||
43 | * Indicates notification icon. (Android) |
||
44 | * |
||
45 | * @var null|string |
||
46 | */ |
||
47 | protected $icon; |
||
48 | |||
49 | /** |
||
50 | * Indicates whether each notification results in a new entry in the |
||
51 | * notification drawer on Android. (Android) |
||
52 | * |
||
53 | * @var null|string |
||
54 | */ |
||
55 | protected $tag; |
||
56 | |||
57 | /** |
||
58 | * Indicates color of the icon, expressed in #rrggbb format. (Android) |
||
59 | * |
||
60 | * @var null|string |
||
61 | */ |
||
62 | protected $color; |
||
63 | |||
64 | /** |
||
65 | * Indicates the action associated with a user click on the notification. |
||
66 | * |
||
67 | * @var null|string |
||
68 | */ |
||
69 | protected $clickAction; |
||
70 | |||
71 | /** |
||
72 | * Indicates the key to the body string for localization. |
||
73 | * |
||
74 | * @var null|string |
||
75 | */ |
||
76 | protected $bodyLocKey; |
||
77 | |||
78 | /** |
||
79 | * Indicates the string value to replace format specifiers in the |
||
80 | * body string for localization. |
||
81 | * |
||
82 | * @var null|string |
||
83 | */ |
||
84 | protected $bodyLocArgs; |
||
85 | |||
86 | /** |
||
87 | * Indicates the key to the title string for localization. |
||
88 | * |
||
89 | * @var null|string |
||
90 | */ |
||
91 | protected $titleLocKey; |
||
92 | |||
93 | /** |
||
94 | * Indicates the string value to replace format specifiers in |
||
95 | * the title string for localization. |
||
96 | * |
||
97 | * @var null|string |
||
98 | */ |
||
99 | protected $titleLocArgs; |
||
100 | |||
101 | /** |
||
102 | * Notification constructor. |
||
103 | * |
||
104 | * @param array|\ker0x\Push\Adapter\Fcm\Message\NotificationBuilder $notificationBuilder The notification we want to send |
||
105 | */ |
||
106 | public function __construct($notificationBuilder) |
||
125 | |||
126 | /** |
||
127 | * Return notification as an array. |
||
128 | * |
||
129 | * @return array |
||
130 | */ |
||
131 | public function build() |
||
150 | |||
151 | /** |
||
152 | * Build notification from an array |
||
153 | * |
||
154 | * @param array $notificationArray Array of keys for the notification. |
||
155 | * @return \ker0x\Push\Adapter\Fcm\Message\NotificationBuilder |
||
156 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidNotificationException |
||
157 | */ |
||
158 | private function fromArray(array $notificationArray) |
||
178 | } |
||
179 |