public function SmsMessageResult::setCreditsUsed in SMS Framework 2.1.x
Same name in this branch
- 2.1.x src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult::setCreditsUsed()
- 2.1.x src/Entity/SmsMessageResult.php \Drupal\sms\Entity\SmsMessageResult::setCreditsUsed()
Same name and namespace in other branches
- 8 src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult::setCreditsUsed()
- 2.x src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult::setCreditsUsed()
Sets the credits consumed for this transaction.
Parameters
float|null $credits_used: The credits consumed for this transaction, or NULL if unknown.
Return value
$this Returns this result object for chaining.
Throws
\Drupal\sms\Exception\SmsException Thrown if credits set is an invalid variable type.
Overrides SmsMessageResultInterface::setCreditsUsed
File
- src/
Message/ SmsMessageResult.php, line 148
Class
- SmsMessageResult
- The result of an SMS messaging transaction.
Namespace
Drupal\sms\MessageCode
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;
}