You are here

public function Payment::getAmount in Payment 8.2

Gets the line items' total amount.

Return value

float|int|string A numeric value.

Overrides LineItemCollectionInterface::getAmount

File

src/Entity/Payment.php, line 342

Class

Payment
Defines a payment entity.

Namespace

Drupal\payment\Entity

Code

public function getAmount() {
  $total = 0;
  foreach ($this
    ->getLineItems() as $line_item) {
    $total = bcadd($total, $line_item
      ->getTotalAmount(), 6);
  }
  return $total;
}