You are here

interface AvailabilityCheckerInterface in Commerce Core 8.2

Same name in this branch
  1. 8.2 src/AvailabilityCheckerInterface.php \Drupal\commerce\AvailabilityCheckerInterface
  2. 8.2 modules/order/src/AvailabilityCheckerInterface.php \Drupal\commerce_order\AvailabilityCheckerInterface

Defines the interface for availability checkers.

Hierarchy

Expanded class hierarchy of AvailabilityCheckerInterface

All classes that implement AvailabilityCheckerInterface

Deprecated

in commerce:8.x-2.18 and is removed from commerce:3.x. Use \Drupal\commerce_order\AvailabilityCheckerInterface instead.

3 files declare their use of AvailabilityCheckerInterface
AvailabilityManager.php in modules/order/src/AvailabilityManager.php
AvailabilityManagerInterface.php in modules/order/src/AvailabilityManagerInterface.php
AvailabilityManagerTest.php in modules/order/tests/src/Unit/AvailabilityManagerTest.php

File

src/AvailabilityCheckerInterface.php, line 11

Namespace

Drupal\commerce
View source
interface AvailabilityCheckerInterface {

  /**
   * Determines whether the checker applies to the given purchasable entity.
   *
   * @param \Drupal\commerce\PurchasableEntityInterface $entity
   *   The purchasable entity.
   *
   * @return bool
   *   TRUE if the checker applies to the given purchasable entity, FALSE
   *   otherwise.
   */
  public function applies(PurchasableEntityInterface $entity);

  /**
   * Checks the availability of the given purchasable entity.
   *
   * @param \Drupal\commerce\PurchasableEntityInterface $entity
   *   The purchasable entity.
   * @param string $quantity
   *   The quantity.
   * @param \Drupal\commerce\Context $context
   *   The context.
   *
   * @return bool|null
   *   TRUE if the entity is available, FALSE if it's unavailable,
   *   or NULL if it has no opinion.
   */
  public function check(PurchasableEntityInterface $entity, $quantity, Context $context);

}

Members

Namesort descending Modifiers Type Description Overrides
AvailabilityCheckerInterface::applies public function Determines whether the checker applies to the given purchasable entity.
AvailabilityCheckerInterface::check public function Checks the availability of the given purchasable entity.