當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。