![]() 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/framework/App/View/Asset/MaterializationStrategy/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\App\View\Asset\MaterializationStrategy; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\View\Asset; class Factory { /** * Object Manager instance * * @var ObjectManagerInterface */ protected $objectManager; /** * Strategies list * * @var array */ protected $strategiesList; /** * Default strategy key */ const DEFAULT_STRATEGY = \Magento\Framework\App\View\Asset\MaterializationStrategy\Copy::class; /** * @param ObjectManagerInterface $objectManager * @param StrategyInterface[] $strategiesList */ public function __construct(ObjectManagerInterface $objectManager, $strategiesList = []) { $this->objectManager = $objectManager; $this->strategiesList = $strategiesList; } /** * Create materialization strategy basing on asset * * @param Asset\LocalInterface $asset * @return StrategyInterface * * @throws \LogicException */ public function create(Asset\LocalInterface $asset) { if (empty($this->strategiesList)) { $this->strategiesList[] = $this->objectManager->get(self::DEFAULT_STRATEGY); } foreach ($this->strategiesList as $strategy) { if ($strategy->isSupported($asset)) { return $strategy; } } throw new \LogicException('No materialization strategy is supported'); } }