You are here

public function Payment::getLineItem in Payment 8.2

Gets a line item.

Parameters

string $name: The line item's machine name.

Return value

\Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface

Overrides LineItemCollectionInterface::getLineItem

File

src/Entity/Payment.php, line 192

Class

Payment
Defines a payment entity.

Namespace

Drupal\payment\Entity

Code

public function getLineItem($name) {
  $line_items = $this
    ->getLineItems();
  foreach ($line_items as $delta => $line_item) {
    if ($line_item
      ->getName() == $name) {
      return $line_item;
    }
  }
  return NULL;
}