You are here

protected function Promotion::getCouponIndex in Commerce Core 8.2

Gets the index of the given coupon.

Parameters

\Drupal\commerce_promotion\Entity\CouponInterface $coupon: The coupon.

Return value

int|bool The index of the given coupon, or FALSE if not found.

1 call to Promotion::getCouponIndex()
Promotion::removeCoupon in modules/promotion/src/Entity/Promotion.php
Removes a coupon.

File

modules/promotion/src/Entity/Promotion.php, line 386

Class

Promotion
Defines the promotion entity class.

Namespace

Drupal\commerce_promotion\Entity

Code

protected function getCouponIndex(CouponInterface $coupon) {
  return array_search($coupon
    ->id(), $this
    ->getCouponIds());
}