function Application::getNamespaces
Returns an array of all unique namespaces used by currently registered commands.
It does not return the global namespace which always exists.
Return value
string[]
1 call to Application::getNamespaces()
- Application::findNamespace in vendor/
symfony/ console/ Application.php - Finds a registered namespace by a name or an abbreviation.
File
-
vendor/
symfony/ console/ Application.php, line 618
Class
- Application
- An Application is the container for a collection of commands.
Namespace
Symfony\Component\ConsoleCode
public function getNamespaces() : array {
$namespaces = [];
foreach ($this->all() as $command) {
if ($command->isHidden()) {
continue;
}
$namespaces[] = $this->extractAllNamespaces($command->getName());
foreach ($command->getAliases() as $alias) {
$namespaces[] = $this->extractAllNamespaces($alias);
}
}
return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
}