| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function send($notifiable, Notification $notification) |
||
| 30 | { |
||
| 31 | $subscriptions = $notifiable->routeNotificationFor('WebPush'); |
||
| 32 | |||
| 33 | if ($subscriptions->isEmpty()) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | $payload = json_encode($notification->toWebPush($notifiable, $notification)->toArray()); |
||
| 38 | |||
| 39 | $subscriptions->each(function ($sub) use ($payload) { |
||
| 40 | $this->webPush->sendNotification( |
||
| 41 | $sub->endpoint, |
||
| 42 | $payload, |
||
| 43 | $sub->public_key, |
||
| 44 | $sub->auth_token |
||
| 45 | ); |
||
| 46 | }); |
||
| 47 | |||
| 48 | $response = $this->webPush->flush(); |
||
| 49 | |||
| 50 | //$this->deleteInvalidSubscriptions($response, $subscriptions); |
||
| 51 | } |
||
| 52 | |||
| 71 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.