15
15
use phpbb \controller \helper ;
16
16
use phpbb \db \driver \driver_interface ;
17
17
use phpbb \log \log_interface ;
18
- use phpbb \notification \method \messenger_base ;
18
+ use phpbb \notification \method \base ;
19
19
use phpbb \notification \type \type_interface ;
20
20
use phpbb \path_helper ;
21
21
use phpbb \user ;
27
27
* Web Push notification method class
28
28
* This class handles sending push messages for notifications
29
29
*/
30
- class webpush extends messenger_base implements extended_method_interface
30
+ class webpush extends base implements extended_method_interface
31
31
{
32
32
/** @var config */
33
33
protected $ config ;
@@ -38,12 +38,21 @@ class webpush extends messenger_base implements extended_method_interface
38
38
/** @var log_interface */
39
39
protected $ log ;
40
40
41
+ /** @var user_loader */
42
+ protected $ user_loader ;
43
+
41
44
/** @var user */
42
45
protected $ user ;
43
46
44
47
/** @var path_helper */
45
48
protected $ path_helper ;
46
49
50
+ /** @var string */
51
+ protected $ phpbb_root_path ;
52
+
53
+ /** @var string */
54
+ protected $ php_ext ;
55
+
47
56
/** @var string Notification Web Push table */
48
57
protected $ notification_webpush_table ;
49
58
@@ -73,13 +82,14 @@ class webpush extends messenger_base implements extended_method_interface
73
82
public function __construct (config $ config , driver_interface $ db , log_interface $ log , user_loader $ user_loader , user $ user , path_helper $ path_helper ,
74
83
string $ phpbb_root_path , string $ php_ext , string $ notification_webpush_table , string $ push_subscriptions_table )
75
84
{
76
- parent ::__construct ($ user_loader , $ phpbb_root_path , $ php_ext );
77
-
78
85
$ this ->config = $ config ;
79
86
$ this ->db = $ db ;
80
87
$ this ->log = $ log ;
88
+ $ this ->user_loader = $ user_loader ;
81
89
$ this ->user = $ user ;
82
90
$ this ->path_helper = $ path_helper ;
91
+ $ this ->phpbb_root_path = $ phpbb_root_path ;
92
+ $ this ->php_ext = $ php_ext ;
83
93
$ this ->notification_webpush_table = $ notification_webpush_table ;
84
94
$ this ->push_subscriptions_table = $ push_subscriptions_table ;
85
95
}
@@ -97,8 +107,9 @@ public function get_type(): string
97
107
*/
98
108
public function is_available (type_interface $ notification_type = null ): bool
99
109
{
100
- return parent ::is_available ($ notification_type ) && $ this ->config ['wpn_webpush_enable ' ]
101
- && !empty ($ this ->config ['wpn_webpush_vapid_public ' ]) && !empty ($ this ->config ['wpn_webpush_vapid_private ' ]);
110
+ return $ this ->config ->offsetGet ('wpn_webpush_enable ' )
111
+ && $ this ->config ->offsetGet ('wpn_webpush_vapid_public ' )
112
+ && $ this ->config ->offsetGet ('wpn_webpush_vapid_private ' );
102
113
}
103
114
104
115
/**
0 commit comments