| 1 | <?php |
||
| 10 | class PusherChannel |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var \Pusher |
||
| 14 | */ |
||
| 15 | protected $pusher; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var \Illuminate\Events\Dispatcher |
||
| 19 | */ |
||
| 20 | private $events; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param \Pusher $pusher |
||
| 24 | */ |
||
| 25 | public function __construct(Pusher $pusher, Dispatcher $events) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Send the given notification. |
||
| 33 | * |
||
| 34 | * @param mixed $notifiable |
||
| 35 | * @param \Illuminate\Notifications\Notification $notification |
||
| 36 | * |
||
| 37 | * @return void |
||
| 38 | */ |
||
| 39 | public function send($notifiable, Notification $notification) |
||
| 40 | { |
||
| 41 | $interest = $notifiable->routeNotificationFor('PusherPushNotifications') |
||
| 42 | ?: $this->interestName($notifiable); |
||
| 43 | |||
| 44 | $response = $this->pusher->notify( |
||
| 45 | $interest, |
||
| 46 | $notification->toPushNotification($notifiable)->toArray(), |
||
|
|
|||
| 47 | true |
||
| 48 | ); |
||
| 49 | |||
| 50 | if (! in_array($response['status'], [200, 202])) { |
||
| 51 | $this->events->fire( |
||
| 52 | new NotificationFailed($notifiable, $notification, 'pusher-push-notifications', $response) |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get the interest name for the notifiable. |
||
| 59 | * |
||
| 60 | * @param $notifiable |
||
| 61 | * |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | protected function interestName($notifiable) |
||
| 70 | } |
||
| 71 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.