You are here

function UserpointsTransaction::setPoints in User Points 7.2

Define the points amount of this transaction, which can be any positive or negative amount but not 0.

Parameters

$points: The points as an integer.

Return value

UserpointsTransaction

File

./userpoints.transaction.inc, line 355
Contains the UserpointsTransaction and related classes.

Class

UserpointsTransaction
A Userpoints transaction.

Code

function setPoints($points) {
  $this
    ->checkChange();

  // Empty points amount is not allowed.
  if (empty($points)) {
    $this
      ->abort();
    throw new UserpointsInvalidArgumentException();
  }
  $this->points = $points;
  return $this;
}