You are here

public static function TestMessage::sendMessages in Courier 8

Same name and namespace in other branches
  1. 2.x tests/modules/courier_test_message/src/Entity/TestMessage.php \Drupal\courier_test_message\Entity\TestMessage::sendMessages()

Sends messages in bulk.

Parameters

\Drupal\courier\ChannelInterface[] $messages: An array of messages.

array $options: Miscellaneous options.

Throws

\Drupal\courier\Exception\ChannelFailure Throw if the message cannot be sent.

Overrides ChannelInterface::sendMessages

1 call to TestMessage::sendMessages()
TestMessage::sendMessage in tests/modules/courier_test_message/src/Entity/TestMessage.php
Sends this message.

File

tests/modules/courier_test_message/src/Entity/TestMessage.php, line 74

Class

TestMessage
Defines storage for a test message.

Namespace

Drupal\courier_test_message\Entity

Code

public static function sendMessages(array $messages, $options = []) {
  $state = \Drupal::state()
    ->get('courier_test_message.messages', []);

  /* @var static[] $messages */
  foreach ($messages as $message) {
    $state[] = $message;
  }
  \Drupal::state()
    ->set('courier_test_message.messages', $state);
}