1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace NotificationChannels \PusherPushNotifications ;
4
6
5
7
use Illuminate \Contracts \Events \Dispatcher ;
12
14
13
15
class PusherChannel
14
16
{
15
- /**
16
- * @var string
17
- */
18
- const INTERESTS = 'interests ' ;
17
+ public const INTERESTS = 'interests ' ;
19
18
20
- /**
21
- * @var PushNotifications
22
- */
23
- protected $ beamsClient ;
19
+ protected PushNotifications $ beamsClient ;
24
20
25
- /**
26
- * @var \Illuminate\Contracts\Events\Dispatcher
27
- */
28
- private $ events ;
21
+ private Dispatcher $ events ;
29
22
30
- /**
31
- * @param PushNotifications $beamsClient
32
- * @param Dispatcher $events
33
- */
34
23
public function __construct (PushNotifications $ beamsClient , Dispatcher $ events )
35
24
{
36
25
$ this ->beamsClient = $ beamsClient ;
@@ -40,17 +29,16 @@ public function __construct(PushNotifications $beamsClient, Dispatcher $events)
40
29
/**
41
30
* Send the given notification.
42
31
*
43
- * @param mixed $notifiable
44
- * @param \Illuminate\Notifications\Notification $notification
45
- *
32
+ * @param mixed $notifiable
33
+ * @param Notification $notification
46
34
* @return void
47
35
*/
48
- public function send ($ notifiable , Notification $ notification )
36
+ public function send ($ notifiable , Notification $ notification ): void
49
37
{
50
38
$ type = $ notifiable ->pushNotificationType ?? self ::INTERESTS ;
51
39
52
40
$ data = $ notifiable ->routeNotificationFor ('PusherPushNotifications ' )
53
- ?: $ this -> defaultName ($ notifiable );
41
+ ?: self :: defaultName ($ notifiable );
54
42
55
43
try {
56
44
$ notificationType = sprintf ('publishTo%s ' , Str::ucfirst ($ type ));
@@ -69,11 +57,10 @@ public function send($notifiable, Notification $notification)
69
57
/**
70
58
* Get the default name for the notifiable.
71
59
*
72
- * @param $notifiable
73
- *
60
+ * @param mixed $notifiable
74
61
* @return string
75
62
*/
76
- protected function defaultName ($ notifiable )
63
+ public static function defaultName ($ notifiable ): string
77
64
{
78
65
$ class = str_replace ('\\' , '. ' , get_class ($ notifiable ));
79
66
0 commit comments