extractNamespace() public method

返回命名空间部分
public extractNamespace ( string $name, string $limit = null ) : string
$name string 指令
$limit string 部分的命名空间的最大数量
return string
Ejemplo n.º 1
0
 /**
  * @param array $commands
  * @return array
  */
 private function sortCommands(array $commands)
 {
     $namespacedCommands = [];
     foreach ($commands as $name => $command) {
         $key = $this->console->extractNamespace($name, 1);
         if (!$key) {
             $key = '_global';
         }
         $namespacedCommands[$key][$name] = $command;
     }
     ksort($namespacedCommands);
     foreach ($namespacedCommands as &$commandsSet) {
         ksort($commandsSet);
     }
     // unset reference to keep scope clear
     unset($commandsSet);
     return $namespacedCommands;
 }