PHP Класс Flarum\Core\Notification\NotificationSyncer

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$mailer NotificationMailer
$notifications Flarum\Core\Repository\NotificationRepository
$onePerUser boolean Whether or not notifications are being limited to one per user.
$sentTo int[] An internal list of user IDs that notifications have been sent to.

Открытые методы

Метод Описание
__construct ( NotificationRepository $notifications, NotificationMailer $mailer )
delete ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : void Delete a notification for all users.
onePerUser ( callable $callback ) : void Limit notifications to one per user for the entire duration of the given callback.
restore ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : void Restore a notification for all users.
sync ( Flarum\Core\Notification\BlueprintInterface $blueprint, array $users ) : void Sync a notification so that it is visible to the specified users, and not visible to anyone else. If it is being made visible for the first time, attempt to send the user an email.

Защищенные методы

Метод Описание
getAttributes ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : array Construct an array of attributes to be stored in a notification record in the database, given a notification blueprint.
mailNotifications ( Flarum\Core\Notification\MailableInterface $blueprint, array $recipients ) Mail a notification to a list of users.
sendNotifications ( Flarum\Core\Notification\BlueprintInterface $blueprint, array $recipients ) Create a notification record and send an email (depending on user preference) from a blueprint to a list of recipients.
setDeleted ( array $ids, boolean $isDeleted ) Set the deleted status of a list of notification records.

Описание методов

__construct() публичный метод

public __construct ( NotificationRepository $notifications, NotificationMailer $mailer )
$notifications Flarum\Core\Repository\NotificationRepository
$mailer NotificationMailer

delete() публичный метод

Delete a notification for all users.
public delete ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : void
$blueprint Flarum\Core\Notification\BlueprintInterface
Результат void

getAttributes() защищенный метод

Construct an array of attributes to be stored in a notification record in the database, given a notification blueprint.
protected getAttributes ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : array
$blueprint Flarum\Core\Notification\BlueprintInterface
Результат array

mailNotifications() защищенный метод

Mail a notification to a list of users.
protected mailNotifications ( Flarum\Core\Notification\MailableInterface $blueprint, array $recipients )
$blueprint Flarum\Core\Notification\MailableInterface
$recipients array

onePerUser() публичный метод

Limit notifications to one per user for the entire duration of the given callback.
public onePerUser ( callable $callback ) : void
$callback callable
Результат void

restore() публичный метод

Restore a notification for all users.
public restore ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : void
$blueprint Flarum\Core\Notification\BlueprintInterface
Результат void

sendNotifications() защищенный метод

Create a notification record and send an email (depending on user preference) from a blueprint to a list of recipients.
protected sendNotifications ( Flarum\Core\Notification\BlueprintInterface $blueprint, array $recipients )
$blueprint Flarum\Core\Notification\BlueprintInterface
$recipients array

setDeleted() защищенный метод

Set the deleted status of a list of notification records.
protected setDeleted ( array $ids, boolean $isDeleted )
$ids array
$isDeleted boolean

sync() публичный метод

Sync a notification so that it is visible to the specified users, and not visible to anyone else. If it is being made visible for the first time, attempt to send the user an email.
public sync ( Flarum\Core\Notification\BlueprintInterface $blueprint, array $users ) : void
$blueprint Flarum\Core\Notification\BlueprintInterface
$users array
Результат void

Описание свойств

$mailer защищенное свойство

protected NotificationMailer,Flarum\Core\Notification $mailer
Результат NotificationMailer

$notifications защищенное свойство

protected NotificationRepository,Flarum\Core\Repository $notifications
Результат Flarum\Core\Repository\NotificationRepository

$onePerUser защищенное статическое свойство

Whether or not notifications are being limited to one per user.
protected static bool $onePerUser
Результат boolean

$sentTo защищенное статическое свойство

An internal list of user IDs that notifications have been sent to.
protected static int[] $sentTo
Результат int[]