class StockAvailabilityChecker in Commerce Stock 8
The entry point for availability checking through Commerce Stock.
Proxies requests to stock services configured for each entity.
@package Drupal\commerce_stock
Hierarchy
- class \Drupal\commerce_stock\StockAvailabilityChecker implements AvailabilityCheckerInterface
Expanded class hierarchy of StockAvailabilityChecker
1 string reference to 'StockAvailabilityChecker'
1 service uses StockAvailabilityChecker
File
- src/
StockAvailabilityChecker.php, line 17
Namespace
Drupal\commerce_stockView source
class StockAvailabilityChecker implements AvailabilityCheckerInterface {
/**
* The stock service manager.
*
* @var \Drupal\commerce_stock\StockServiceManagerInterface
*/
protected $stockServiceManager;
/**
* Constructs a new StockAvailabilityChecker object.
*
* @param \Drupal\commerce_stock\StockServiceManagerInterface $stock_service_manager
* The stock service manager.
*/
public function __construct(StockServiceManagerInterface $stock_service_manager) {
$this->stockServiceManager = $stock_service_manager;
}
/**
* {@inheritdoc}
*/
public function applies(OrderItemInterface $order_item) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function check(OrderItemInterface $order_item, Context $context) {
return (new AvailabilityResult(TRUE))
->isNeutral();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StockAvailabilityChecker:: |
protected | property | The stock service manager. | |
StockAvailabilityChecker:: |
public | function |
Determines whether the checker applies to the given order item. Overrides AvailabilityCheckerInterface:: |
|
StockAvailabilityChecker:: |
public | function |
Checks the availability of the given order item. Overrides AvailabilityCheckerInterface:: |
|
StockAvailabilityChecker:: |
public | function | Constructs a new StockAvailabilityChecker object. |