You are here

class QueuedMessageWrapper in Sparkpost email 8.2

Queued message wrapper class.

Hierarchy

Expanded class hierarchy of QueuedMessageWrapper

1 file declares its use of QueuedMessageWrapper
sparkpost_requeue.module in modules/sparkpost_requeue/sparkpost_requeue.module
Sparkpost requeue module.

File

modules/sparkpost_requeue/src/QueuedMessageWrapper.php, line 12

Namespace

Drupal\sparkpost_requeue
View source
class QueuedMessageWrapper extends MessageWrapper implements MessageWrapperInterface {

  /**
   * The number of tries we have had with this one.
   *
   * @var int
   */
  protected $retryCount = 0;

  /**
   * Last retry timestamp.
   *
   * @var int
   */
  protected $lastRetry = 0;

  /**
   * Client to use.
   *
   * @var \Drupal\sparkpost\ClientServiceInterface
   */
  protected $clientService;

  /**
   * QueuedMessageWrapper constructor.
   */
  public function __construct(ClientServiceInterface $clientService) {
    $this->clientService = $clientService;
    if ($this
      ->getResult()) {
      $this
        ->setResult($this
        ->getResult());
    }
    if ($this
      ->getApiResponseException()) {
      $this
        ->setApiResponseException($this
        ->getApiResponseException());
    }
  }

  /**
   * Get the count of retries.
   *
   * @return int
   *   The number of retries we have had.
   */
  public function getRetryCount() {
    return $this->retryCount;
  }

  /**
   * Increment the retry count.
   */
  public function incrementRetryCount() {
    $this->retryCount++;
  }

  /**
   * Gets the last retry.
   *
   * @return int
   *   The last retry timestamp.
   */
  public function getLastRetry() {
    return $this->lastRetry;
  }

  /**
   * Sets the last retry timestamp.
   *
   * @param int $lastRetry
   *   A timestamp.
   */
  public function setLastRetry($lastRetry) {
    $this->lastRetry = $lastRetry;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
MessageWrapper::$apiResponseException protected property Exception, if any.
MessageWrapper::$drupalMessage protected property The Drupal message.
MessageWrapper::$result protected property Result, if any.
MessageWrapper::$sparkpostMessage protected property The sparkpost message.
MessageWrapper::clearApiResposeException public function Clears the API response exception. Overrides MessageWrapperInterface::clearApiResposeException
MessageWrapper::getApiResponseException public function Gets the last exception thrown. Overrides MessageWrapperInterface::getApiResponseException
MessageWrapper::getClientService public function Gets the client service. Overrides MessageWrapperInterface::getClientService
MessageWrapper::getDrupalMessage public function Gets the Drupal message the sparkpost message was based on. Overrides MessageWrapperInterface::getDrupalMessage
MessageWrapper::getResult public function Gets the last result. Overrides MessageWrapperInterface::getResult
MessageWrapper::getSparkpostMessage public function Gets the sparkpost message to send. Overrides MessageWrapperInterface::getSparkpostMessage
MessageWrapper::sendMessage public function Sends the message. Overrides MessageWrapperInterface::sendMessage
MessageWrapper::setApiResponseException public function Sets the API response exception. Overrides MessageWrapperInterface::setApiResponseException
MessageWrapper::setDrupalMessage public function Sets the Drupal message. Overrides MessageWrapperInterface::setDrupalMessage
MessageWrapper::setResult public function Sets the result from the API call. Overrides MessageWrapperInterface::setResult
MessageWrapper::setSparkpostMessage public function Sets the sparkpost message. Overrides MessageWrapperInterface::setSparkpostMessage
QueuedMessageWrapper::$clientService protected property Client to use. Overrides MessageWrapper::$clientService
QueuedMessageWrapper::$lastRetry protected property Last retry timestamp.
QueuedMessageWrapper::$retryCount protected property The number of tries we have had with this one.
QueuedMessageWrapper::getLastRetry public function Gets the last retry.
QueuedMessageWrapper::getRetryCount public function Get the count of retries.
QueuedMessageWrapper::incrementRetryCount public function Increment the retry count.
QueuedMessageWrapper::setLastRetry public function Sets the last retry timestamp.
QueuedMessageWrapper::__construct public function QueuedMessageWrapper constructor. Overrides MessageWrapper::__construct