1 | <?php |
||
20 | class NotificationListener |
||
21 | { |
||
22 | /** |
||
23 | * Notifications service. |
||
24 | * |
||
25 | * @var NotificationsService |
||
26 | */ |
||
27 | protected $notificationsService; |
||
28 | |||
29 | public function __construct(NotificationsService $notificationsService) |
||
30 | { |
||
31 | $this->notificationsService = $notificationsService; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Sends confirmation email to user. |
||
36 | * |
||
37 | * @param GenericEvent $event |
||
38 | */ |
||
39 | public function sendUserNotificationEmail(GenericEvent $event) |
||
40 | { |
||
41 | $subscription = $event->getSubject(); |
||
42 | $this->sendValidatedNotification(Emails::USER_CONFIRMATION, $subscription); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Sends confirmation email with informations |
||
47 | * about created subscription for user, by admin |
||
48 | * in backend. |
||
49 | * |
||
50 | * @param GenericEvent $event |
||
51 | */ |
||
52 | public function sendAdminCreatedNotification(GenericEvent $event) |
||
53 | { |
||
54 | $subscription = $event->getSubject(); |
||
55 | $this->sendValidatedNotification(Emails::ADMIN_CREATED_CONFIRMATION, $subscription); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Sends notification email to admin. |
||
60 | * |
||
61 | * @param GenericEvent $event |
||
62 | */ |
||
63 | public function sendAdminNotificationEmail(GenericEvent $event) |
||
77 | |||
78 | /** |
||
79 | * Sends confirmation email to user when subscription |
||
80 | * status is changed in paywall admin panel. |
||
81 | * |
||
82 | * @param GenericEvent $event |
||
83 | */ |
||
84 | public function sendUserSubscriptionStatusChangeEmail(GenericEvent $event) |
||
89 | |||
90 | /** |
||
91 | * Sends an emails with the informations about expiring |
||
92 | * subscription. |
||
93 | * |
||
94 | * @param GenericEvent $event |
||
95 | */ |
||
96 | public function sendSubscriptionExpirationEmail(GenericEvent $event) |
||
106 | |||
107 | private function sendValidatedNotification($code, $subscription) |
||
120 | |||
121 | private function isValid($subscriptions) |
||
131 | |||
132 | private function isSupported($subscription) |
||
141 | |||
142 | private function getUser($subscription) |
||
153 | } |
||
154 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.