PHP Class Flarum\Core\Notification\NotificationSyncer

Afficher le fichier Open project: flarum/core Class Usage Examples

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
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.

Method Details

__construct() public méthode

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

delete() public méthode

Delete a notification for all users.
public delete ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : void
$blueprint Flarum\Core\Notification\BlueprintInterface
Résultat void

getAttributes() protected méthode

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
Résultat array

mailNotifications() protected méthode

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() public méthode

Limit notifications to one per user for the entire duration of the given callback.
public onePerUser ( callable $callback ) : void
$callback callable
Résultat void

restore() public méthode

Restore a notification for all users.
public restore ( Flarum\Core\Notification\BlueprintInterface $blueprint ) : void
$blueprint Flarum\Core\Notification\BlueprintInterface
Résultat void

sendNotifications() protected méthode

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() protected méthode

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

sync() public méthode

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
Résultat void

Property Details

$mailer protected_oe property

protected NotificationMailer,Flarum\Core\Notification $mailer
Résultat NotificationMailer

$notifications protected_oe property

protected NotificationRepository,Flarum\Core\Repository $notifications
Résultat Flarum\Core\Repository\NotificationRepository

$onePerUser protected_oe static_oe property

Whether or not notifications are being limited to one per user.
protected static bool $onePerUser
Résultat boolean

$sentTo protected_oe static_oe property

An internal list of user IDs that notifications have been sent to.
protected static int[] $sentTo
Résultat int[]