mirror of
https://github.com/flarum/framework.git
synced 2025-02-23 00:09:56 +08:00
Make NotificationSender compatibleWith method static
This commit is contained in:
parent
3b9d40289c
commit
3bd267c1b6
@ -22,7 +22,7 @@ class Notifier
|
|||||||
{
|
{
|
||||||
foreach ($this->methods as $method => $sender) {
|
foreach ($this->methods as $method => $sender) {
|
||||||
$sender = $this->container->make($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);
|
$sender->send($notification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class NotificationAlerter implements NotificationSender
|
|||||||
$model->save();
|
$model->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compatibleWith($className)
|
public static function compatibleWith($className)
|
||||||
{
|
{
|
||||||
return (new ReflectionClass($className))->implementsInterface('Flarum\Core\Notifications\Types\AlertableNotification');
|
return (new ReflectionClass($className))->implementsInterface('Flarum\Core\Notifications\Types\AlertableNotification');
|
||||||
}
|
}
|
||||||
|
@ -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');
|
return (new ReflectionClass($class))->implementsInterface('Flarum\Core\Notifications\Types\EmailableNotification');
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,5 @@ interface NotificationSender
|
|||||||
{
|
{
|
||||||
public function send(Notification $notification);
|
public function send(Notification $notification);
|
||||||
|
|
||||||
public function compatibleWith($class);
|
public static function compatibleWith($class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user