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;
	}