original_string: public function setRequestUser (Request $request)
      {
          $request->addUserCallback ('accounts', function (Request $request) {
  
              $userid = $request->getSession ()->get ('catlab-user-id');
  
              if ($userid)
              {
                  $user = MapperFactory::getUserMapper ()->getFromId ($userid);
                  if ($user)
                      return $user;
              }
  
              return null;
          });
      }
code: public function setRequestUser (Request $request)
      {
          $request->addUserCallback ('accounts', function (Request $request) {
  
              $userid = $request->getSession ()->get ('catlab-user-id');
  
              if ($userid)
              {
                  $user = MapperFactory::getUserMapper ()->getFromId ($userid);
                  if ($user)
                      return $user;
              }
  
              return null;
          });
      }
code_tokens: public function setRequestUser ( Request $ request ) { $ request -> addUserCallback ( 'accounts' , function ( Request $ request ) { $ userid = $ request -> getSession ( ) -> get ( 'catlab-user-id' ) ; if ( $ userid ) { $ user = MapperFactory :: getUserMapper ( ) -> getFromId ( $ userid ) ; if ( $ user ) return $ user ; } return null ; } ) ; }
docstring: Set user from session
  @param Request $request
  @throws \Neuron\Exceptions\InvalidParameter
docstring_tokens: Set user from session