class DeliveryCandidate in Message Subscribe 8
A delivery candidate implementation.
Hierarchy
- class \Drupal\message_subscribe\Subscribers\DeliveryCandidate implements DeliveryCandidateInterface
Expanded class hierarchy of DeliveryCandidate
10 files declare their use of DeliveryCandidate
- DeliveryCandidateTest.php in tests/
src/ Unit/ Subscribers/ DeliveryCandidateTest.php - fixture_foo.module.php in tests/
src/ fixture_foo.module.php - Test hook implementation fixture.
- MessageSubscribeEmailNotificationsTest.php in message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailNotificationsTest.php - MessageSubscribeEmailSubscribersTest.php in message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailSubscribersTest.php - message_subscribe.api.php in ./
message_subscribe.api.php - Hooks provided by the Message subscribe module.
File
- src/
Subscribers/ DeliveryCandidate.php, line 8
Namespace
Drupal\message_subscribe\SubscribersView source
class DeliveryCandidate implements DeliveryCandidateInterface {
/**
* An array of flag IDs that triggered the notification.
*
* @var string[]
*/
protected $flags = [];
/**
* An array of notifier IDs for delivery.
*
* @var string[]
*/
protected $notifiers = [];
/**
* The delivery candidate account ID.
*
* @var int
*/
protected $uid;
/**
* Constructs the delivery candidate.
*
* @param string[] $flags
* An array of flag IDs.
* @param string[] $notifiers
* An array of notifier IDs.
* @param int $uid
* The delivery candidate account ID.
*/
public function __construct(array $flags, array $notifiers, $uid) {
$this->flags = array_combine($flags, $flags);
$this->notifiers = array_combine($notifiers, $notifiers);
$this->uid = $uid;
}
/**
* {@inheritdoc}
*/
public function addFlag($flag_id) {
$this->flags[$flag_id] = $flag_id;
return $this;
}
/**
* {@inheritdoc}
*/
public function removeFlag($flag_id) {
unset($this->flags[$flag_id]);
return $this;
}
/**
* {@inheritdoc}
*/
public function addNotifier($notifier_id) {
$this->notifiers[$notifier_id] = $notifier_id;
return $this;
}
/**
* {@inheritdoc}
*/
public function removeNotifier($notifier_id) {
unset($this->notifiers[$notifier_id]);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFlags() {
return array_unique($this->flags);
}
/**
* {@inheritdoc}
*/
public function setFlags(array $flag_ids) {
$this->flags = array_combine($flag_ids, $flag_ids);
return $this;
}
/**
* {@inheritdoc}
*/
public function getNotifiers() {
return array_unique($this->notifiers);
}
/**
* {@inheritdoc}
*/
public function setNotifiers(array $notifier_ids) {
$this->notifiers = array_combine($notifier_ids, $notifier_ids);
return $this;
}
/**
* {@inheritdoc}
*/
public function getAccountId() {
return $this->uid;
}
/**
* {@inheritdoc}
*/
public function setAccountId($uid) {
$this->uid = $uid;
return $this;
}
}