Make NotificationSender compatibleWith method static

This commit is contained in:
Toby Zerner 2015-05-05 14:29:57 +09:30
parent 3b9d40289c
commit 3bd267c1b6
4 changed files with 4 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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');
}

View File

@ -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');
}

View File

@ -6,5 +6,5 @@ interface NotificationSender
{
public function send(Notification $notification);
public function compatibleWith($class);
public static function compatibleWith($class);
}