![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-reports/Model/Product/Index/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Reports\Model\Product\Index; /** * @api * @since 100.0.2 */ class Factory { const TYPE_COMPARED = 'compared'; const TYPE_VIEWED = 'viewed'; /** * @var \Magento\Framework\ObjectManagerInterface */ private $_objectManager; /** * @var array */ protected $_typeClasses = [ self::TYPE_COMPARED => \Magento\Reports\Model\Product\Index\Compared::class, self::TYPE_VIEWED => \Magento\Reports\Model\Product\Index\Viewed::class, ]; /** * @var \Magento\Reports\Model\Product\Index\Abstract[] */ protected $_instances; /** * @param \Magento\Framework\ObjectManagerInterface $objectManager */ public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager) { $this->_objectManager = $objectManager; } /** * @param string $type * @return \Magento\Reports\Model\Product\Index\AbstractIndex * @throws \InvalidArgumentException */ public function get($type) { if (!isset($this->_instances[$type])) { if (!isset($this->_typeClasses[$type])) { throw new \InvalidArgumentException("{$type} is not index model"); } $this->_instances[$type] = $this->_objectManager->create($this->_typeClasses[$type]); } return $this->_instances[$type]; } }