1 | <?php |
||
7 | class OneSignalMessage |
||
8 | { |
||
9 | /** @var string */ |
||
10 | protected $body; |
||
11 | |||
12 | /** @var string */ |
||
13 | protected $subject; |
||
14 | |||
15 | /** @var string */ |
||
16 | protected $url; |
||
17 | |||
18 | /** @var string */ |
||
19 | protected $icon; |
||
20 | |||
21 | /** @var array */ |
||
22 | protected $data = []; |
||
23 | |||
24 | /** @var array */ |
||
25 | protected $buttons = []; |
||
26 | |||
27 | /** @var array */ |
||
28 | protected $webButtons = []; |
||
29 | |||
30 | /** |
||
31 | * @param string $body |
||
32 | * |
||
33 | * @return static |
||
34 | */ |
||
35 | public static function create($body = '') |
||
39 | |||
40 | /** |
||
41 | * @param string $body |
||
42 | */ |
||
43 | public function __construct($body = '') |
||
47 | |||
48 | /** |
||
49 | * Set the message body. |
||
50 | * |
||
51 | * @param string $value |
||
52 | * |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function body($value) |
||
61 | |||
62 | /** |
||
63 | * Set the message icon. |
||
64 | * |
||
65 | * @param string $value |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function icon($value) |
||
75 | |||
76 | /** |
||
77 | * Set the message subject. |
||
78 | * |
||
79 | * @param string $value |
||
80 | * |
||
81 | * @return $this |
||
82 | */ |
||
83 | public function subject($value) |
||
89 | |||
90 | /** |
||
91 | * Set the message url. |
||
92 | * |
||
93 | * @param string $value |
||
94 | * |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function url($value) |
||
103 | |||
104 | /** |
||
105 | * Set additional data. |
||
106 | * |
||
107 | * @param string $key |
||
108 | * @param string $value |
||
109 | * |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function setData($key, $value) |
||
118 | |||
119 | /** |
||
120 | * Add a web button to the message. |
||
121 | * |
||
122 | * @param string $id |
||
123 | * @param string $text |
||
124 | * @param string $icon |
||
125 | * @param string $url |
||
126 | * |
||
127 | * @return $this |
||
128 | */ |
||
129 | public function webButton($id, $text, $icon, $url) |
||
140 | |||
141 | /** |
||
142 | * Add a native button to the message. |
||
143 | * |
||
144 | * @param string $id |
||
145 | * @param string $text |
||
146 | * @param string $icon |
||
147 | * |
||
148 | * @return $this |
||
149 | */ |
||
150 | public function button($id, $text, $icon) |
||
160 | |||
161 | /** |
||
162 | * @return array |
||
163 | */ |
||
164 | public function toArray() |
||
180 | } |
||
181 |