protected function addPlugin($index, HTML_QuickForm2_Renderer_Plugin $plugin)
    {
        $methods    = array();
        $reflection = new ReflectionObject($plugin);
        foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
            $lower = strtolower($method->getName());
            if ('HTML_QuickForm2_Renderer_Plugin' == $method->getDeclaringClass()->getName()) {
                continue;
            } elseif (isset($this->_rendererMethods[$lower])
                      || isset($this->_pluginMethods[$lower])
            ) {
                throw new HTML_QuickForm2_InvalidArgumentException(
                    'Duplicate method name: name ' . $method->getName() . ' in plugin ' .
                    get_class($plugin) . ' already taken by ' .
                    (isset($this->_rendererMethods[$lower])?
                     get_class($this->_renderer):
                     get_class($this->_plugins[$this->_pluginMethods[$lower]])
                    )
                );
            }
            $methods[$lower] = $index;
        }
        $plugin->setRenderer($this->_renderer);
        $this->_plugins[$index]  = $plugin;
        $this->_pluginMethods   += $methods;
    }