当前位置: 首页>>代码示例>>PHP>>正文


PHP DirectoryList::getDir方法代码示例

本文整理汇总了PHP中Magento\Framework\App\Filesystem\DirectoryList::getDir方法的典型用法代码示例。如果您正苦于以下问题:PHP DirectoryList::getDir方法的具体用法?PHP DirectoryList::getDir怎么用?PHP DirectoryList::getDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\App\Filesystem\DirectoryList的用法示例。


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

示例1: create

 /**
  * Create ObjectManager
  *
  * @param string $rootDir
  * @param array $arguments
  * @param bool $useCompiled
  * @return \Magento\Framework\ObjectManager
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function create($rootDir, array $arguments, $useCompiled = true)
 {
     $directories = isset($arguments[Filesystem::PARAM_APP_DIRS]) ? $arguments[Filesystem::PARAM_APP_DIRS] : array();
     $directoryList = new DirectoryList($rootDir, $directories);
     (new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array($directoryList->getDir(Filesystem::GENERATION_DIR)));
     $appArguments = $this->createAppArguments($directoryList, $arguments);
     $definitionFactory = new \Magento\Framework\ObjectManager\DefinitionFactory(new \Magento\Framework\Filesystem\Driver\File(), $directoryList->getDir(Filesystem::DI_DIR), $directoryList->getDir(Filesystem::GENERATION_DIR), $appArguments->get('definition.format', 'serialized'));
     $definitions = $definitionFactory->createClassDefinition($appArguments->get('definitions'), $useCompiled);
     $relations = $definitionFactory->createRelations();
     $configClass = $this->_configClassName;
     /** @var \Magento\Framework\ObjectManager\Config\Config $diConfig */
     $diConfig = new $configClass($relations, $definitions);
     $appMode = $appArguments->get(State::PARAM_MODE, State::MODE_DEFAULT);
     $booleanUtils = new \Magento\Framework\Stdlib\BooleanUtils();
     $argInterpreter = $this->createArgumentInterpreter($booleanUtils);
     $argumentMapper = new \Magento\Framework\ObjectManager\Config\Mapper\Dom($argInterpreter);
     $configData = $this->_loadPrimaryConfig($directoryList, $argumentMapper, $appMode);
     if ($configData) {
         $diConfig->extend($configData);
     }
     $this->factory = new \Magento\Framework\ObjectManager\Factory\Factory($diConfig, null, $definitions, $appArguments->get());
     if ($appArguments->get('MAGE_PROFILER') == 2) {
         $this->factory = new \Magento\Framework\ObjectManager\Profiler\FactoryDecorator($this->factory, \Magento\Framework\ObjectManager\Profiler\Log::getInstance());
     }
     $className = $this->_locatorClassName;
     $sharedInstances = ['Magento\\Framework\\App\\Arguments' => $appArguments, 'Magento\\Framework\\App\\Filesystem\\DirectoryList' => $directoryList, 'Magento\\Framework\\Filesystem\\DirectoryList' => $directoryList, 'Magento\\Framework\\ObjectManager\\Relations' => $relations, 'Magento\\Framework\\Interception\\Definition' => $definitionFactory->createPluginDefinition(), 'Magento\\Framework\\ObjectManager\\Config' => $diConfig, 'Magento\\Framework\\ObjectManager\\Definition' => $definitions, 'Magento\\Framework\\Stdlib\\BooleanUtils' => $booleanUtils, 'Magento\\Framework\\ObjectManager\\Config\\Mapper\\Dom' => $argumentMapper, $configClass => $diConfig];
     /** @var \Magento\Framework\ObjectManager $objectManager */
     $objectManager = new $className($this->factory, $diConfig, $sharedInstances);
     $this->factory->setObjectManager($objectManager);
     ObjectManager::setInstance($objectManager);
     /** @var \Magento\Framework\App\Filesystem\DirectoryList\Verification $verification */
     $verification = $objectManager->get('Magento\\Framework\\App\\Filesystem\\DirectoryList\\Verification');
     $verification->createAndVerifyDirectories();
     $diConfig->setCache($objectManager->get('Magento\\Framework\\App\\ObjectManager\\ConfigCache'));
     $objectManager->configure($objectManager->get('Magento\\Framework\\App\\ObjectManager\\ConfigLoader')->load('global'));
     $objectManager->get('Magento\\Framework\\Config\\ScopeInterface')->setCurrentScope('global');
     $objectManager->get('Magento\\Framework\\App\\Resource')->setCache($objectManager->get('Magento\\Framework\\App\\CacheInterface'));
     $interceptionConfig = $objectManager->get('Magento\\Framework\\Interception\\Config\\Config');
     $diConfig->setInterceptionConfig($interceptionConfig);
     $this->configureDirectories($objectManager);
     return $objectManager;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:52,代码来源:ObjectManagerFactory.php

示例2: __construct

 /**
  * @param \Magento\Framework\App\Filesystem\DirectoryList $dirList
  * @param string $customFile
  */
 public function __construct(\Magento\Framework\App\Filesystem\DirectoryList $dirList, $customFile = null)
 {
     $this->_dir = $dirList->getDir(\Magento\Framework\App\Filesystem::CONFIG_DIR);
     $this->_customFile = $customFile;
 }
开发者ID:Mohitsahu123,项目名称:mtf,代码行数:9,代码来源:Loader.php


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