Spamworldpro Mini Shell
Spamworldpro


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/cartforge.co/vendor/magento/module-theme/Model/Theme/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/magento/module-theme/Model/Theme/StoreDefaultThemeResolver.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Theme\Model\Theme;

use Magento\Framework\App\Area;
use Magento\Framework\View\Design\ThemeInterface;
use Magento\Framework\View\DesignInterface;
use Magento\Store\Api\Data\StoreInterface;
use Magento\Theme\Model\ResourceModel\Theme\CollectionFactory;

/**
 * Store default theme resolver.
 *
 * Use system config fallback mechanism if no theme is directly assigned to the store-view.
 */
class StoreDefaultThemeResolver implements StoreThemesResolverInterface
{
    /**
     * @var CollectionFactory
     */
    private $themeCollectionFactory;
    /**
     * @var DesignInterface
     */
    private $design;
    /**
     * @var ThemeInterface[]
     */
    private $registeredThemes;

    /**
     * @param CollectionFactory $themeCollectionFactory
     * @param DesignInterface $design
     */
    public function __construct(
        CollectionFactory $themeCollectionFactory,
        DesignInterface $design
    ) {
        $this->design = $design;
        $this->themeCollectionFactory = $themeCollectionFactory;
    }

    /**
     * @inheritDoc
     */
    public function getThemes(StoreInterface $store): array
    {
        $theme = $this->design->getConfigurationDesignTheme(
            Area::AREA_FRONTEND,
            ['store' => $store]
        );
        $themes = [];
        if ($theme) {
            if (!is_numeric($theme)) {
                $registeredThemes = $this->getRegisteredThemes();
                if (isset($registeredThemes[$theme])) {
                    $themes[] = $registeredThemes[$theme]->getId();
                }
            } else {
                $themes[] = $theme;
            }
        }
        return $themes;
    }

    /**
     * Get system registered themes.
     *
     * @return ThemeInterface[]
     */
    private function getRegisteredThemes(): array
    {
        if ($this->registeredThemes === null) {
            $this->registeredThemes = [];
            /** @var \Magento\Theme\Model\ResourceModel\Theme\Collection $collection */
            $collection = $this->themeCollectionFactory->create();
            $themes = $collection->loadRegisteredThemes();
            /** @var ThemeInterface $theme */
            foreach ($themes as $theme) {
                $this->registeredThemes[$theme->getCode()] = $theme;
            }
        }
        return $this->registeredThemes;
    }
}

Spamworldpro Mini