class SmsMessageResult in SMS Framework 2.x
Same name in this branch
- 2.x src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult
- 2.x src/Entity/SmsMessageResult.php \Drupal\sms\Entity\SmsMessageResult
Same name and namespace in other branches
- 8 src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult
- 2.1.x src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult
The result of an SMS messaging transaction.
Hierarchy
- class \Drupal\sms\Message\SmsMessageResult implements SmsMessageResultInterface
Expanded class hierarchy of SmsMessageResult
6 files declare their use of SmsMessageResult
- Incoming.php in tests/
modules/ sms_test_gateway/ src/ Plugin/ SmsGateway/ Incoming.php - Memory.php in tests/
modules/ sms_test_gateway/ src/ Plugin/ SmsGateway/ Memory.php - SmsFrameworkMessageTestTrait.php in tests/
src/ Functional/ SmsFrameworkMessageTestTrait.php - SmsFrameworkProcessorTest.php in tests/
src/ Kernel/ SmsFrameworkProcessorTest.php - SmsFrameworkResultUnitTest.php in tests/
src/ Unit/ Message/ SmsFrameworkResultUnitTest.php
File
- src/
Message/ SmsMessageResult.php, line 12
Namespace
Drupal\sms\MessageView source
class SmsMessageResult implements SmsMessageResultInterface {
/**
* The error of the message, or NULL if unknown.
*
* @var string|null
*/
protected $error = NULL;
/**
* The error message as provided by the gateway API.
*
* @var string
*/
protected $errorMessage = '';
/**
* The message delivery reports.
*
* @var \Drupal\sms\Message\SmsDeliveryReportInterface[]
*/
protected $reports = [];
/**
* The credit balance after this message is sent, or NULL if unknown.
*
* This number is in the SMS gateway's chosen denomination.
*
* @var float|null
*/
protected $creditsBalance = NULL;
/**
* The credits consumed to process this message, or NULL if unknown.
*
* This number is in the SMS gateway's chosen denomination.
*
* @var float|null
*/
protected $creditsUsed = NULL;
/**
* {@inheritdoc}
*/
public function getError() {
return $this->error;
}
/**
* {@inheritdoc}
*/
public function setError($error) {
$this->error = $error;
return $this;
}
/**
* {@inheritdoc}
*/
public function getErrorMessage() {
return $this->errorMessage;
}
/**
* {@inheritdoc}
*/
public function setErrorMessage($message) {
$this->errorMessage = $message;
return $this;
}
/**
* {@inheritdoc}
*/
public function getReport($recipient) {
foreach ($this->reports as $report) {
if ($report
->getRecipient() == $recipient) {
return $report;
}
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function getReports() {
return $this->reports;
}
/**
* {@inheritdoc}
*/
public function setReports(array $reports) {
$this->reports = $reports;
return $this;
}
/**
* {@inheritdoc}
*/
public function addReport(SmsDeliveryReportInterface $report) {
$this->reports[] = $report;
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreditsBalance() {
return $this->creditsBalance;
}
/**
* {@inheritdoc}
*/
public function setCreditsBalance($balance) {
if (is_numeric($balance) || is_null($balance)) {
$this->creditsBalance = $balance;
}
else {
throw new SmsException(sprintf('Credit balance set is a %s', gettype($balance)));
}
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreditsUsed() {
return $this->creditsUsed;
}
/**
* {@inheritdoc}
*/
public function setCreditsUsed($credits_used) {
if (is_numeric($credits_used) || is_null($credits_used)) {
$this->creditsUsed = $credits_used;
}
else {
throw new SmsException(sprintf('Credit used is a %s', gettype($credits_used)));
}
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SmsMessageResult:: |
protected | property | The credit balance after this message is sent, or NULL if unknown. | |
SmsMessageResult:: |
protected | property | The credits consumed to process this message, or NULL if unknown. | |
SmsMessageResult:: |
protected | property | The error of the message, or NULL if unknown. | |
SmsMessageResult:: |
protected | property | The error message as provided by the gateway API. | |
SmsMessageResult:: |
protected | property | The message delivery reports. | |
SmsMessageResult:: |
public | function |
Adds a delivery report to the result. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Gets the credit balance after this transaction. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Gets the credits consumed for this transaction. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Gets the error of the message. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Gets the error message. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Gets the delivery report for a particular recipient. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Gets the delivery reports for all recipients. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Sets the credit balance after this transaction. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Sets the credits consumed for this transaction. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Sets the error of the message. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Sets the error message. Overrides SmsMessageResultInterface:: |
|
SmsMessageResult:: |
public | function |
Sets the delivery reports for all recipients. Overrides SmsMessageResultInterface:: |