Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Application.php

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\Console

Code

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))));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal