Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StoreCheck.php
Go to the documentation of this file.
1 <?php
8 
9 class StoreCheck
10 {
14  protected $_storeManager;
15 
19  public function __construct(
21  ) {
22  $this->_storeManager = $storeManager;
23  }
24 
32  public function beforeDispatch(
33  \Magento\Framework\App\Action\AbstractAction $subject,
35  ) {
36  if (!$this->_storeManager->getStore()->isActive()) {
37  throw new \Magento\Framework\Exception\State\InitException(
38  __('Current store is not active.')
39  );
40  }
41  }
42 }
$storeManager
__()
Definition: __.php:13
beforeDispatch(\Magento\Framework\App\Action\AbstractAction $subject, \Magento\Framework\App\RequestInterface $request)
Definition: StoreCheck.php:32
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager)
Definition: StoreCheck.php:19