22 private $_instances = [];
27 private $instancesByType = [];
36 $this->instancesByType = $instancesByType;
48 $helperInstance = $this->_objectManager->get(
$className);
52 throw new \LogicException(
53 "{$className} doesn't implement " .
57 $this->_instances[
$className] = $helperInstance;
68 if (!isset($this->instancesByType[$productType])) {
69 return $this->instancesByType[
'default'];
71 return $this->instancesByType[$productType];
getByProductType($productType)
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $instancesByType)