![]() 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/amasty/shopby/Plugin/Framework/Search/Dynamic/Algorithm/ |
<?php /** * @author Amasty Team * @copyright Copyright (c) Amasty (https://www.amasty.com) * @package Improved Layered Navigation Base for Magento 2 */ namespace Amasty\Shopby\Plugin\Framework\Search\Dynamic\Algorithm; use Magento\Framework\Search\Dynamic\Algorithm\Repository as DynamicAlgorithmRepository; use Magento\Framework\Search\Dynamic\Algorithm; /** * For temporary use. Untill all buckets will be evaluated in 1 request @todo */ class Repository { /** * @var \Magento\Framework\ObjectManagerInterface */ private $objectManager; /** * Repository constructor. * @param \Magento\Framework\ObjectManagerInterface $objectManager */ public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager) { $this->objectManager = $objectManager; } /** * Reinitialize shared instance. In order to get correct aggregations for a price when it has current value applied * * @param Repository $subject * @param \Closure $closure * @param $algorithmType * @param array $data * @return mixed * @SuppressWarnings(PHPMD.UnusedFormatParameter) */ public function aroundGet(DynamicAlgorithmRepository $subject, \Closure $closure, $algorithmType, array $data = []) { $result = $closure($algorithmType, $data); if ($algorithmType == 'auto') { return $this->objectManager->create(Algorithm\Auto::class, $data); } elseif ($algorithmType == 'manual') { return $this->objectManager->create(Algorithm\Manual::class, $data); } elseif ($algorithmType == 'improved') { return $this->objectManager->create(Algorithm\Improved::class, $data); } return $result; } }