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

        $filtered = array_filter(
            $config['plugins'],
            function($plugin) {
                return !$plugin instanceof PluginInterface;
            }
        );
        if ($filtered) {
            throw new \RuntimeException(
                'Configuration "plugins" key must contain only objects'
                    . ' implementing \Phergie\Irc\Bot\React\PluginInterface',
                self::ERR_PLUGINS_NONPLUGINS
            );
        }

        return $config['plugins'];
    }