use Magento\Store\Model\StoreManagerInterface; class MyCustomClass { protected $storeManager; public function __construct(StoreManagerInterface $storeManager) { $this->storeManager = $storeManager; } public function getCurrentStoreInfo() { $currentStoreId = $this->storeManager->getCurrentStoreId(); $currentStore = $this->storeManager->getStore($currentStoreId); return [ 'name' => $currentStore->getName(), 'url' => $currentStore->getBaseUrl(), 'code' => $currentStore->getCode(), ]; } }This code demonstrates how StoreManagerInterface can be injected into a custom class constructor and used to retrieve the current store information. This code is part of the Magento 2 library.