You are here

interface SmsParserInterface in SMS Framework 7

Incoming SMS parser.

Hierarchy

Expanded class hierarchy of SmsParserInterface

All classes that implement SmsParserInterface

File

./sms.parser.inc, line 13

View source
interface SmsParserInterface {

  /**
   * Checks access to parser for incoming SMS.
   *
   * Providers usually do this by checking against an allowed (range of) IP
   * addresses. It could also be with a request parameter.
   *
   * Remember when implementing if you use variables that these may not be
   * loaded from the database, and would have to be set in the settings.php
   * file, in the case of a configuration parsing and queuing without
   * bootstrapping the database.
   *
   * @param string $originator
   *   The originator of the SMS. Usually the IP address.
   * @param array $request
   *   $_REQUEST array, or replacement.
   *
   * @return bool|array
   *   TRUE to allow access.
   *   Response array if denied, @see this::response() for format.
   */
  static function checkAccess($originator, $request);

  /**
   * Starts a parser. Load URI information.
   *
   * @param array $request
   *   $_REQUEST array, or replacement.
   */
  public function __construct($request = array());

  /**
   * Sets the request.
   *
   * @param array $request
   *   $_REQUEST array, or replacement.
   */
  public function setRequest($request);

  /**
   * Retrieves SMS sender number.
   *
   * @return string
   *   Number or identifier supplied by SMS provider.
   */
  public function getNumber();

  /**
   * Retrieves SMS message content.
   *
   * @return string
   *   Decoded SMS message body.
   */
  public function getMessage();

  /**
   * Retrieves sms_incoming() options.
   *
   * @return array
   *   Options as defined by sms_incoming().
   */
  public function getOptions();

  /**
   * Retrieves the response if any.
   *
   * Some SMS provider modules offer a HTTP response content. Lacking an
   * HTTP response object this just provides simple options.
   *
   * @return array
   *   Array of header values keyed by header name and body. Example:
   *   @code
   *     array('headers' => array('name' => 'value), 'body' => 'text');
   *   @endcode
   */
  public function getResponse();

  /**
   * Parses the request.
   *
   * @todo Error or return handling. Does it make sense to notify of missing
   *   number, or message?
   */
  public function parseRequest();

}

Members

Namesort descending Modifiers Type Description Overrides
SmsParserInterface::checkAccess static function Checks access to parser for incoming SMS. 1
SmsParserInterface::getMessage public function Retrieves SMS message content. 1
SmsParserInterface::getNumber public function Retrieves SMS sender number. 1
SmsParserInterface::getOptions public function Retrieves sms_incoming() options. 1
SmsParserInterface::getResponse public function Retrieves the response if any. 1
SmsParserInterface::parseRequest public function Parses the request. 1
SmsParserInterface::setRequest public function Sets the request. 1
SmsParserInterface::__construct public function Starts a parser. Load URI information. 1