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


PHP ComponentRegistrar::getPaths方法代码示例

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


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

示例1: _getFiles

 /**
  * @return \RegexIterator
  */
 protected function _getFiles()
 {
     $filesCollector = new FilesCollector();
     $componentRegistrar = new ComponentRegistrar();
     $paths = array_merge($componentRegistrar->getPaths(ComponentRegistrar::MODULE), $componentRegistrar->getPaths(ComponentRegistrar::LIBRARY));
     return $filesCollector->getFiles($paths, '/\\.(php|phtml)$/');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:AbstractTestCase.php

示例2: testGetPathsForModule

 public function testGetPathsForModule()
 {
     ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_one", "some/path/name/one");
     ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_two", "some/path/name/two");
     $expected = ['test_module_one' => "some/path/name/one", 'test_module_two' => "some/path/name/two"];
     $this->assertContains($expected['test_module_one'], $this->object->getPaths(ComponentRegistrar::MODULE));
     $this->assertContains($expected['test_module_two'], $this->object->getPaths(ComponentRegistrar::MODULE));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:8,代码来源:ComponentRegistrarTest.php

示例3: __construct

 /**
  * Class constructor
  *
  * @param \Magento\Framework\Filesystem $filesystem
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface
  * @param ComponentRegistrar $componentRegistrar
  * @param string|null $scope
  */
 public function __construct(\Magento\Framework\Filesystem $filesystem, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, ComponentRegistrar $componentRegistrar, $scope = null)
 {
     $this->_filesystem = $filesystem;
     $this->_isAllowSymlinks = $scopeConfigInterface->getValue(self::XML_PATH_TEMPLATE_ALLOW_SYMLINK, $scope);
     $this->_themesDir = $componentRegistrar->getPaths(ComponentRegistrar::THEME);
     $this->moduleDirs = $componentRegistrar->getPaths(ComponentRegistrar::MODULE);
     $this->_compiledDir = $this->_filesystem->getDirectoryRead(DirectoryList::TEMPLATE_MINIFICATION_DIR)->getAbsolutePath();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Validator.php

示例4: getComponentName

 /**
  * Try to get component name by path, return false if not found
  *
  * @param string $componentType
  * @param string $path
  * @return bool|string
  */
 private function getComponentName($componentType, $path)
 {
     foreach ($this->componentRegistrar->getPaths($componentType) as $componentName => $componentDir) {
         $componentDir .= '/';
         if (strpos($path, $componentDir) !== false) {
             return $componentName;
         }
     }
     return false;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:17,代码来源:Context.php

示例5: getSuggestsFromModules

 /**
  * Retrieve suggested sample data packages from modules composer.json
  *
  * @return array
  */
 protected function getSuggestsFromModules()
 {
     $suggests = [];
     foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) {
         $file = $moduleDir . '/composer.json';
         /** @var Package $package */
         $package = $this->getModuleComposerPackage($file);
         $suggest = json_decode(json_encode($package->get('suggest')), true);
         if (!empty($suggest)) {
             $suggests += $suggest;
         }
     }
     return $suggests;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:Dependency.php

示例6: setUp

 public function setUp()
 {
     $componentRegistrar = new ComponentRegistrar();
     $dirSearch = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\Component\\DirSearch');
     $themePackageList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\Theme\\ThemePackageList');
     $this->model = new Files($componentRegistrar, $dirSearch, $themePackageList);
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) {
         $this->moduleTests[] = '#' . $moduleDir . '/Test#';
     }
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::LIBRARY) as $libraryDir) {
         $this->libTests[] = '#' . $libraryDir . '/Test#';
         $this->frameworkTests[] = '#' . $libraryDir . '/[\\w]+/Test#';
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:FilesTest.php

示例7: initializeMap

 /**
  * Initialize package name to full theme path map
  *
  * @return void
  * @throws \Zend_Json_Exception
  */
 private function initializeMap()
 {
     $themePaths = $this->componentRegistrar->getPaths(ComponentRegistrar::THEME);
     /** @var \Magento\Theme\Model\Theme $theme */
     foreach ($themePaths as $fullThemePath => $themeDir) {
         $themeDirRead = $this->readDirFactory->create($themeDir);
         if ($themeDirRead->isExist('composer.json')) {
             $rawData = \Zend_Json::decode($themeDirRead->readFile('composer.json'));
             if (isset($rawData['name'])) {
                 $this->packageNameToFullPathMap[$rawData['name']] = $fullThemePath;
             }
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:ThemePackageInfo.php

示例8: getLocalePlacePath

 /**
  * @return array
  */
 public function getLocalePlacePath()
 {
     $pathToSource = BP;
     $places = [];
     $componentRegistrar = new ComponentRegistrar();
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $modulePath) {
         $places[basename($modulePath)] = ['placePath' => $modulePath];
     }
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::THEME) as $themePath) {
         $placeName = basename(dirname(dirname($themePath))) . '_' . basename($themePath);
         $places[$placeName] = ['placePath' => $themePath];
     }
     $places['lib_web'] = ['placePath' => "{$pathToSource}/lib/web"];
     return $places;
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:18,代码来源:TranslationFiles.php

示例9: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $componentRegistrar = new ComponentRegistrar();
     /** @var \Magento\Framework\Filesystem $filesystem */
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) {
         $key = $moduleDir . '/';
         $value = $key . 'Test/Unit/';
         self::$_cleanableFolders[$key] = [$value];
     }
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::LIBRARY) as $libraryDir) {
         $key = $libraryDir . '/';
         $valueRootFolder = $key . '/Test/Unit/';
         $valueSubFolder = $key . '/*/Test/Unit/';
         self::$_cleanableFolders[$key] = [$valueSubFolder, $valueRootFolder];
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:StaticProperties.php

示例10: testLocalXmlFilesAbsent

 public function testLocalXmlFilesAbsent()
 {
     $componentRegistrar = new ComponentRegistrar();
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::THEME) as $themeDir) {
         $this->assertEmpty(glob($themeDir . '/local.xml'));
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:7,代码来源:ObsoleteThemeLocalXmlTest.php

示例11: testRouteConfigsValidation

 public function testRouteConfigsValidation()
 {
     $invalidFiles = [];
     $componentRegistrar = new ComponentRegistrar();
     $files = [];
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) {
         $mask = $moduleDir . '/etc/*/routes.xml';
         $files = array_merge($files, glob($mask));
     }
     $mergedConfig = new \Magento\Framework\Config\Dom('<config></config>', $this->_idAttributes);
     foreach ($files as $file) {
         $content = file_get_contents($file);
         try {
             new \Magento\Framework\Config\Dom($content, $this->_idAttributes, null, $this->schemaFile);
             //merge won't be performed if file is invalid because of exception thrown
             $mergedConfig->merge($content);
         } catch (\Magento\Framework\Config\Dom\ValidationException $e) {
             $invalidFiles[] = $file;
         }
     }
     if (!empty($invalidFiles)) {
         $this->fail('Found broken files: ' . implode("\n", $invalidFiles));
     }
     try {
         $errors = [];
         $mergedConfig->validate($this->mergedSchemaFile, $errors);
     } catch (\Exception $e) {
         $this->fail('Merged routes config is invalid: ' . "\n" . implode("\n", $errors));
     }
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:30,代码来源:RouteConfigFilesTest.php

示例12: testCheckDependencies

 public function testCheckDependencies()
 {
     $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
     $invoker(function ($file) {
         $componentRegistrar = new ComponentRegistrar();
         $fileReflection = new FileReflection($file);
         $tokens = new Tokens($fileReflection->getContents(), new ParserFactory());
         $tokens->parseContent();
         $dependencies = array_merge((new Injectable())->getDependencies($fileReflection), $tokens->getDependencies());
         $pattern = '#^(\\\\|)' . implode('|', $this->getForbiddenNamespaces()) . '\\\\#';
         foreach ($dependencies as $dependency) {
             $dependencyPaths = explode('/', $dependency);
             $dependencyPaths = array_slice($dependencyPaths, 2);
             $dependency = implode('\\', $dependencyPaths);
             $libraryPaths = $componentRegistrar->getPaths(ComponentRegistrar::LIBRARY);
             foreach ($libraryPaths as $libraryPath) {
                 $filePath = str_replace('\\', '/', $libraryPath . '/' . $dependency . '.php');
                 if (preg_match($pattern, $dependency) && !file_exists($filePath)) {
                     $this->errors[$fileReflection->getFileName()][] = $dependency;
                 }
             }
         }
         if (!empty($this->errors)) {
             $this->fail($this->getFailMessage());
         }
     }, $this->libraryDataProvider());
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:27,代码来源:DependencyTest.php

示例13: testCircularDependencies

 /**
  * Test circular dependencies between languages
  */
 public function testCircularDependencies()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $componentRegistrar = new ComponentRegistrar();
     $declaredLanguages = $componentRegistrar->getPaths(ComponentRegistrar::LANGUAGE);
     $validationStateMock = $this->getMock('\\Magento\\Framework\\Config\\ValidationStateInterface', [], [], '', false);
     $validationStateMock->method('isValidationRequired')->willReturn(true);
     $domFactoryMock = $this->getMock('Magento\\Framework\\Config\\DomFactory', [], [], '', false);
     $domFactoryMock->expects($this->any())->method('createDom')->willReturnCallback(function ($arguments) use($validationStateMock) {
         return new \Magento\Framework\Config\Dom($arguments['xml'], $validationStateMock, [], null, $arguments['schemaFile']);
     });
     $packs = [];
     foreach ($declaredLanguages as $language) {
         $languageConfig = $objectManager->getObject('Magento\\Framework\\App\\Language\\Config', ['source' => file_get_contents($language . '/language.xml'), 'domFactory' => $domFactoryMock]);
         $this->packs[$languageConfig->getVendor()][$languageConfig->getPackage()] = $languageConfig;
         $packs[] = $languageConfig;
     }
     /** @var $languageConfig Config */
     foreach ($packs as $languageConfig) {
         $languages = [];
         /** @var $config Config */
         foreach ($this->collectCircularInheritance($languageConfig) as $config) {
             $languages[] = $config->getVendor() . '/' . $config->getPackage();
         }
         if (!empty($languages)) {
             $this->fail("Circular dependency detected:\n" . implode(' -> ', $languages));
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:CircularDependencyTest.php

示例14: getComponentDirectories

 /**
  * Get the given type component directories
  *
  * @param string $componentType
  * @return array
  */
 private function getComponentDirectories($componentType)
 {
     $dirs = [];
     foreach ($this->componentRegistrar->getPaths($componentType) as $componentDir) {
         $dirs[] = $componentDir . '/';
     }
     return $dirs;
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:14,代码来源:Resolver.php

示例15: getXmlFiles

 public function getXmlFiles()
 {
     $componentRegistrar = new ComponentRegistrar();
     $codeXml = [];
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $modulePath) {
         $codeXml = array_merge($codeXml, $this->_getFiles($modulePath, '*.xml', '/.\\/Test\\/Unit\\/./'));
     }
     $this->_filterSpecialCases($codeXml);
     $designXml = [];
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::THEME) as $themePath) {
         $designXml = array_merge($designXml, $this->_getFiles($themePath, '*.xml'));
     }
     $libXml = [];
     foreach ($componentRegistrar->getPaths(ComponentRegistrar::LIBRARY) as $libraryPath) {
         $libXml = array_merge($libXml, $this->_getFiles($libraryPath, '*.xml', '/.\\/Test\\/./'));
     }
     return $this->_dataSet(array_merge($codeXml, $designXml, $libXml));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:18,代码来源:SchemaTest.php


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