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


PHP Module\ModuleListInterface类代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param LoggerInterface $log
  * @param ModuleListInterface $moduleList
  * @param SetupFileResolver $fileResolver
  * @param string $moduleName
  * @param \Magento\Framework\App\Resource $resource
  * @param string $connectionName
  */
 public function __construct(LoggerInterface $log, ModuleListInterface $moduleList, SetupFileResolver $fileResolver, $moduleName, \Magento\Framework\App\Resource $resource, $connectionName = SetupInterface::DEFAULT_SETUP_CONNECTION)
 {
     parent::__construct($resource, $connectionName);
     $this->logger = $log;
     $this->fileResolver = $fileResolver;
     $this->moduleConfig = $moduleList->getOne($moduleName);
     $this->resource = new Resource($resource);
     $this->resourceName = $this->fileResolver->getResourceCode($moduleName);
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:19,代码来源:SetupModule.php

示例2: setUp

    protected function setUp()
    {
        $this->filePermissions = $this->getMock('Magento\Framework\Setup\FilePermissions', [], [], '', false);
        $this->configWriter = $this->getMock('Magento\Framework\App\DeploymentConfig\Writer', [], [], '', false);
        $this->configReader = $this->getMock('Magento\Framework\App\DeploymentConfig\Reader', [], [], '', false);
        $this->config = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);

        $this->moduleList = $this->getMockForAbstractClass('Magento\Framework\Module\ModuleListInterface');
        $this->moduleList->expects($this->any())->method('getOne')->willReturn(
            ['setup_version' => '2.0.0']
        );
        $this->moduleList->expects($this->any())->method('getNames')->willReturn(
            ['Foo_One', 'Bar_Two']
        );
        $this->moduleLoader = $this->getMock('Magento\Framework\Module\ModuleList\Loader', [], [], '', false);
        $this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false);
        $this->adminFactory = $this->getMock('Magento\Setup\Model\AdminAccountFactory', [], [], '', false);
        $this->logger = $this->getMockForAbstractClass('Magento\Framework\Setup\LoggerInterface');
        $this->random = $this->getMock('Magento\Framework\Math\Random', [], [], '', false);
        $this->connection = $this->getMockForAbstractClass('Magento\Framework\DB\Adapter\AdapterInterface');
        $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false);
        $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
        $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
        $this->contextMock = $this->getMock('Magento\Framework\Model\ResourceModel\Db\Context', [], [], '', false);
        $this->configModel = $this->getMock('Magento\Setup\Model\ConfigModel', [], [], '', false);
        $this->cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false);
        $this->dbValidator = $this->getMock('Magento\Setup\Validator\DbValidator', [], [], '', false);
        $this->setupFactory = $this->getMock('Magento\Setup\Module\SetupFactory', [], [], '', false);
        $this->dataSetupFactory = $this->getMock('Magento\Setup\Module\DataSetupFactory', [], [], '', false);
        $this->sampleDataState = $this->getMock('Magento\Framework\Setup\SampleData\State', [], [], '', false);
        $this->componentRegistrar = $this->getMock('Magento\Framework\Component\ComponentRegistrar', [], [], '', false);
        $this->phpReadinessCheck = $this->getMock('Magento\Setup\Model\PhpReadinessCheck', [], [], '', false);
        $this->object = $this->createObject();
    }
开发者ID:rafaelstz,项目名称:magento2,代码行数:34,代码来源:InstallerTest.php

示例3: testExecute

 public function testExecute()
 {
     $this->moduleList->expects($this->once())->method('getNames')->willReturn([]);
     $commandTester = new CommandTester($this->command);
     $commandTester->execute([]);
     $this->assertContains('List of active modules', $commandTester->getDisplay());
 }
开发者ID:jeremyBass,项目名称:wsumage_command,代码行数:7,代码来源:CheckActiveModulesCommandTest.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('<info>List of active modules:<info>');
     foreach ($this->moduleList->getNames() as $moduleName) {
         $output->writeln('<info>' . $moduleName . '<info>');
     }
 }
开发者ID:jeremyBass,项目名称:wsumage_command,代码行数:10,代码来源:CheckActiveModulesCommand.php

示例5: determineOmittedNamespace

 /**
  * Determine whether provided name begins from any available modules, according to namespaces priority
  * If matched, returns as the matched module "factory" name or a fully qualified module name
  *
  * @param string $name
  * @param bool $asFullModuleName
  * @return string
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function determineOmittedNamespace($name, $asFullModuleName = false)
 {
     if (null === $this->_moduleNamespaces) {
         $this->_moduleNamespaces = [];
         foreach ($this->_moduleList->getNames() as $moduleName) {
             $module = strtolower($moduleName);
             $this->_moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName;
         }
     }
     $explodeString = strpos($name, '\\') === false ? '_' : '\\';
     $name = explode($explodeString, strtolower($name));
     $partsNum = count($name);
     $defaultNamespaceFlag = false;
     foreach ($this->_moduleNamespaces as $namespaceName => $namespace) {
         // assume the namespace is omitted (default namespace only, which comes first)
         if ($defaultNamespaceFlag === false) {
             $defaultNamespaceFlag = true;
             $defaultNS = $namespaceName . '_' . $name[0];
             if (isset($namespace[$defaultNS])) {
                 return $asFullModuleName ? $namespace[$defaultNS] : $name[0];
                 // return omitted as well
             }
         }
         // assume namespace is qualified
         if (isset($name[1])) {
             $fullNS = $name[0] . '_' . $name[1];
             if (2 <= $partsNum && isset($namespace[$fullNS])) {
                 return $asFullModuleName ? $namespace[$fullNS] : $fullNS;
             }
         }
     }
     return '';
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:43,代码来源:NamespaceResolver.php

示例6: getDisabledModules

 /**
  * Retrieve all disabled modules from the configuration
  *
  * @return array
  */
 protected function getDisabledModules()
 {
     $allModules = $this->fullModuleList->getNames();
     $enabledModules = $this->moduleList->getNames();
     $disabledModules = array_diff($allModules, $enabledModules);
     return $disabledModules;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Collect.php

示例7: execute

 public function execute()
 {
     $greeting = "Hello world! I am a Magento2 extension.<br/>\n";
     $title = 'Hello World';
     $moduleNames = implode("<br/>\n", $this->moduleList->getNames());
     $body = "\n<html>\n    <head>\n        <title>{$title}</title>\n    </head>\n    <body>{$greeting}<br/>Modules Installed:<br/>{$moduleNames}</body>\n</html>";
     $this->_response->setBody($body);
 }
开发者ID:Robin-bms,项目名称:m2extension,代码行数:8,代码来源:SayHello.php

示例8: render

 /**
  * Return info block html
  * @param  \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $m = $this->moduleList->getOne($this->getModuleName());
     $html = '<div style="padding:10px;background-color:#f8f8f8;border:1px solid #ddd;margin-bottom:7px;">
         Login As Customer Extension v' . $m['setup_version'] . ' was developed by <a href="http://magefan.com/" target="_blank">MageFan</a>.
     </div>';
     return $html;
 }
开发者ID:magefan,项目名称:module-login-as-customer,代码行数:13,代码来源:Info.php

示例9: execute

 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $time = microtime(true);
     $ignoreDataUpdate = $input->getOption('ignore-data');
     $headers = array('Setup', 'Module', 'DB', 'Data', 'Status');
     if ($ignoreDataUpdate) {
         unset($headers[array_search('Data', $headers)]);
     }
     $errorCounter = 0;
     $table = array();
     foreach ($this->moduleList->getAll() as $moduleName => $moduleInfo) {
         $moduleVersion = $moduleInfo['setup_version'];
         $dbVersion = $this->resource->getDbVersion($moduleName);
         if (!$ignoreDataUpdate) {
             $dataVersion = $this->resource->getDataVersion($moduleName);
         }
         $ok = $dbVersion == $moduleVersion;
         if ($ok && !$ignoreDataUpdate) {
             $ok = $dataVersion == $moduleVersion;
         }
         if (!$ok) {
             $errorCounter++;
         }
         $row = array('Module' => $moduleName, 'DB' => $dbVersion, 'Data' => $dataVersion);
         if (!$ignoreDataUpdate) {
             $row['Data-Version'] = $dataVersion;
         }
         $row['Status'] = $ok ? 'OK' : 'Error';
         $table[] = $row;
     }
     //if there is no output format
     //highlight the status
     //and show error'd rows at bottom
     if (!$input->getOption('format')) {
         usort($table, function ($a, $b) {
             return $a['Status'] !== 'OK';
         });
         array_walk($table, function (&$row) {
             $status = $row['Status'];
             $availableStatus = array('OK' => 'info', 'Error' => 'error');
             $statusString = sprintf('<%s>%s</%s>', $availableStatus[$status], $status, $availableStatus[$status]);
             $row['Status'] = $statusString;
         });
     }
     if ($input->getOption('log-junit')) {
         $this->logJUnit($table, $input->getOption('log-junit'), microtime($time) - $time);
     } else {
         $this->getHelper('table')->setHeaders($headers)->renderByFormat($output, $table, $input->getOption('format'));
         //if no output format specified - output summary line
         if (!$input->getOption('format')) {
             if ($errorCounter > 0) {
                 $this->writeSection($output, sprintf('%s error%s %s found!', $errorCounter, $errorCounter === 1 ? '' : 's', $errorCounter === 1 ? 'was' : 'were'), 'error');
             } else {
                 $this->writeSection($output, 'No setup problems were found.', 'info');
             }
         }
     }
 }
开发者ID:brentwpeterson,项目名称:n98-magerun2,代码行数:63,代码来源:CompareVersionsCommand.php

示例10: prepareModuleNamespaces

 /**
  * Prepare module namespaces
  *
  * @return void
  */
 protected function prepareModuleNamespaces()
 {
     if (null === $this->moduleNamespaces) {
         $this->moduleNamespaces = [];
         foreach ($this->moduleList->getNames() as $moduleName) {
             $module = strtolower($moduleName);
             $this->moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName;
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:NamespaceResolver.php

示例11: getMagefanModules

 /**
  * Get Magefan Modules Info
  *
  * @return $this
  */
 protected function getMagefanModules()
 {
     $modules = array();
     foreach ($this->_moduleList->getAll() as $moduleName => $module) {
         if (strpos($moduleName, 'Magefan_') !== false && $this->_moduleManager->isEnabled($moduleName)) {
             $modules[$moduleName] = $module;
         }
     }
     return $modules;
 }
开发者ID:magefan,项目名称:module-login-as-customer,代码行数:15,代码来源:AdminNotificationFeed.php

示例12: prepareModuleList

 protected function prepareModuleList($vendor)
 {
     $this->moduleList = [];
     foreach ($this->moduleListObject->getAll() as $moduleName => $info) {
         // First index is (probably always) vendor
         $moduleNameData = explode('_', $moduleName);
         if (!is_null($vendor) && strtolower($moduleNameData[0]) !== strtolower($vendor)) {
             continue;
         }
         $this->moduleList[] = [$info['name'], $info['setup_version']];
     }
 }
开发者ID:brentwpeterson,项目名称:n98-magerun2,代码行数:12,代码来源:ListCommand.php

示例13: getModuleName

 /**
  * Retrieve fully-qualified module name, path belongs to
  *
  * @param string $path Full path to file or directory
  * @return string|null
  */
 public function getModuleName($path)
 {
     $path = str_replace('\\', '/', $path);
     foreach ($this->_moduleList->getNames() as $moduleName) {
         $moduleDir = $this->_moduleDirs->getDir($moduleName);
         $moduleDir = str_replace('\\', '/', $moduleDir);
         if ($path == $moduleDir || strpos($path, $moduleDir . '/') === 0) {
             return $moduleName;
         }
     }
     return null;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:ReverseResolver.php

示例14: toOptionArray

 /**
  * Options getter
  *
  * @return array
  */
 public function toOptionArray()
 {
     $output = [];
     $modules = $this->_moduleList->getNames();
     sort($modules);
     foreach ($modules as $k => $v) {
         if (preg_match("/Ves/", $v)) {
             $output[$k] = ['value' => $v, 'label' => $v];
         }
     }
     return $output;
 }
开发者ID:rustamveer,项目名称:magento2,代码行数:17,代码来源:VesModules.php

示例15: getObservers

 /**
  * @return array
  */
 public function getObservers()
 {
     if (!is_null($this->observers)) {
         return $this->observers;
     }
     $this->observers = [];
     foreach ($this->moduleList->getNames() as $module) {
         $parts = explode('_', $module);
         $class = 'Magento\\Tools\\SampleData\\Module\\' . $parts[1] . '\\Observer';
         if (class_exists($class)) {
             $this->observers[] = $this->objectManager->get($class);
         }
     }
     return $this->observers;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:ObserverManager.php


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