public function OrderItemMatcher::match in Commerce Core 8.2
Finds the first matching order item for the given order item.
Parameters
\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.
\Drupal\commerce_order\Entity\OrderItemInterface[] $order_items: The order items to match against.
Return value
\Drupal\commerce_order\Entity\OrderItemInterface|null A matching order item, or NULL if none was found.
Overrides OrderItemMatcherInterface::match
File
- modules/
cart/ src/ OrderItemMatcher.php, line 46
Class
- OrderItemMatcher
- Default implementation of the order item matcher.
Namespace
Drupal\commerce_cartCode
public function match(OrderItemInterface $order_item, array $order_items) {
$order_items = $this
->matchAll($order_item, $order_items);
return count($order_items) ? $order_items[0] : NULL;
}