original_string: public function onKernelResponse(FilterResponseEvent $event)
      {
          if (!$event->isMasterRequest()) {
              return;
          }
  
          $request = $event->getRequest();
  
          if (!$request->hasSession()) {
              return;
          }
  
          $this->dispatcher->removeListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']);
          $this->registered = false;
          $session = $request->getSession();
  
          if ((null === $token = $this->tokenStorage->getToken()) || $this->trustResolver->isAnonymous($token)) {
              if ($request->hasPreviousSession()) {
                  $session->remove($this->sessionKey);
              }
          } else {
              $session->set($this->sessionKey, serialize($token));
  
              if (null !== $this->logger) {
                  $this->logger->debug('Stored the security token in the session.', ['key' => $this->sessionKey]);
              }
          }
      }
code: public function onKernelResponse(FilterResponseEvent $event)
      {
          if (!$event->isMasterRequest()) {
              return;
          }
  
          $request = $event->getRequest();
  
          if (!$request->hasSession()) {
              return;
          }
  
          $this->dispatcher->removeListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']);
          $this->registered = false;
          $session = $request->getSession();
  
          if ((null === $token = $this->tokenStorage->getToken()) || $this->trustResolver->isAnonymous($token)) {
              if ($request->hasPreviousSession()) {
                  $session->remove($this->sessionKey);
              }
          } else {
              $session->set($this->sessionKey, serialize($token));
  
              if (null !== $this->logger) {
                  $this->logger->debug('Stored the security token in the session.', ['key' => $this->sessionKey]);
              }
          }
      }
code_tokens: public function onKernelResponse ( FilterResponseEvent $ event ) { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ request = $ event -> getRequest ( ) ; if ( ! $ request -> hasSession ( ) ) { return ; } $ this -> dispatcher -> removeListener ( KernelEvents :: RESPONSE , [ $ this , 'onKernelResponse' ] ) ; $ this -> registered = false ; $ session = $ request -> getSession ( ) ; if ( ( null === $ token = $ this -> tokenStorage -> getToken ( ) ) || $ this -> trustResolver -> isAnonymous ( $ token ) ) { if ( $ request -> hasPreviousSession ( ) ) { $ session -> remove ( $ this -> sessionKey ) ; } } else { $ session -> set ( $ this -> sessionKey , serialize ( $ token ) ) ; if ( null !== $ this -> logger ) { $ this -> logger -> debug ( 'Stored the security token in the session.' , [ 'key' => $ this -> sessionKey ] ) ; } } }
docstring: Writes the security token into the session.
docstring_tokens: Writes the security token into the session .