private function sortCommands(array $commands): array
	{
		$namespacedCommands = [];
		$globalCommands     = [];

		foreach ($commands as $name => $command)
		{
			$key = $this->extractNamespace($name, 1);

			if (!$key)
			{
				$globalCommands[self::GLOBAL_NAMESPACE][$name] = $command;
			}
			else
			{
				$namespacedCommands[$key][$name] = $command;
			}
		}

		ksort($namespacedCommands);
		$namespacedCommands = array_merge($globalCommands, $namespacedCommands);

		foreach ($namespacedCommands as &$commandsSet)
		{
			ksort($commandsSet);
		}

		// Unset reference to keep scope clear
		unset($commandsSet);

		return $namespacedCommands;
	}
private function sortCommands(array $commands): array
	{
		$namespacedCommands = [];
		$globalCommands     = [];

		foreach ($commands as $name => $command)
		{
			$key = $this->extractNamespace($name, 1);

			if (!$key)
			{
				$globalCommands[self::GLOBAL_NAMESPACE][$name] = $command;
			}
			else
			{
				$namespacedCommands[$key][$name] = $command;
			}
		}

		ksort($namespacedCommands);
		$namespacedCommands = array_merge($globalCommands, $namespacedCommands);

		foreach ($namespacedCommands as &$commandsSet)
		{
			ksort($commandsSet);
		}

		// Unset reference to keep scope clear
		unset($commandsSet);

		return $namespacedCommands;
	}
private function sortCommands ( array $ commands ) : array { $ namespacedCommands = [ ] ; $ globalCommands = [ ] ; foreach ( $ commands as $ name => $ command ) { $ key = $ this -> extractNamespace ( $ name , 1 ) ; if ( ! $ key ) { $ globalCommands [ self :: GLOBAL_NAMESPACE ] [ $ name ] = $ command ; } else { $ namespacedCommands [ $ key ] [ $ name ] = $ command ; } } ksort ( $ namespacedCommands ) ; $ namespacedCommands = array_merge ( $ globalCommands , $ namespacedCommands ) ; foreach ( $ namespacedCommands as & $ commandsSet ) { ksort ( $ commandsSet ) ; } // Unset reference to keep scope clear unset ( $ commandsSet ) ; return $ namespacedCommands ; }
Sort a set of commands.

@param   AbstractCommand[]  $commands  The commands to sort.

@return  AbstractCommand[]

@since   __DEPLOY_VERSION__
Sort a set of commands .