original_string: public function add($object){
  
          if(is_array($object)) {
              $this->responses = array_merge($this->responses, $object);
          } else {
              $implementedInterfaces = class_implements($object);
  
              if(array_key_exists("WasabiLib\Ajax\ResponseConfiguratorInterface", $implementedInterfaces)) {
                  $object->configure();
  //                $this->responses = array_merge($this->responses, $object->getResponseTypes());
                  foreach($object->getResponseTypes() as $responseType){
                      $implementedInterfacesInResponseType = class_implements($responseType);
  
                      if(array_key_exists("WasabiLib\Ajax\ResponseConfiguratorInterface", $implementedInterfacesInResponseType)) {
                          $this->add($responseType);
                      }
                      else{
                          $this->responses[]=$responseType;
                      }
                  }
              } else if(array_key_exists("WasabiLib\Ajax\ResponseTypeInterface", $implementedInterfaces)) {
                  $this->responses[] = $object;
              } else {
                  throw new InvalidArgumentException("Invalid parameter type! Given value must be an array or implements the interfaces ResponseConfiguratorInterface or ResponseTypeInterface");
              }
          }
      }
code: public function add($object){
  
          if(is_array($object)) {
              $this->responses = array_merge($this->responses, $object);
          } else {
              $implementedInterfaces = class_implements($object);
  
              if(array_key_exists("WasabiLib\Ajax\ResponseConfiguratorInterface", $implementedInterfaces)) {
                  $object->configure();
  //                $this->responses = array_merge($this->responses, $object->getResponseTypes());
                  foreach($object->getResponseTypes() as $responseType){
                      $implementedInterfacesInResponseType = class_implements($responseType);
  
                      if(array_key_exists("WasabiLib\Ajax\ResponseConfiguratorInterface", $implementedInterfacesInResponseType)) {
                          $this->add($responseType);
                      }
                      else{
                          $this->responses[]=$responseType;
                      }
                  }
              } else if(array_key_exists("WasabiLib\Ajax\ResponseTypeInterface", $implementedInterfaces)) {
                  $this->responses[] = $object;
              } else {
                  throw new InvalidArgumentException("Invalid parameter type! Given value must be an array or implements the interfaces ResponseConfiguratorInterface or ResponseTypeInterface");
              }
          }
      }
code_tokens: public function add ( $ object ) { if ( is_array ( $ object ) ) { $ this -> responses = array_merge ( $ this -> responses , $ object ) ; } else { $ implementedInterfaces = class_implements ( $ object ) ; if ( array_key_exists ( "WasabiLib\Ajax\ResponseConfiguratorInterface" , $ implementedInterfaces ) ) { $ object -> configure ( ) ; //                $this->responses = array_merge($this->responses, $object->getResponseTypes()); foreach ( $ object -> getResponseTypes ( ) as $ responseType ) { $ implementedInterfacesInResponseType = class_implements ( $ responseType ) ; if ( array_key_exists ( "WasabiLib\Ajax\ResponseConfiguratorInterface" , $ implementedInterfacesInResponseType ) ) { $ this -> add ( $ responseType ) ; } else { $ this -> responses [ ] = $ responseType ; } } } else if ( array_key_exists ( "WasabiLib\Ajax\ResponseTypeInterface" , $ implementedInterfaces ) ) { $ this -> responses [ ] = $ object ; } else { throw new InvalidArgumentException ( "Invalid parameter type! Given value must be an array or implements the interfaces ResponseConfiguratorInterface or ResponseTypeInterface" ) ; } } }
docstring: Adds an object which implements the interfaces ResponseTypeInterface or ResponseConfiguratorInterface or an
  array of objects which implement the ResponseTypeInterface.
  @param $object array | ResponseConfiguratorInterface | ResponseTypeInterface
  @throws \Zend\Code\Exception\InvalidArgumentException
docstring_tokens: Adds an object which implements the interfaces ResponseTypeInterface or ResponseConfiguratorInterface or an array of objects which implement the ResponseTypeInterface .