Symfony\Component\Console\Application::all PHP Method

all() public method

The array keys are the full names and the values the command instances.
public all ( string $namespace = null ) : Command[]
$namespace string A namespace name
return Symfony\Component\Console\Command\Command[] An array of Command instances
    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;
    }

Usage Example

 /**
  * Get list commands to array strings
  * 
  * @return array
  */
 protected function getListCommands()
 {
     $commands = $this->application->all();
     $commandsArray = array();
     foreach ($commands as $command) {
         $commandsArray[] = array('class' => get_class($command), 'name' => $command->getName());
     }
     return $commandsArray;
 }
All Usage Examples Of Symfony\Component\Console\Application::all