You are here

public function SmsMessageProcessor::ensureReportsPreprocess in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/EventSubscriber/SmsMessageProcessor.php \Drupal\sms\EventSubscriber\SmsMessageProcessor::ensureReportsPreprocess()
  2. 2.1.x src/EventSubscriber/SmsMessageProcessor.php \Drupal\sms\EventSubscriber\SmsMessageProcessor::ensureReportsPreprocess()

Ensures there is a result, and reports for each recipient.

Parameters

\Drupal\sms\Event\SmsMessageEvent $event: An SMS message process event.

File

src/EventSubscriber/SmsMessageProcessor.php, line 85

Class

SmsMessageProcessor
Handles messages before they are processed by queue(), send(), or incoming().

Namespace

Drupal\sms\EventSubscriber

Code

public function ensureReportsPreprocess(SmsMessageEvent $event) {
  $sms_messages = $event
    ->getMessages();
  foreach ($sms_messages as $sms_message) {

    // Event can be for any direction. Capture incoming only for preprocess.
    if ($sms_message
      ->getDirection() == Direction::INCOMING) {
      $this
        ->ensureReports($sms_message);
    }
  }
}