本文整理匯總了PHP中Zend\ModuleManager\ModuleManager::getModules方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModuleManager::getModules方法的具體用法?PHP ModuleManager::getModules怎麽用?PHP ModuleManager::getModules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\ModuleManager\ModuleManager
的用法示例。
在下文中一共展示了ModuleManager::getModules方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doPublish
/**
* Iterate over each module and publish its assets.
*
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function doPublish(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Publishing module assets</info>');
$nothing = true;
$moduleName = $input->getOption('module');
if ($moduleName) {
$moduleNames = array($moduleName);
} else {
$moduleNames = $this->modules->getModules();
}
$inflector = new CamelCaseToDash();
foreach ($moduleNames as $moduleName) {
$source = $this->getPublicPath($moduleName);
if ($source === false) {
continue;
}
$output->writeln(" - <comment>{$moduleName}</comment>");
$basename = strtolower($inflector->filter($moduleName));
$this->publisher->publish($source, $basename);
$nothing = false;
}
if ($nothing) {
$output->writeln('Nothing to publish');
}
}
示例2: createApiList
/**
* Create list of available API modules
*
* @return array
*/
public function createApiList()
{
$apigilityModules = [];
$q = preg_quote('\\');
foreach ($this->moduleManager->getModules() as $moduleName) {
$module = $this->moduleManager->getModule($moduleName);
if ($module instanceof ApigilityProviderInterface) {
$versionRegex = '#' . preg_quote($moduleName) . $q . 'V(?P<version>[^' . $q . ']+)' . $q . '#';
$versions = [];
$serviceConfigs = [];
if ($this->config['zf-rest']) {
$serviceConfigs = array_merge($serviceConfigs, $this->config['zf-rest']);
}
if ($this->config['zf-rpc']) {
$serviceConfigs = array_merge($serviceConfigs, $this->config['zf-rpc']);
}
foreach ($serviceConfigs as $serviceName => $serviceConfig) {
if (!preg_match($versionRegex, $serviceName, $matches)) {
continue;
}
$version = $matches['version'];
if (!in_array($version, $versions)) {
$versions[] = $version;
}
}
$apigilityModules[] = ['name' => $moduleName, 'versions' => $versions];
}
}
return $apigilityModules;
}
示例3: isModuleLoaded
/**
* Is module loaded
*
* @param string $module
* @return bool
*/
protected function isModuleLoaded($module)
{
return in_array($module, $this->moduleManager->getModules());
}