all() public method

获取所有的指令
public all ( string $namespace = null ) : Command[]
$namespace string 命名空间
return think\console\Command[]
Example #1
0
 private function inspectConsole()
 {
     $this->commands = [];
     $this->namespaces = [];
     $all = $this->console->all($this->namespace ? $this->console->findNamespace($this->namespace) : null);
     foreach ($this->sortCommands($all) as $namespace => $commands) {
         $names = [];
         /** @var Command $command */
         foreach ($commands as $name => $command) {
             if (!$command->getName()) {
                 continue;
             }
             if ($command->getName() === $name) {
                 $this->commands[$name] = $command;
             } else {
                 $this->aliases[$name] = $command;
             }
             $names[] = $name;
         }
         $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
     }
 }