original_string: public function switchAction(Request $request, string $currency) : RedirectResponse
      {
          $result = $this->get('currency.repository')->findOneBy(['code' => $currency]);
          if (null !== $result) {
              $request->getSession()->set('_currency', $currency);
          }
  
          return new RedirectResponse($request->headers->get('referer'));
      }
code: public function switchAction(Request $request, string $currency) : RedirectResponse
      {
          $result = $this->get('currency.repository')->findOneBy(['code' => $currency]);
          if (null !== $result) {
              $request->getSession()->set('_currency', $currency);
          }
  
          return new RedirectResponse($request->headers->get('referer'));
      }
code_tokens: public function switchAction ( Request $ request , string $ currency ) : RedirectResponse { $ result = $ this -> get ( 'currency.repository' ) -> findOneBy ( [ 'code' => $ currency ] ) ; if ( null !== $ result ) { $ request -> getSession ( ) -> set ( '_currency' , $ currency ) ; } return new RedirectResponse ( $ request -> headers -> get ( 'referer' ) ) ; }
docstring: Sets new session currency
  
  @param Request $request
  @param string  $currency
  
  @return RedirectResponse
docstring_tokens: Sets new session currency