You are here

interface SmsProviderInterface in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Provider/SmsProviderInterface.php \Drupal\sms\Provider\SmsProviderInterface
  2. 2.1.x src/Provider/SmsProviderInterface.php \Drupal\sms\Provider\SmsProviderInterface

Provides an interface for sending messages.

Hierarchy

Expanded class hierarchy of SmsProviderInterface

All classes that implement SmsProviderInterface

6 files declare their use of SmsProviderInterface
AccountRegistration.php in modules/sms_user/src/AccountRegistration.php
DeliveryReportController.php in src/DeliveryReportController.php
SendToPhoneForm.php in modules/sms_sendtophone/src/Form/SendToPhoneForm.php
SmsDevelMessageForm.php in modules/sms_devel/src/Form/SmsDevelMessageForm.php
SmsIncomingController.php in src/SmsIncomingController.php

... See full list

File

src/Provider/SmsProviderInterface.php, line 12

Namespace

Drupal\sms\Provider
View source
interface SmsProviderInterface {

  /**
   * Queue a SMS message for sending or receiving.
   *
   * @param \Drupal\sms\Message\SmsMessageInterface $sms_message
   *   A SMS message.
   *
   * @return \Drupal\sms\Entity\SmsMessageInterface[]
   *   The queued messages. A single message may be transformed into many.
   *
   * @throws \Drupal\sms\Exception\SmsDirectionException
   *   Thrown if no direction is set for the message.
   * @throws \Drupal\sms\Exception\RecipientRouteException
   *   Thrown if no gateway could be determined for the message.
   */
  public function queue(SmsMessageInterface $sms_message);

  /**
   * Sends an SMS using the active gateway.
   *
   * It is preferred to use queue method over directly invoking send().
   *
   * @param \Drupal\sms\Message\SmsMessageInterface $sms
   *   The message to be sent.
   *
   * @return \Drupal\sms\Message\SmsMessageInterface[]
   *   The messages sent in this sending operation. The message sent can be
   *   transformed into multiple messages depending on gateway and event
   *   subscribers. Therefore this function can return multiple messages.
   *
   * @throws \Drupal\sms\Exception\RecipientRouteException
   *   Thrown if no gateway could be determined for the message.
   */
  public function send(SmsMessageInterface $sms);

  /**
   * Handles a message sent from the gateway to the site.
   *
   * @param \Drupal\sms\Message\SmsMessageInterface $sms_message
   *   The incoming message to process.
   *
   * @return \Drupal\sms\Message\SmsMessageInterface[]
   *   The messages received in an incoming operation.
   */
  public function incoming(SmsMessageInterface $sms_message);

  /**
   * Handles delivery reports pushed to the site.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The HTTP request that contains the delivery report.
   * @param \Drupal\sms\Entity\SmsGatewayInterface $gateway
   *   The gateway designated to process the delivery report.
   */
  public function processDeliveryReport(Request $request, SmsGatewayInterface $gateway);

}

Members

Namesort descending Modifiers Type Description Overrides
SmsProviderInterface::incoming public function Handles a message sent from the gateway to the site. 1
SmsProviderInterface::processDeliveryReport public function Handles delivery reports pushed to the site. 1
SmsProviderInterface::queue public function Queue a SMS message for sending or receiving. 1
SmsProviderInterface::send public function Sends an SMS using the active gateway. 1