You are here

public function LineItemCollection::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/LineItemCollection.php, line 96

Class

LineItemCollection
Provides a line item collection.

Namespace

Drupal\payment

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;
}