original_string: private function generateLogoutUrl($key, $referenceType)
      {
          list($logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager) = $this->getListener($key);
  
          if (null === $logoutPath) {
              throw new \LogicException('Unable to generate the logout URL without a path.');
          }
  
          $parameters = null !== $csrfTokenManager ? [$csrfParameter => (string) $csrfTokenManager->getToken($csrfTokenId)] : [];
  
          if ('/' === $logoutPath[0]) {
              if (!$this->requestStack) {
                  throw new \LogicException('Unable to generate the logout URL without a RequestStack.');
              }
  
              $request = $this->requestStack->getCurrentRequest();
  
              $url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;
  
              if (!empty($parameters)) {
                  $url .= '?'.http_build_query($parameters, '', '&');
              }
          } else {
              if (!$this->router) {
                  throw new \LogicException('Unable to generate the logout URL without a Router.');
              }
  
              $url = $this->router->generate($logoutPath, $parameters, $referenceType);
          }
  
          return $url;
      }
code: private function generateLogoutUrl($key, $referenceType)
      {
          list($logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager) = $this->getListener($key);
  
          if (null === $logoutPath) {
              throw new \LogicException('Unable to generate the logout URL without a path.');
          }
  
          $parameters = null !== $csrfTokenManager ? [$csrfParameter => (string) $csrfTokenManager->getToken($csrfTokenId)] : [];
  
          if ('/' === $logoutPath[0]) {
              if (!$this->requestStack) {
                  throw new \LogicException('Unable to generate the logout URL without a RequestStack.');
              }
  
              $request = $this->requestStack->getCurrentRequest();
  
              $url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;
  
              if (!empty($parameters)) {
                  $url .= '?'.http_build_query($parameters, '', '&');
              }
          } else {
              if (!$this->router) {
                  throw new \LogicException('Unable to generate the logout URL without a Router.');
              }
  
              $url = $this->router->generate($logoutPath, $parameters, $referenceType);
          }
  
          return $url;
      }
code_tokens: private function generateLogoutUrl ( $ key , $ referenceType ) { list ( $ logoutPath , $ csrfTokenId , $ csrfParameter , $ csrfTokenManager ) = $ this -> getListener ( $ key ) ; if ( null === $ logoutPath ) { throw new \ LogicException ( 'Unable to generate the logout URL without a path.' ) ; } $ parameters = null !== $ csrfTokenManager ? [ $ csrfParameter => ( string ) $ csrfTokenManager -> getToken ( $ csrfTokenId ) ] : [ ] ; if ( '/' === $ logoutPath [ 0 ] ) { if ( ! $ this -> requestStack ) { throw new \ LogicException ( 'Unable to generate the logout URL without a RequestStack.' ) ; } $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ url = UrlGeneratorInterface :: ABSOLUTE_URL === $ referenceType ? $ request -> getUriForPath ( $ logoutPath ) : $ request -> getBaseUrl ( ) . $ logoutPath ; if ( ! empty ( $ parameters ) ) { $ url .= '?' . http_build_query ( $ parameters , '' , '&' ) ; } } else { if ( ! $ this -> router ) { throw new \ LogicException ( 'Unable to generate the logout URL without a Router.' ) ; } $ url = $ this -> router -> generate ( $ logoutPath , $ parameters , $ referenceType ) ; } return $ url ; }
docstring: Generates the logout URL for the firewall.
  
  @param string|null $key           The firewall key or null to use the current firewall key
  @param int         $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
  
  @return string The logout URL
docstring_tokens: Generates the logout URL for the firewall .