original_string: public function createRedirectResponse(Request $request, $path, $status = 302)
      {
          if (null !== $this->secureDomainRegexp && 'https' === $this->urlMatcher->getContext()->getScheme() && preg_match('#^https?:[/\\\\]{2,}+[^/]++#i', $path, $host) && !preg_match(sprintf($this->secureDomainRegexp, preg_quote($request->getHttpHost())), $host[0])) {
              $path = '/';
          }
          if (null !== $this->domainRegexp && preg_match('#^https?:[/\\\\]{2,}+[^/]++#i', $path, $host) && !preg_match(sprintf($this->domainRegexp, preg_quote($request->getHttpHost())), $host[0])) {
              $path = '/';
          }
  
          return new RedirectResponse($this->generateUri($request, $path), $status);
      }
code: public function createRedirectResponse(Request $request, $path, $status = 302)
      {
          if (null !== $this->secureDomainRegexp && 'https' === $this->urlMatcher->getContext()->getScheme() && preg_match('#^https?:[/\\\\]{2,}+[^/]++#i', $path, $host) && !preg_match(sprintf($this->secureDomainRegexp, preg_quote($request->getHttpHost())), $host[0])) {
              $path = '/';
          }
          if (null !== $this->domainRegexp && preg_match('#^https?:[/\\\\]{2,}+[^/]++#i', $path, $host) && !preg_match(sprintf($this->domainRegexp, preg_quote($request->getHttpHost())), $host[0])) {
              $path = '/';
          }
  
          return new RedirectResponse($this->generateUri($request, $path), $status);
      }
code_tokens: public function createRedirectResponse ( Request $ request , $ path , $ status = 302 ) { if ( null !== $ this -> secureDomainRegexp && 'https' === $ this -> urlMatcher -> getContext ( ) -> getScheme ( ) && preg_match ( '#^https?:[/\\\\]{2,}+[^/]++#i' , $ path , $ host ) && ! preg_match ( sprintf ( $ this -> secureDomainRegexp , preg_quote ( $ request -> getHttpHost ( ) ) ) , $ host [ 0 ] ) ) { $ path = '/' ; } if ( null !== $ this -> domainRegexp && preg_match ( '#^https?:[/\\\\]{2,}+[^/]++#i' , $ path , $ host ) && ! preg_match ( sprintf ( $ this -> domainRegexp , preg_quote ( $ request -> getHttpHost ( ) ) ) , $ host [ 0 ] ) ) { $ path = '/' ; } return new RedirectResponse ( $ this -> generateUri ( $ request , $ path ) , $ status ) ; }
docstring: Creates a redirect Response.
  
  @param Request $request A Request instance
  @param string  $path    A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))
  @param int     $status  The status code
  
  @return RedirectResponse A RedirectResponse instance
docstring_tokens: Creates a redirect Response .