diff --git a/app/code/Magento/BundleImportExport/Model/Export/RowCustomizer.php b/app/code/Magento/BundleImportExport/Model/Export/RowCustomizer.php index 0f58b82872d117b88b631c6d707a6ef699378366..376de359f2530e6fe0ca271cb42508bcce56792c 100644 --- a/app/code/Magento/BundleImportExport/Model/Export/RowCustomizer.php +++ b/app/code/Magento/BundleImportExport/Model/Export/RowCustomizer.php @@ -126,6 +126,15 @@ class RowCustomizer implements RowCustomizerInterface */ private $storeManager; + /** + * @param StoreManagerInterface $storeManager + * @throws \RuntimeException + */ + public function __construct(StoreManagerInterface $storeManager = null) + { + $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); + } + /** * Retrieve list of bundle specific columns * @return array @@ -475,22 +484,8 @@ class RowCustomizer implements RowCustomizerInterface private function getStoreCodeById($storeId) { if (!isset($this->storeIdToCode[$storeId])) { - $this->storeIdToCode[$storeId] = $this->getStoreManager()->getStore($storeId)->getCode(); + $this->storeIdToCode[$storeId] = $this->storeManager->getStore($storeId)->getCode(); } return $this->storeIdToCode[$storeId]; } - - /** - * Initialize StoreManagerInterface if it was not and return it. - * - * @return StoreManagerInterface - * @throws \RuntimeException - */ - private function getStoreManager() - { - if (!$this->storeManager) { - $this->storeManager = ObjectManager::getInstance()->get(StoreManagerInterface::class); - } - return $this->storeManager; - } }