• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Dir\Reader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\Module\Dir\Reader的典型用法代码示例。如果您正苦于以下问题:PHP Reader类的具体用法?PHP Reader怎么用?PHP Reader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Reader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Load the packages information
  *
  * @return void
  */
 private function load()
 {
     if ($this->packageModuleMap === null) {
         $jsonData = $this->reader->getComposerJsonFiles()->toArray();
         foreach (array_keys($this->loader->load()) as $moduleName) {
             $moduleDir = $this->filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::ROOT);
             $key = $moduleDir->getRelativePath($this->dirReader->getModuleDir('', $moduleName) . '/composer.json');
             if (isset($jsonData[$key])) {
                 $packageData = \Zend_Json::decode($jsonData[$key]);
                 if (isset($packageData['name'])) {
                     $this->packageModuleMap[$packageData['name']] = $moduleName;
                 }
                 if (isset($packageData['version'])) {
                     $this->modulePackageVersionMap[$moduleName] = $packageData['version'];
                 }
                 if (!empty($packageData['require'])) {
                     $this->requireMap[$moduleName] = array_keys($packageData['require']);
                 }
                 if (!empty($packageData['conflict'])) {
                     $this->conflictMap[$moduleName] = $packageData['conflict'];
                 }
             }
         }
     }
 }
开发者ID:vrann,项目名称:magento2-from-vendor,代码行数:30,代码来源:PackageInfo.php


示例2: get

 /**
  * {@inheritdoc}
  */
 public function get($filename, $scope)
 {
     switch ($scope) {
         case 'global':
             $iterator = $this->moduleReader->getConfigurationFiles($filename)->toArray();
             $themeConfigFile = $this->currentTheme->getCustomization()->getCustomViewConfigPath();
             if ($themeConfigFile && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))) {
                 $iterator[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($themeConfigFile));
             } else {
                 $designPath = $this->resolver->resolve(RulePool::TYPE_FILE, 'etc/view.xml', $this->area, $this->currentTheme);
                 if (file_exists($designPath)) {
                     try {
                         $designDom = new \DOMDocument();
                         $designDom->load($designPath);
                         $iterator[$designPath] = $designDom->saveXML();
                     } catch (\Exception $e) {
                         throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Could not read config file'));
                     }
                 }
             }
             break;
         default:
             $iterator = $this->iteratorFactory->create([]);
             break;
     }
     return $iterator;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:30,代码来源:FileResolver.php


示例3: testLoadData

 /**
  * @param string $area
  * @param bool $forceReload
  * @param array $cachedData
  * @dataProvider dataProviderForTestLoadData
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function testLoadData($area, $forceReload, $cachedData)
 {
     $this->expectsSetConfig('themeId');
     $this->cache->expects($this->exactly($forceReload ? 0 : 1))->method('load')->will($this->returnValue(serialize($cachedData)));
     if (!$forceReload && $cachedData !== false) {
         $this->translate->loadData($area, $forceReload);
         $this->assertEquals($cachedData, $this->translate->getData());
         return;
     }
     $this->directory->expects($this->any())->method('isExist')->will($this->returnValue(true));
     // _loadModuleTranslation()
     $this->moduleList->expects($this->once())->method('getNames')->will($this->returnValue(['name']));
     $moduleData = ['module original' => 'module translated', 'module theme' => 'module-theme original translated', 'module pack' => 'module-pack original translated', 'module db' => 'module-db original translated'];
     $this->modulesReader->expects($this->any())->method('getModuleDir')->will($this->returnValue('/app/module'));
     $themeData = ['theme original' => 'theme translated', 'module theme' => 'theme translated overwrite', 'module pack' => 'theme-pack translated overwrite', 'module db' => 'theme-db translated overwrite'];
     $this->csvParser->expects($this->any())->method('getDataPairs')->will($this->returnValueMap([['/app/module/en_US.csv', 0, 1, $moduleData], ['/app/module/en_GB.csv', 0, 1, $moduleData], ['/theme.csv', 0, 1, $themeData]]));
     // _loadThemeTranslation()
     $this->viewFileSystem->expects($this->any())->method('getLocaleFileName')->will($this->returnValue('/theme.csv'));
     // _loadPackTranslation
     $packData = ['pack original' => 'pack translated', 'module pack' => 'pack translated overwrite', 'module db' => 'pack-db translated overwrite'];
     $this->packDictionary->expects($this->once())->method('getDictionary')->will($this->returnValue($packData));
     // _loadDbTranslation()
     $dbData = ['db original' => 'db translated', 'module db' => 'db translated overwrite'];
     $this->resource->expects($this->any())->method('getTranslationArray')->will($this->returnValue($dbData));
     $this->cache->expects($this->exactly(1))->method('save');
     $this->translate->loadData($area, $forceReload);
     $expected = ['module original' => 'module translated', 'module theme' => 'theme translated overwrite', 'module pack' => 'pack translated overwrite', 'module db' => 'db translated overwrite', 'theme original' => 'theme translated', 'pack original' => 'pack translated', 'db original' => 'db translated'];
     $this->assertEquals($expected, $this->translate->getData());
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:36,代码来源:TranslateTest.php


示例4: __construct

 /**
  * Read locales
  * @param \Magento\Framework\Module\Dir\Reader $moduleReader
  */
 public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader)
 {
     $file = $moduleReader->getModuleDir('etc', 'BelVG_FacebookFree') . '/' . 'locale.xml';
     if (is_readable($file)) {
         $this->locales = simplexml_load_file($file);
     }
 }
开发者ID:wclabhinav,项目名称:Magento2,代码行数:11,代码来源:Locale.php


示例5: setUp

 protected function setUp()
 {
     $this->moduleDir = 'moduleDirectory';
     $this->moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', [], [], '', false);
     $this->moduleReader->expects($this->any())->method('getModuleDir')->willReturn($this->moduleDir);
     $this->schemaLocator = new SchemaLocator($this->moduleReader);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:7,代码来源:SchemaLocatorTest.php


示例6: __construct

 /**
  * Build DOM with initial XML contents and specifying identifier attributes for merging
  *
  * Format of $schemaFileType: array('etc', 'sql', 'data', 'i18n', 'view', 'Controller')
  * Format of $schemaFileModule: 'Magento_XXXXX'
  * Format of $schemaFileName: 'schema.xsd'
  * Format of $idAttributes: array('name', 'id')
  * Format of $contextXPath: array('/config/ui')
  * The path to ID attribute name should not include any attribute notations or modifiers -- only node names
  *
  * @param string $schemaFileType
  * @param string $schemaFileModule
  * @param string $schemaFileName
  * @param DirectoryReader $directoryReader
  * @param bool $isMergeSimpleXMLElement
  * @param array $contextXPath
  * @param array $idAttributes
  */
 public function __construct(DirectoryReader $directoryReader, $schemaFileType, $schemaFileModule, $schemaFileName, $isMergeSimpleXMLElement = false, array $contextXPath = [], array $idAttributes = [])
 {
     $this->schemaFilePath = $directoryReader->getModuleDir($schemaFileType, $schemaFileModule) . '/' . trim($schemaFileName, '/');
     $this->isMergeSimpleXMLElement = $isMergeSimpleXMLElement;
     $this->contextXPath = $contextXPath;
     $this->idAttributes = $idAttributes;
 }
开发者ID:vrann,项目名称:magento2-from-vendor,代码行数:25,代码来源:DomMerger.php


示例7: __construct

 /**
  * @param \Magento\Framework\Module\Dir\Reader $modulesReader
  * @param \Magento\Framework\Config\DomFactory $domConfigFactory
  */
 public function __construct(\Magento\Framework\Module\Dir\Reader $modulesReader, \Magento\Framework\Config\DomFactory $domConfigFactory)
 {
     $this->_modulesReader = $modulesReader;
     $this->_domConfigFactory = $domConfigFactory;
     $this->_initMessageTemplates();
     $this->_xsdSchemas = array(self::LAYOUT_SCHEMA_SINGLE_HANDLE => $this->_modulesReader->getModuleDir('etc', 'Magento_Core') . '/layout_single.xsd', self::LAYOUT_SCHEMA_MERGED => $this->_modulesReader->getModuleDir('etc', 'Magento_Core') . '/layout_merged.xsd');
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:Validator.php


示例8: setUp

 protected function setUp()
 {
     $this->_xsdFile = $this->_xsdDir . '/address_formats.xsd';
     $this->_moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', ['getModuleDir'], [], '', false);
     $this->_moduleReader->expects($this->once())->method('getModuleDir')->with('etc', 'Magento_Customer')->will($this->returnValue($this->_xsdDir));
     $this->_model = new \Magento\Customer\Model\Address\Config\SchemaLocator($this->_moduleReader);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:SchemaLocatorTest.php


示例9: __construct

 /**
  * constructor
  *
  * @param \Magento\Framework\Module\Dir\Reader $moduleReader
  * @param $fileSchema
  * @param null $mergedSchema
  */
 public function __construct(Reader $moduleReader, $fileSchema, $mergedSchema = null)
 {
     if (is_null($mergedSchema)) {
         $mergedSchema = $fileSchema . '_merged';
     }
     $this->schema = $moduleReader->getModuleDir('etc', 'Umc_Base') . '/umc/' . $mergedSchema . '.xsd';
     $this->perFileSchema = $moduleReader->getModuleDir('etc', 'Umc_Base') . '/umc/' . $fileSchema . '.xsd';
 }
开发者ID:artmouse,项目名称:Umc_Base,代码行数:15,代码来源:SchemaLocator.php


示例10: hasLocalCopy

 /**
  * @return bool
  */
 public function hasLocalCopy()
 {
     $path = $this->_moduleReader->getModuleDir('etc', 'Magento_Adminhtml');
     $directory = $this->_filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem::MODULES_DIR);
     if ($path && $directory->isDirectory($directory->getRelativePath($path))) {
         return true;
     }
     return false;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Download.php


示例11: setUp

    /**
     * Save default translator
     */
    protected function setUp()
    {
        $this->_defaultTranslator = \Magento\Framework\Validator\AbstractValidator::getDefaultTranslator();
        $this->_objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface');
        $this->_validatorConfig = $this->getMockBuilder(
            'Magento\Framework\Validator\Config'
        )->setMethods(
            ['createValidatorBuilder', 'createValidator']
        )->disableOriginalConstructor()->getMock();

        $this->_objectManager->expects(
            $this->at(0)
        )->method(
            'create'
        )->with(
            'Magento\Framework\Translate\Adapter'
        )->will(
            $this->returnValue(new \Magento\Framework\Translate\Adapter())
        );

        $this->_objectManager->expects(
            $this->at(1)
        )->method(
            'create'
        )->with(
            'Magento\Framework\Validator\Config',
            ['configFiles' => ['/tmp/moduleOne/etc/validation.xml']]
        )->will(
            $this->returnValue($this->_validatorConfig)
        );

        // Config mock
        $this->_config = $this->getMockBuilder(
            'Magento\Framework\Module\Dir\Reader'
        )->setMethods(
            ['getConfigurationFiles']
        )->disableOriginalConstructor()->getMock();
        $this->_config->expects(
            $this->once()
        )->method(
            'getConfigurationFiles'
        )->with(
            'validation.xml'
        )->will(
            $this->returnValue(['/tmp/moduleOne/etc/validation.xml'])
        );

        // Translate adapter mock
        $this->_translateAdapter = $this->getMockBuilder(
            'Magento\Framework\TranslateInterface'
        )->disableOriginalConstructor()->getMock();

        $this->cache = $this->getMockBuilder(\Magento\Framework\Cache\FrontendInterface::class)
            ->getMockForAbstractClass();
    }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:58,代码来源:FactoryTest.php


示例12: setUp

 public function setUp()
 {
     $this->componentRegistrar = $this->getMock('Magento\\Framework\\Component\\ComponentRegistrar', [], [], '', false);
     $this->reader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', [], [], '', false);
     $this->componentRegistrar->expects($this->once())->method('getPaths')->will($this->returnValue(['A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E']));
     $composerData = ['A/composer.json' => '{"name":"a", "require":{"b":"0.1"}, "conflict":{"c":"0.1"}, "version":"0.1"}', 'B/composer.json' => '{"name":"b", "require":{"d":"0.3"}, "version":"0.2"}', 'C/composer.json' => '{"name":"c", "require":{"e":"0.1"}, "version":"0.1"}', 'D/composer.json' => '{"name":"d", "conflict":{"c":"0.1"}, "version":"0.3"}', 'E/composer.json' => '{"name":"e", "version":"0.4"}'];
     $fileIteratorMock = $this->getMock('Magento\\Framework\\Config\\FileIterator', [], [], '', false);
     $fileIteratorMock->expects($this->once())->method('toArray')->will($this->returnValue($composerData));
     $this->reader->expects($this->once())->method('getComposerJsonFiles')->will($this->returnValue($fileIteratorMock));
     $this->packageInfo = new PackageInfo($this->reader, $this->componentRegistrar);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:PackageInfoTest.php


示例13: __construct

 /**
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param ModuleReader $moduleReader
  * @param string $actionInterface
  * @param string $cacheKey
  * @param array $reservedWords
  */
 public function __construct(\Magento\Framework\Config\CacheInterface $cache, ModuleReader $moduleReader, $actionInterface = '\\Magento\\Framework\\App\\ActionInterface', $cacheKey = 'app_action_list', $reservedWords = [])
 {
     $this->reservedWords = array_merge($reservedWords, $this->reservedWords);
     $this->actionInterface = $actionInterface;
     $data = $cache->load($cacheKey);
     if (!$data) {
         $this->actions = $moduleReader->getActionFiles();
         $cache->save(serialize($this->actions), $cacheKey);
     } else {
         $this->actions = unserialize($data);
     }
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:19,代码来源:ActionList.php


示例14: _initializeConfigList

 /**
  * Init cached list of validation files
  */
 protected function _initializeConfigList()
 {
     if (!$this->_configFiles) {
         $this->_configFiles = $this->cache->load(self::CACHE_KEY);
         if (!$this->_configFiles) {
             $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml');
             $this->cache->save(serialize($this->_configFiles), self::CACHE_KEY);
         } else {
             $this->_configFiles = unserialize($this->_configFiles);
         }
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:Factory.php


示例15: __construct

 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Module\Dir\Reader $configReader, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Mehulchaudhari\Geoip\Helper\Data $geoipHelper, array $data = [])
 {
     $this->_geoipHelper = $geoipHelper;
     $this->_logger = $context->getLogger();
     $this->_scopeConfig = $scopeConfig;
     $this->_storeManager = $storeManager;
     $this->libpath = $configReader->getModuleDir('', 'Mehulchaudhari_Geoip');
     if (!function_exists('geoip_country_code_by_name') && $this->_geoipHelper->getConfig('general/apache_or_file') == 1) {
         define('GEOIP_LOCAL', 1);
         $geoIpInc = $this->libpath . '/lib/geoip.inc';
         include $geoIpInc;
     }
 }
开发者ID:pierredewit,项目名称:MagentoExtensions,代码行数:13,代码来源:Geoip.php


示例16: getContentStep

 /**
  * @param bool $check
  */
 protected function getContentStep($check = true)
 {
     $resultPath = 'adminhtml/path/to/file.xml';
     $includeXmlContent = '<config><item id="1"><test/></item><item id="2"></item></config>';
     $modulesDirectoryMock = $this->getMockBuilder('Magento\\Framework\\Filesystem\\Directory\\ReadInterface')->getMockForAbstractClass();
     $this->readFactoryMock->expects($this->once())->method('create')->willReturn($modulesDirectoryMock);
     $this->moduleReaderMock->expects($this->once())->method('getModuleDir')->with('etc', 'Module_Name')->willReturn('path/in/application/module');
     $modulesDirectoryMock->expects($this->once())->method('isExist')->with($resultPath)->willReturn($check);
     if ($check) {
         $modulesDirectoryMock->expects($this->once())->method('isFile')->with($resultPath)->willReturn($check);
         $modulesDirectoryMock->expects($this->once())->method('readFile')->with($resultPath)->willReturn($includeXmlContent);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:IncludeElementTest.php


示例17: get

 /**
  * {@inheritdoc}
  */
 public function get($filename, $scope)
 {
     switch ($scope) {
         case 'global':
             $iterator = $this->_moduleReader->getConfigurationFiles($filename);
             break;
         case 'design':
             $iterator = $this->iteratorFactory->create($this->themesDirectory, $this->themesDirectory->search('/*/*/etc/' . $filename));
             break;
         default:
             $iterator = $this->iteratorFactory->create($this->themesDirectory, array());
             break;
     }
     return $iterator;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:FileResolver.php


示例18: getViewConfig

    /**
     * Render view config object for current package and theme
     *
     * @param array $params
     * @return \Magento\Framework\Config\View
     */
    public function getViewConfig(array $params = [])
    {
        $this->assetRepo->updateDesignParams($params);
        /** @var $currentTheme \Magento\Framework\View\Design\ThemeInterface */
        $currentTheme = $params['themeModel'];
        $key = $currentTheme->getCode();
        if (isset($this->viewConfigs[$key])) {
            return $this->viewConfigs[$key];
        }

        $configFiles = $this->moduleReader->getConfigurationFiles(basename($this->filename))->toArray();
        $themeConfigFile = $currentTheme->getCustomization()->getCustomViewConfigPath();
        if (empty($themeConfigFile)
            || !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
        ) {
            $themeConfigFile = $this->viewFileSystem->getFilename($this->filename, $params);
        }
        if ($themeConfigFile
            && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
        ) {
            $configFiles[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile(
                $this->rootDirectory->getRelativePath($themeConfigFile)
            );
        }
        $config = $this->viewFactory->create($configFiles);

        $this->viewConfigs[$key] = $config;
        return $config;
    }
开发者ID:nblair,项目名称:magescotch,代码行数:35,代码来源:Config.php


示例19: get

 /**
  * {@inheritdoc}
  */
 public function get($filename, $scope)
 {
     switch ($scope) {
         case 'global':
             $iterator = $this->_moduleReader->getConfigurationFiles($filename);
             break;
         case 'design':
             $themePaths = $this->componentDirSearch->collectFiles(ComponentRegistrar::THEME, 'etc/' . $filename);
             $iterator = $this->iteratorFactory->create($themePaths);
             break;
         default:
             $iterator = $this->iteratorFactory->create([]);
             break;
     }
     return $iterator;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:FileResolver.php


示例20: get

 /**
  * {@inheritdoc}
  */
 public function get($filename, $scope)
 {
     switch ($scope) {
         case 'primary':
             $directory = $this->filesystem->getDirectoryRead(DirectoryList::CONFIG);
             $iterator = $this->iteratorFactory->create($directory, $directory->search('{' . $filename . ',*/' . $filename . '}'));
             break;
         case 'global':
             $iterator = $this->_moduleReader->getConfigurationFiles($filename);
             break;
         default:
             $iterator = $this->_moduleReader->getConfigurationFiles($scope . '/' . $filename);
             break;
     }
     return $iterator;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:FileResolver.php



注:本文中的Magento\Framework\Module\Dir\Reader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ObjectManager\ObjectManager类代码示例发布时间:2022-05-23
下一篇:
PHP Module\ModuleListInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap