If the collection contains no root module, null is returned.
public getRootModuleName ( ) : string | null | ||
Résultat | string | null | The root module name or `null` if none exists. |
/** * Handles the "bind --delete" command. * * @param Args $args The console arguments * * @return int The status code */ public function handleDelete(Args $args) { $bindingToRemove = $this->getBindingByUuidPrefix($args->getArgument('uuid')); if (!$bindingToRemove->getContainingModule() instanceof RootModule) { throw new RuntimeException(sprintf('Can only delete bindings from the module "%s".', $this->modules->getRootModuleName())); } $this->discoveryManager->removeRootBindingDescriptor($bindingToRemove->getUuid()); return 0; }
/** * Handles the "puli map --delete" command. * * @param Args $args The console arguments * * @return int The status code */ public function handleDelete(Args $args) { $repositoryPath = Path::makeAbsolute($args->getArgument('path'), $this->currentPath); if (!$this->repoManager->hasRootPathMapping($repositoryPath)) { throw new RuntimeException(sprintf('The path "%s" is not mapped in the module "%s".', $repositoryPath, $this->modules->getRootModuleName())); } $this->repoManager->removeRootPathMapping($repositoryPath); return 0; }
/** * Handles the "puli type --delete" command. * * @param Args $args The console arguments * * @return int The status code */ public function handleDelete(Args $args) { $typeName = $args->getArgument('name'); if (!$this->discoveryManager->hasRootTypeDescriptor($typeName)) { throw new RuntimeException(sprintf('The type "%s" does not exist in the module "%s".', $typeName, $this->modules->getRootModuleName())); } $this->discoveryManager->removeRootTypeDescriptor($typeName); return 0; }
/** * Returns the modules selected in the console arguments. * * @param Args $args The console arguments * @param ModuleList $modules The available modules * * @return string[] The module names */ public static function getModuleNames(Args $args, ModuleList $modules) { // Display all modules if "all" is set if ($args->isOptionSet('all')) { return $modules->getModuleNames(); } $moduleNames = array(); if ($args->isOptionSet('root')) { $moduleNames[] = $modules->getRootModuleName(); } foreach ($args->getOption('module') as $moduleName) { $moduleNames[] = $moduleName; } return $moduleNames ?: $modules->getModuleNames(); }