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/old/dev/tests/integration/testsuite/Magento/Ui/Config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/dev/tests/integration/testsuite/Magento/Ui/Config/FileResolverStub.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Ui\Config;

use Magento\Framework\Config\FileIterator;
use Magento\Framework\Filesystem\DriverPool;
use Magento\Framework\Filesystem\File\ReadFactory;
use Magento\Framework\Module\Dir;

class FileResolverStub implements \Magento\Framework\Config\FileResolverInterface
{
    /**
     * @var array
     */
    private $files = [
        'etc/definition.xml' => [
            'module_one/ui_component/etc/test_definition.xml',
            'module_two/ui_component/etc/test_definition.xml'
        ],
        'etc/definition.map.xml' => [
            'ui_component/etc/definition.map.xml'
        ],
        'etc/test_definition.xml' => [
            'module_one/ui_component/etc/test_definition.xml',
            'module_two/ui_component/etc/test_definition.xml'
        ],
        'test_component.xml' => [
            'module_one/ui_component/test_component.xml',
            'module_two/ui_component/test_component.xml'
        ],
        'parent_component.xml' => [
            'module_one/ui_component/parent_component.xml',
            'module_two/ui_component/parent_component.xml'
        ]
    ];

    /**
     * @var Dir\Reader
     */
    private $moduleReader;

    /**
     * FileResolverStub constructor.
     *
     * @param \Magento\Framework\Module\Dir\Reader $moduleReader
     * @param array $files
     */
    public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader, array $files = [])
    {
        $this->files = array_replace($this->files, $files);
        $this->moduleReader = $moduleReader;
    }

    /**
     * {@inheritdoc}
     */
    public function get($filename, $scope)
    {
        if ($filename == 'etc/definition.map.xml') {
            $path = $this->moduleReader->getModuleDir(Dir::MODULE_VIEW_DIR, 'Magento_Ui') . '/base';
        } else {
            $path = realpath(__DIR__ . '/../_files/view');
        }
        $files = isset($this->files[$filename]) ? $this->files[$filename] : [];
        $realPaths = [];
        foreach ($files as $filePath) {
            $realPaths[] = $path . '/' . $filePath;
        }
        return new FileIterator(new ReadFactory(new DriverPool), $realPaths);
    }
}

Spamworldpro Mini