1 | <?php |
||
11 | class PusherChannel |
||
12 | { |
||
13 | /** |
||
14 | * @var PushNotifications |
||
15 | */ |
||
16 | protected $beamsClient; |
||
17 | |||
18 | /** |
||
19 | * @var \Illuminate\Events\Dispatcher |
||
20 | */ |
||
21 | private $events; |
||
22 | |||
23 | /** |
||
24 | * @param Pusher $pusher |
||
|
|||
25 | */ |
||
26 | 2 | public function __construct(PushNotifications $beamsClient, Dispatcher $events) |
|
27 | { |
||
28 | 2 | $this->beamsClient = $beamsClient; |
|
29 | 2 | $this->events = $events; |
|
30 | 2 | } |
|
31 | |||
32 | /** |
||
33 | * Send the given notification. |
||
34 | * |
||
35 | * @param mixed $notifiable |
||
36 | * @param \Illuminate\Notifications\Notification $notification |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | 2 | public function send($notifiable, Notification $notification) |
|
41 | { |
||
42 | 2 | $interest = $notifiable->routeNotificationFor('PusherPushNotifications') |
|
43 | 2 | ?: $this->interestName($notifiable); |
|
44 | |||
45 | try { |
||
46 | 2 | $this->beamsClient->publishToInterests( |
|
47 | 2 | is_array($interest) ? $interest : [$interest], |
|
48 | 2 | $notification->toPushNotification($notifiable)->toArray() |
|
49 | ); |
||
50 | 1 | } catch (Throwable $exception) { |
|
51 | 1 | $this->events->dispatch( |
|
52 | 1 | new NotificationFailed($notifiable, $notification, 'pusher-push-notifications') |
|
53 | ); |
||
54 | } |
||
55 | 2 | } |
|
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 PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.