class EmailQueue in Search API Saved Searches 8
Provides functionality for sending e-mails at the end of the page request.
Hierarchy
- class \Drupal\search_api_saved_searches\Service\EmailQueue implements DestructableInterface
Expanded class hierarchy of EmailQueue
1 string reference to 'EmailQueue'
1 service uses EmailQueue
File
- src/
Service/ EmailQueue.php, line 11
Namespace
Drupal\search_api_saved_searches\ServiceView source
class EmailQueue implements DestructableInterface {
/**
* The mail manager service.
*
* @var \Drupal\Core\Mail\MailManagerInterface
*/
protected $mail;
/**
* The queued mails, as argument arrays.
*
* @var array[]
*/
protected $mails = [];
/**
* Constructs a new class instance.
*
* @param \Drupal\Core\Mail\MailManagerInterface $mail
* The mail manager service.
*/
public function __construct(MailManagerInterface $mail) {
$this->mail = $mail;
}
/**
* Queues an e-mail to be sent.
*
* @param array $args
* The arguments that should be passed when sending the mail.
*
* @see \Drupal\Core\Mail\MailManagerInterface::mail()
*/
public function queueMail(array $args) {
$this->mails[] = $args;
}
/**
* {@inheritdoc}
*/
public function destruct() {
foreach ($this->mails as $i => $args) {
call_user_func_array([
$this->mail,
'mail',
], $args);
unset($this->mails[$i]);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EmailQueue:: |
protected | property | The mail manager service. | |
EmailQueue:: |
protected | property | The queued mails, as argument arrays. | |
EmailQueue:: |
public | function |
Performs destruct operations. Overrides DestructableInterface:: |
|
EmailQueue:: |
public | function | Queues an e-mail to be sent. | |
EmailQueue:: |
public | function | Constructs a new class instance. |