original_string: public static function setUserInfoWithJWT($user, $forever = false, $appId = null)
      {
          $userInfo = null;
          if ($user instanceof User) {
              $userInfo = $user->toArray();
              $userInfo['is_sys_admin'] = $user->is_sys_admin;
          }
  
          if (!empty($userInfo)) {
              $id = array_get($userInfo, 'id');
              $email = array_get($userInfo, 'email');
              $token = JWTUtilities::makeJWTByUser($id, $email, $forever);
              static::setSessionToken($token);
  
              if (!empty($appId) && !$user->is_sys_admin) {
                  static::setSessionData($appId, $id);
  
                  return true;
              } else {
                  return static::setUserInfo($userInfo);
              }
          }
  
          return false;
      }
code: public static function setUserInfoWithJWT($user, $forever = false, $appId = null)
      {
          $userInfo = null;
          if ($user instanceof User) {
              $userInfo = $user->toArray();
              $userInfo['is_sys_admin'] = $user->is_sys_admin;
          }
  
          if (!empty($userInfo)) {
              $id = array_get($userInfo, 'id');
              $email = array_get($userInfo, 'email');
              $token = JWTUtilities::makeJWTByUser($id, $email, $forever);
              static::setSessionToken($token);
  
              if (!empty($appId) && !$user->is_sys_admin) {
                  static::setSessionData($appId, $id);
  
                  return true;
              } else {
                  return static::setUserInfo($userInfo);
              }
          }
  
          return false;
      }
code_tokens: public static function setUserInfoWithJWT ( $ user , $ forever = false , $ appId = null ) { $ userInfo = null ; if ( $ user instanceof User ) { $ userInfo = $ user -> toArray ( ) ; $ userInfo [ 'is_sys_admin' ] = $ user -> is_sys_admin ; } if ( ! empty ( $ userInfo ) ) { $ id = array_get ( $ userInfo , 'id' ) ; $ email = array_get ( $ userInfo , 'email' ) ; $ token = JWTUtilities :: makeJWTByUser ( $ id , $ email , $ forever ) ; static :: setSessionToken ( $ token ) ; if ( ! empty ( $ appId ) && ! $ user -> is_sys_admin ) { static :: setSessionData ( $ appId , $ id ) ; return true ; } else { return static :: setUserInfo ( $ userInfo ) ; } } return false ; }
docstring: Sets basic info of the user in session with JWT when authenticated.
  
  @param  array|User $user
  @param bool        $forever
  @param integer     $appId
  
  @return bool
docstring_tokens: Sets basic info of the user in session with JWT when authenticated .