You are here

public function Application::all in Zircon Profile 8.0

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

Gets the commands (registered in the given namespace if provided).

The array keys are the full names and the values the command instances.

Parameters

string $namespace A namespace name:

Return value

Command[] An array of Command instances

File

vendor/symfony/console/Application.php, line 543

Class

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

Namespace

Symfony\Component\Console

Code

public function all($namespace = null) {
  if (null === $namespace) {
    return $this->commands;
  }
  $commands = array();
  foreach ($this->commands as $name => $command) {
    if ($namespace === $this
      ->extractNamespace($name, substr_count($namespace, ':') + 1)) {
      $commands[$name] = $command;
    }
  }
  return $commands;
}