original_string: public function addSubscriberService($serviceId, $class)
      {
          $rfc = new \ReflectionClass($class);
          if (!$rfc->implementsInterface('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
              throw new \InvalidArgumentException(
                  "$class must implement Symfony\Component\EventDispatcher\EventSubscriberInterface"
              );
          }
  
          foreach ($class::getSubscribedEvents() as $eventName => $params) {
              if (is_string($params)) {
                  $this->addListenerService($eventName, array($serviceId, $params), 0);
              } elseif (is_string($params[0])) {
                  $this->addListenerService($eventName, array($serviceId, $params[0]), isset($params[1]) ? $params[1] : 0);
              } else {
                  foreach ($params as $listener) {
                      $this->addListenerService($eventName, array($serviceId, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
                  }
              }
          }
      }
code: public function addSubscriberService($serviceId, $class)
      {
          $rfc = new \ReflectionClass($class);
          if (!$rfc->implementsInterface('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
              throw new \InvalidArgumentException(
                  "$class must implement Symfony\Component\EventDispatcher\EventSubscriberInterface"
              );
          }
  
          foreach ($class::getSubscribedEvents() as $eventName => $params) {
              if (is_string($params)) {
                  $this->addListenerService($eventName, array($serviceId, $params), 0);
              } elseif (is_string($params[0])) {
                  $this->addListenerService($eventName, array($serviceId, $params[0]), isset($params[1]) ? $params[1] : 0);
              } else {
                  foreach ($params as $listener) {
                      $this->addListenerService($eventName, array($serviceId, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
                  }
              }
          }
      }
code_tokens: public function addSubscriberService ( $ serviceId , $ class ) { $ rfc = new \ ReflectionClass ( $ class ) ; if ( ! $ rfc -> implementsInterface ( 'Symfony\Component\EventDispatcher\EventSubscriberInterface' ) ) { throw new \ InvalidArgumentException ( "$class must implement Symfony\Component\EventDispatcher\EventSubscriberInterface" ) ; } foreach ( $ class :: getSubscribedEvents ( ) as $ eventName => $ params ) { if ( is_string ( $ params ) ) { $ this -> addListenerService ( $ eventName , array ( $ serviceId , $ params ) , 0 ) ; } elseif ( is_string ( $ params [ 0 ] ) ) { $ this -> addListenerService ( $ eventName , array ( $ serviceId , $ params [ 0 ] ) , isset ( $ params [ 1 ] ) ? $ params [ 1 ] : 0 ) ; } else { foreach ( $ params as $ listener ) { $ this -> addListenerService ( $ eventName , array ( $ serviceId , $ listener [ 0 ] ) , isset ( $ listener [ 1 ] ) ? $ listener [ 1 ] : 0 ) ; } } } }
docstring: Adds a service as event subscriber
  
  @param string $serviceId The service ID of the subscriber service
  @param string $class The service's class name (which must implement EventSubscriberInterface)
docstring_tokens: Adds a service as event subscriber