class LocalStockService in Commerce Stock 8
The Local stock Service class.
Hierarchy
- class \Drupal\commerce_stock_local\LocalStockService implements StockServiceInterface
Expanded class hierarchy of LocalStockService
1 file declares its use of LocalStockService
- LocalStockServiceTest.php in modules/
local_storage/ tests/ src/ Kernel/ LocalStockServiceTest.php
1 string reference to 'LocalStockService'
- commerce_stock_local.services.yml in modules/
local_storage/ commerce_stock_local.services.yml - modules/local_storage/commerce_stock_local.services.yml
1 service uses LocalStockService
File
- modules/
local_storage/ src/ LocalStockService.php, line 14
Namespace
Drupal\commerce_stock_localView source
class LocalStockService implements StockServiceInterface {
/**
* The stock checker.
*
* @var \Drupal\commerce_stock\StockCheckInterface
*/
protected $stockChecker;
/**
* The stock updater.
*
* @var \Drupal\commerce_stock\StockUpdateInterface
*/
protected $stockUpdater;
/**
* The stock configuration.
*
* @var \Drupal\commerce_stock\StockServiceConfigInterface
*/
protected $stockServiceConfig;
/**
* Constructs a new LocalStockService object.
*
* @param \Drupal\commerce_stock\StockCheckInterface $stock_checker
* The stock checker.
* @param \Drupal\commerce_stock\StockUpdateInterface $stock_updater
* The stock updater.
* @param \Drupal\commerce_stock\StockServiceConfigInterface $stock_service_config
* The stock configuration.
*/
public function __construct(StockCheckInterface $stock_checker, StockUpdateInterface $stock_updater, StockServiceConfigInterface $stock_service_config) {
$this->stockChecker = $stock_checker;
$this->stockUpdater = $stock_updater;
$this->stockServiceConfig = $stock_service_config;
}
/**
* Creates a new Local stock service.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The DI container.
*
* @return static
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('commerce_stock.local_stock_checker'), $container
->get('commerce_stock.local_stock_updater'), $container
->get('commerce_stock.local_stock_service_config'));
}
/**
* Get the name of the service.
*/
public function getName() {
return 'Local stock';
}
/**
* Get the ID of the service.
*/
public function getId() {
return 'local_stock';
}
/**
* Gets the stock checker.
*
* @return \Drupal\commerce_stock\StockCheckInterface
* The stock checker.
*/
public function getStockChecker() {
return $this->stockChecker;
}
/**
* Gets the stock updater.
*
* @return \Drupal\commerce_stock\StockUpdateInterface
* The stock updater.
*/
public function getStockUpdater() {
return $this->stockUpdater;
}
/**
* Gets the stock Configuration.
*
* @return \Drupal\commerce_stock\StockServiceConfigInterface
* The stock Configuration.
*/
public function getConfiguration() {
return $this->stockServiceConfig;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LocalStockService:: |
protected | property | The stock checker. | |
LocalStockService:: |
protected | property | The stock configuration. | |
LocalStockService:: |
protected | property | The stock updater. | |
LocalStockService:: |
public static | function | Creates a new Local stock service. | |
LocalStockService:: |
public | function |
Gets the stock Configuration. Overrides StockServiceInterface:: |
|
LocalStockService:: |
public | function |
Get the ID of the service. Overrides StockServiceInterface:: |
|
LocalStockService:: |
public | function |
Get the name of the service. Overrides StockServiceInterface:: |
|
LocalStockService:: |
public | function |
Gets the stock checker. Overrides StockServiceInterface:: |
|
LocalStockService:: |
public | function |
Gets the stock updater. Overrides StockServiceInterface:: |
|
LocalStockService:: |
public | function | Constructs a new LocalStockService object. |