@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | public $scheduled = ''; |
26 | 26 | |
27 | 27 | /** @var array */ |
28 | - public $payload = []; |
|
28 | + public $payload = [ ]; |
|
29 | 29 | |
30 | 30 | /** @var array */ |
31 | - public $iosData = []; |
|
31 | + public $iosData = [ ]; |
|
32 | 32 | |
33 | 33 | /** @var array */ |
34 | - public $androidData = []; |
|
34 | + public $androidData = [ ]; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @param array $data |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function scheduled($date) |
131 | 131 | { |
132 | - if (! $date instanceof DateTime) { |
|
132 | + if (!$date instanceof DateTime) { |
|
133 | 133 | $date = new DateTime($date); |
134 | 134 | } |
135 | 135 | |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | $key = snake_case(substr($method, 3)); |
153 | 153 | |
154 | 154 | if (in_array($key, $this->allowediOSOptions())) { |
155 | - $this->iosData[$key] = $args[0]; |
|
155 | + $this->iosData[ $key ] = $args[ 0 ]; |
|
156 | 156 | } |
157 | 157 | } elseif (substr($method, 0, 7) == 'android') { |
158 | 158 | $key = snake_case(substr($method, 7)); |
159 | 159 | |
160 | 160 | if (in_array($key, $this->allowedAndroidOptions())) { |
161 | - $this->androidData[$key] = $args[0]; |
|
161 | + $this->androidData[ $key ] = $args[ 0 ]; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -229,28 +229,28 @@ discard block |
||
229 | 229 | ], |
230 | 230 | ]; |
231 | 231 | |
232 | - if (! empty($this->scheduled)) { |
|
233 | - $data['scheduled'] = $this->scheduled; |
|
232 | + if (!empty($this->scheduled)) { |
|
233 | + $data[ 'scheduled' ] = $this->scheduled; |
|
234 | 234 | } |
235 | 235 | |
236 | - if (! empty($this->title)) { |
|
237 | - $data['notification']['title'] = $this->title; |
|
236 | + if (!empty($this->title)) { |
|
237 | + $data[ 'notification' ][ 'title' ] = $this->title; |
|
238 | 238 | } |
239 | 239 | |
240 | - if (! empty($this->sound)) { |
|
241 | - $data['notification']['sound'] = $this->sound; |
|
240 | + if (!empty($this->sound)) { |
|
241 | + $data[ 'notification' ][ 'sound' ] = $this->sound; |
|
242 | 242 | } |
243 | 243 | |
244 | - if (! empty($this->iosData)) { |
|
245 | - $data['notification']['ios'] = $this->iosData; |
|
244 | + if (!empty($this->iosData)) { |
|
245 | + $data[ 'notification' ][ 'ios' ] = $this->iosData; |
|
246 | 246 | } |
247 | 247 | |
248 | - if (! empty($this->androidData)) { |
|
249 | - $data['notification']['android'] = $this->androidData; |
|
248 | + if (!empty($this->androidData)) { |
|
249 | + $data[ 'notification' ][ 'android' ] = $this->androidData; |
|
250 | 250 | } |
251 | 251 | |
252 | - if (! empty($this->payload)) { |
|
253 | - $data['notification']['payload'] = $this->payload; |
|
252 | + if (!empty($this->payload)) { |
|
253 | + $data[ 'notification' ][ 'payload' ] = $this->payload; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $data; |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | public $androidData = []; |
35 | 35 | |
36 | 36 | /** |
37 | - * @param array $data |
|
38 | 37 | * |
39 | 38 | * @return static |
40 | 39 | */ |
@@ -54,7 +53,6 @@ discard block |
||
54 | 53 | /** |
55 | 54 | * Set the method of targeting users - tokens (default), user_ids, or emails. |
56 | 55 | * |
57 | - * @param string $profile |
|
58 | 56 | * |
59 | 57 | * @return $this |
60 | 58 | */ |
@@ -144,7 +142,7 @@ discard block |
||
144 | 142 | * @param string $method |
145 | 143 | * @param array $args |
146 | 144 | * |
147 | - * @return object |
|
145 | + * @return IonicPushMessage |
|
148 | 146 | */ |
149 | 147 | public function __call($method, $args) |
150 | 148 | { |
@@ -178,7 +176,7 @@ discard block |
||
178 | 176 | /** |
179 | 177 | * List of allowed Android options. |
180 | 178 | * |
181 | - * @return array |
|
179 | + * @return string[] |
|
182 | 180 | */ |
183 | 181 | public function allowedAndroidOptions() |
184 | 182 | { |
@@ -201,7 +199,7 @@ discard block |
||
201 | 199 | /** |
202 | 200 | * List of allowed iOS options. |
203 | 201 | * |
204 | - * @return array |
|
202 | + * @return string[] |
|
205 | 203 | */ |
206 | 204 | public function allowediOSOptions() |
207 | 205 | { |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | use GuzzleHttp\Client; |
6 | 6 | use Illuminate\Notifications\Notification; |
7 | -use NotificationChannels\IonicPushNotifications\Exceptions\InvalidConfiguration; |
|
8 | 7 | use NotificationChannels\IonicPushNotifications\Exceptions\CouldNotSendNotification; |
8 | +use NotificationChannels\IonicPushNotifications\Exceptions\InvalidConfiguration; |
|
9 | 9 | |
10 | 10 | class IonicPushChannel |
11 | 11 | { |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | { |
36 | 36 | $routing = collect($notifiable->routeNotificationFor('IonicPush')); |
37 | 37 | // remove empty device tokens |
38 | - $routing->filter(function ($token) { |
|
39 | - return ! empty($token); |
|
38 | + $routing->filter(function($token) { |
|
39 | + return !empty($token); |
|
40 | 40 | }); |
41 | 41 | // if there are no valid device tokens then do not send the notification |
42 | - if (! $routing->count() > 0) { |
|
42 | + if (!$routing->count() > 0) { |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $message = $notification->toIonicPush($notifiable); |
53 | 53 | |
54 | 54 | $ionicPushData = array_merge( |
55 | - [$message->getSendToType() => $routing->all()], |
|
55 | + [ $message->getSendToType() => $routing->all() ], |
|
56 | 56 | $message->toArray() |
57 | 57 | ); |
58 | 58 |