DeliveryCandidate.php in Message Subscribe 8
File
src/Subscribers/DeliveryCandidate.php
View source
<?php
namespace Drupal\message_subscribe\Subscribers;
class DeliveryCandidate implements DeliveryCandidateInterface {
protected $flags = [];
protected $notifiers = [];
protected $uid;
public function __construct(array $flags, array $notifiers, $uid) {
$this->flags = array_combine($flags, $flags);
$this->notifiers = array_combine($notifiers, $notifiers);
$this->uid = $uid;
}
public function addFlag($flag_id) {
$this->flags[$flag_id] = $flag_id;
return $this;
}
public function removeFlag($flag_id) {
unset($this->flags[$flag_id]);
return $this;
}
public function addNotifier($notifier_id) {
$this->notifiers[$notifier_id] = $notifier_id;
return $this;
}
public function removeNotifier($notifier_id) {
unset($this->notifiers[$notifier_id]);
return $this;
}
public function getFlags() {
return array_unique($this->flags);
}
public function setFlags(array $flag_ids) {
$this->flags = array_combine($flag_ids, $flag_ids);
return $this;
}
public function getNotifiers() {
return array_unique($this->notifiers);
}
public function setNotifiers(array $notifier_ids) {
$this->notifiers = array_combine($notifier_ids, $notifier_ids);
return $this;
}
public function getAccountId() {
return $this->uid;
}
public function setAccountId($uid) {
$this->uid = $uid;
return $this;
}
}