11<?php
22
3+ declare (strict_types=1 );
4+
35namespace NotificationChannels \PusherPushNotifications ;
46
57use Illuminate \Contracts \Events \Dispatcher ;
1214
1315class PusherChannel
1416{
15- /**
16- * @var string
17- */
18- const INTERESTS = 'interests ' ;
17+ public const INTERESTS = 'interests ' ;
1918
20- /**
21- * @var PushNotifications
22- */
23- protected $ beamsClient ;
19+ protected PushNotifications $ beamsClient ;
2420
25- /**
26- * @var \Illuminate\Contracts\Events\Dispatcher
27- */
28- private $ events ;
21+ private Dispatcher $ events ;
2922
30- /**
31- * @param PushNotifications $beamsClient
32- * @param Dispatcher $events
33- */
3423 public function __construct (PushNotifications $ beamsClient , Dispatcher $ events )
3524 {
3625 $ this ->beamsClient = $ beamsClient ;
@@ -40,17 +29,16 @@ public function __construct(PushNotifications $beamsClient, Dispatcher $events)
4029 /**
4130 * Send the given notification.
4231 *
43- * @param mixed $notifiable
44- * @param \Illuminate\Notifications\Notification $notification
45- *
32+ * @param mixed $notifiable
33+ * @param Notification $notification
4634 * @return void
4735 */
48- public function send ($ notifiable , Notification $ notification )
36+ public function send ($ notifiable , Notification $ notification ): void
4937 {
5038 $ type = $ notifiable ->pushNotificationType ?? self ::INTERESTS ;
5139
5240 $ data = $ notifiable ->routeNotificationFor ('PusherPushNotifications ' )
53- ?: $ this -> defaultName ($ notifiable );
41+ ?: self :: defaultName ($ notifiable );
5442
5543 try {
5644 $ notificationType = sprintf ('publishTo%s ' , Str::ucfirst ($ type ));
@@ -69,11 +57,10 @@ public function send($notifiable, Notification $notification)
6957 /**
7058 * Get the default name for the notifiable.
7159 *
72- * @param $notifiable
73- *
60+ * @param mixed $notifiable
7461 * @return string
7562 */
76- protected function defaultName ($ notifiable )
63+ public static function defaultName ($ notifiable ): string
7764 {
7865 $ class = str_replace ('\\' , '. ' , get_class ($ notifiable ));
7966
0 commit comments