These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace NotificationChannels\PusherPushNotifications; |
||
4 | |||
5 | use Illuminate\Notifications\Events\NotificationFailed; |
||
6 | use Illuminate\Notifications\Notification; |
||
7 | use Pusher; |
||
8 | |||
9 | class PusherChannel |
||
10 | { |
||
11 | /** @var Pusher */ |
||
12 | protected $pusher; |
||
13 | |||
14 | /** |
||
15 | * @param \Pusher $pusher |
||
16 | */ |
||
17 | 1 | public function __construct(Pusher $pusher) |
|
18 | { |
||
19 | 1 | $this->pusher = $pusher; |
|
20 | 1 | } |
|
21 | |||
22 | /** |
||
23 | * Send the given notification. |
||
24 | * |
||
25 | * @param mixed $notifiable |
||
26 | * @param \Illuminate\Notifications\Notification $notification |
||
27 | * |
||
28 | * @return void |
||
29 | * @throws \NotificationChannels\PusherPushNotifications\Exceptions\CouldNotSendNotification |
||
30 | */ |
||
31 | 1 | public function send($notifiable, Notification $notification) |
|
32 | { |
||
33 | 1 | $interest = $notifiable->routeNotificationFor('PusherPushNotifications') |
|
34 | 1 | ?: $this->interestName($notifiable); |
|
35 | |||
36 | 1 | $response = $this->pusher->notify( |
|
37 | 1 | $interest, |
|
38 | 1 | $notification->toPushNotification($notifiable)->toArray(), |
|
39 | true |
||
40 | 1 | ); |
|
41 | |||
42 | 1 | if (! in_array($response['status'], [200, 202])) { |
|
43 | event(new NotificationFailed($notifiable, $notification, $response)); |
||
0 ignored issues
–
show
|
|||
44 | } |
||
45 | 1 | } |
|
46 | |||
47 | /** |
||
48 | * Get the interest name for the notifiable. |
||
49 | * |
||
50 | * @param $notifiable |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | protected function interestName($notifiable) |
||
55 | { |
||
56 | $class = str_replace('\\', '.', get_class($notifiable)); |
||
57 | |||
58 | return $class.'.'.$notifiable->getKey(); |
||
59 | } |
||
60 | } |
||
61 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: