You are here

public function Application::getNamespaces in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::getNamespaces()

Returns an array of all unique namespaces used by currently registered commands.

It does not returns the global namespace which always exists.

Return value

array An array of namespaces

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 423

Class

Application
An Application is the container for a collection of commands.

Namespace

Symfony\Component\Console

Code

public function getNamespaces() {
  $namespaces = array();
  foreach ($this->commands as $command) {
    $namespaces = array_merge($namespaces, $this
      ->extractAllNamespaces($command
      ->getName()));
    foreach ($command
      ->getAliases() as $alias) {
      $namespaces = array_merge($namespaces, $this
        ->extractAllNamespaces($alias));
    }
  }
  return array_values(array_unique(array_filter($namespaces)));
}