Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Store.php
Go to the documentation of this file.
1 <?php
7 
8 class Store implements ReaderInterface
9 {
13  protected $storeRepository;
14 
18  public function __construct(\Magento\Store\Api\StoreRepositoryInterface $storeRepository)
19  {
20  $this->storeRepository = $storeRepository;
21  }
22 
26  public function getAllowedStoreIds($scopeCode)
27  {
28  $stores = [];
29  foreach ($this->storeRepository->getList() as $store) {
30  if ($store->isActive()) {
31  $stores[] = $store->getId();
32  }
33  }
34  return $stores;
35  }
36 
40  public function getDefaultStoreId($scopeCode)
41  {
42  return $this->storeRepository->get($scopeCode)->getId();
43  }
44 }
__construct(\Magento\Store\Api\StoreRepositoryInterface $storeRepository)
Definition: Store.php:18