public function SmsMessageResult::setCreditsBalance in SMS Framework 8
Same name in this branch
- 8 src/Message/SmsMessageResult.php \Drupal\sms\Message\SmsMessageResult::setCreditsBalance()
- 8 src/Entity/SmsMessageResult.php \Drupal\sms\Entity\SmsMessageResult::setCreditsBalance()
Same name and namespace in other branches
- 2.x src/Entity/SmsMessageResult.php \Drupal\sms\Entity\SmsMessageResult::setCreditsBalance()
- 2.1.x src/Entity/SmsMessageResult.php \Drupal\sms\Entity\SmsMessageResult::setCreditsBalance()
Sets the credit balance after this transaction.
Parameters
float|null $balance: The credit balance after the message is processed, or NULL if unknown.
Return value
$this Returns this result object for chaining.
Throws
\Drupal\sms\Exception\SmsException Thrown if balance set is an invalid variable type.
Overrides SmsMessageResultInterface::setCreditsBalance
File
- src/
Entity/ SmsMessageResult.php, line 126
Class
- SmsMessageResult
- Defines the SMS message result entity.
Namespace
Drupal\sms\EntityCode
public function setCreditsBalance($balance) {
if (is_numeric($balance) || is_null($balance)) {
$this
->set('credits_balance', $balance);
}
else {
throw new SmsException(sprintf('Credit balance set is a %s', gettype($balance)));
}
return $this;
}