From 2850c1b38c65718f57328ab9bcbaf8acc994cc01 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 5 May 2015 14:29:57 +0930 Subject: [PATCH] Make NotificationSender compatibleWith method static --- src/Core/Notifications/Notifier.php | 2 +- src/Core/Notifications/Senders/NotificationAlerter.php | 2 +- src/Core/Notifications/Senders/NotificationEmailer.php | 2 +- src/Core/Notifications/Senders/NotificationSender.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Core/Notifications/Notifier.php b/src/Core/Notifications/Notifier.php index c0cc0dbd3..abcf207ea 100644 --- a/src/Core/Notifications/Notifier.php +++ b/src/Core/Notifications/Notifier.php @@ -22,7 +22,7 @@ class Notifier { foreach ($this->methods as $method => $sender) { $sender = $this->container->make($sender); - if ($notification->getRecipient()->shouldNotify($notification::getType(), $method) && $sender->compatibleWith($notification)) { + if ($notification->getRecipient()->shouldNotify($notification::getType(), $method) && $sender::compatibleWith($notification)) { $sender->send($notification); } } diff --git a/src/Core/Notifications/Senders/NotificationAlerter.php b/src/Core/Notifications/Senders/NotificationAlerter.php index 580950570..5cecf714e 100644 --- a/src/Core/Notifications/Senders/NotificationAlerter.php +++ b/src/Core/Notifications/Senders/NotificationAlerter.php @@ -18,7 +18,7 @@ class NotificationAlerter implements NotificationSender $model->save(); } - public function compatibleWith($className) + public static function compatibleWith($className) { return (new ReflectionClass($className))->implementsInterface('Flarum\Core\Notifications\Types\AlertableNotification'); } diff --git a/src/Core/Notifications/Senders/NotificationEmailer.php b/src/Core/Notifications/Senders/NotificationEmailer.php index 2ef68693a..ff24467ab 100644 --- a/src/Core/Notifications/Senders/NotificationEmailer.php +++ b/src/Core/Notifications/Senders/NotificationEmailer.php @@ -22,7 +22,7 @@ class NotificationEmailer implements NotificationSender }); } - public function compatibleWith($class) + public static function compatibleWith($class) { return (new ReflectionClass($class))->implementsInterface('Flarum\Core\Notifications\Types\EmailableNotification'); } diff --git a/src/Core/Notifications/Senders/NotificationSender.php b/src/Core/Notifications/Senders/NotificationSender.php index 892af9d9e..7b36faba0 100644 --- a/src/Core/Notifications/Senders/NotificationSender.php +++ b/src/Core/Notifications/Senders/NotificationSender.php @@ -6,5 +6,5 @@ interface NotificationSender { public function send(Notification $notification); - public function compatibleWith($class); + public static function compatibleWith($class); }