original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Adds a plugin for the current renderer instance
  
  Plugin's methods are imported and can be later called as this object's own
  
  @param    HTML_QuickForm2_Renderer_Plugin     a plugin instance
  @throws   HTML_QuickForm2_InvalidArgumentException if a plugin has already
  imported name
docstring_tokens: Adds a plugin for the current renderer instance