You are here

public function LineItemCollection::getAmount in Payment 8.2

Gets the line items' total amount.

Return value

float|int|string A numeric value.

Overrides LineItemCollectionInterface::getAmount

File

src/LineItemCollection.php, line 123

Class

LineItemCollection
Provides a line item collection.

Namespace

Drupal\payment

Code

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