original_string: public function createRequest(Request $request, $path)
      {
          $newRequest = Request::create($this->generateUri($request, $path), 'get', [], $request->cookies->all(), [], $request->server->all());
  
          static $setSession;
  
          if (null === $setSession) {
              $setSession = \Closure::bind(function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class);
          }
          $setSession($newRequest, $request);
  
          if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) {
              $newRequest->attributes->set(Security::AUTHENTICATION_ERROR, $request->attributes->get(Security::AUTHENTICATION_ERROR));
          }
          if ($request->attributes->has(Security::ACCESS_DENIED_ERROR)) {
              $newRequest->attributes->set(Security::ACCESS_DENIED_ERROR, $request->attributes->get(Security::ACCESS_DENIED_ERROR));
          }
          if ($request->attributes->has(Security::LAST_USERNAME)) {
              $newRequest->attributes->set(Security::LAST_USERNAME, $request->attributes->get(Security::LAST_USERNAME));
          }
  
          if ($request->get('_format')) {
              $newRequest->attributes->set('_format', $request->get('_format'));
          }
          if ($request->getDefaultLocale() !== $request->getLocale()) {
              $newRequest->setLocale($request->getLocale());
          }
  
          return $newRequest;
      }
code: public function createRequest(Request $request, $path)
      {
          $newRequest = Request::create($this->generateUri($request, $path), 'get', [], $request->cookies->all(), [], $request->server->all());
  
          static $setSession;
  
          if (null === $setSession) {
              $setSession = \Closure::bind(function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class);
          }
          $setSession($newRequest, $request);
  
          if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) {
              $newRequest->attributes->set(Security::AUTHENTICATION_ERROR, $request->attributes->get(Security::AUTHENTICATION_ERROR));
          }
          if ($request->attributes->has(Security::ACCESS_DENIED_ERROR)) {
              $newRequest->attributes->set(Security::ACCESS_DENIED_ERROR, $request->attributes->get(Security::ACCESS_DENIED_ERROR));
          }
          if ($request->attributes->has(Security::LAST_USERNAME)) {
              $newRequest->attributes->set(Security::LAST_USERNAME, $request->attributes->get(Security::LAST_USERNAME));
          }
  
          if ($request->get('_format')) {
              $newRequest->attributes->set('_format', $request->get('_format'));
          }
          if ($request->getDefaultLocale() !== $request->getLocale()) {
              $newRequest->setLocale($request->getLocale());
          }
  
          return $newRequest;
      }
code_tokens: public function createRequest ( Request $ request , $ path ) { $ newRequest = Request :: create ( $ this -> generateUri ( $ request , $ path ) , 'get' , [ ] , $ request -> cookies -> all ( ) , [ ] , $ request -> server -> all ( ) ) ; static $ setSession ; if ( null === $ setSession ) { $ setSession = \ Closure :: bind ( function ( $ newRequest , $ request ) { $ newRequest -> session = $ request -> session ; } , null , Request :: class ) ; } $ setSession ( $ newRequest , $ request ) ; if ( $ request -> attributes -> has ( Security :: AUTHENTICATION_ERROR ) ) { $ newRequest -> attributes -> set ( Security :: AUTHENTICATION_ERROR , $ request -> attributes -> get ( Security :: AUTHENTICATION_ERROR ) ) ; } if ( $ request -> attributes -> has ( Security :: ACCESS_DENIED_ERROR ) ) { $ newRequest -> attributes -> set ( Security :: ACCESS_DENIED_ERROR , $ request -> attributes -> get ( Security :: ACCESS_DENIED_ERROR ) ) ; } if ( $ request -> attributes -> has ( Security :: LAST_USERNAME ) ) { $ newRequest -> attributes -> set ( Security :: LAST_USERNAME , $ request -> attributes -> get ( Security :: LAST_USERNAME ) ) ; } if ( $ request -> get ( '_format' ) ) { $ newRequest -> attributes -> set ( '_format' , $ request -> get ( '_format' ) ) ; } if ( $ request -> getDefaultLocale ( ) !== $ request -> getLocale ( ) ) { $ newRequest -> setLocale ( $ request -> getLocale ( ) ) ; } return $ newRequest ; }
docstring: Creates a Request.
  
  @param Request $request The current Request instance
  @param string  $path    A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))
  
  @return Request A Request instance
docstring_tokens: Creates a Request .