protected function getCommands(array $config)
    {
        if (!is_array($config['plugins'])) {
            throw new \RuntimeException(
                'Configuration "plugins" key must reference an array',
                self::ERR_PLUGINS_NONARRAY
            );
        }

        $plugins = array_filter(
            $config['plugins'],
            function($plugin) {
                return $plugin instanceof PluginInterface;
            }
        );
        if (count($plugins) != count($config['plugins'])) {
            throw new \RuntimeException(
                'All configuration "plugins" array values must implement \Phergie\Irc\Bot\React\PluginInterface',
                self::ERR_PLUGINS_NONPLUGINS
            );
        }

        $commands = array();
        foreach ($plugins as $plugin) {
            $events = array_keys($plugin->getSubscribedEvents());
            $commandEvents = array();
            foreach ($events as $event) {
                if (!preg_match('/^command\.(.+)\.help$/', $event, $match)) {
                    continue;
                }
                $commands[$match[1]] = true;
            }
        }

        return $this->alphabetize($commands);
    }