Get the current logged user or null
163327
function getUserFromPHPSession() {
		if ($this->user == null) {
            $sid = $this->request->session('usersid', '');
            if ($sid == '') {
                // try with a get key
                $sid = $this->request->get('sessionid', '');
            }
			$this->user = $this->getUserFromSession($sid);
		}
        return $this->user;
    }
866468
public Long getLoggedUserId() {
    HttpSession session = getRequest().getSession(false);
    return session == null ? null : (Long) session.getAttribute("loggedUserId");
  }
1077276
def get_current_user(custom_headers:nil)
      response = get_current_user_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
802628
def currentUser(extras=nil)
      method = 'currentUser'
      type = User
      args = {}
      args[:extras] = extras if extras
      return_object type,method,args,true
    end
448675
public static function blame()
    {
        if (Yii::$app instanceof Application && !Podium::getInstance()->user->isGuest) {
            return User::loggedId();
        }
        return null;
    }
387449
@Nullable
  public StitchUserT getUser() {
    authLock.readLock().lock();
    try {
      return activeUser;
    } finally {
      authLock.readLock().unlock();
    }
  }
730332
public function getLoggedUser()
    {
        // Mini cache mechanism to avoid serving a new object each time the function is called.
        if ($this->loggedUser) {
            if ($this->getUserId() == $this->loggedUser->getId()) {
                return $this->loggedUser;
            }
        }
        $this->loggedUser = new UserWrapper(wp_get_current_user());

        return $this->loggedUser;
    }
560882
public static @Nullable @CheckForNull String getCurrentUsername() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication == null) {
      return null;
    }
    return getUsername(authentication);
  }
469558
function checkUser( &$siteBasics, $uri )
    {
        $http = eZHTTPTool::instance();
        $check = array( "module" => "user",
                        "function" => "login" );
        if ( eZSession::issetkey( 'eZUserLoggedInID', false ) &&
             $http->sessionVariable( "eZUserLoggedInID" ) != '' &&
             $http->sessionVariable( "eZUserLoggedInID" ) != self::anonymousId() )
        {
            $currentUser = eZUser::currentUser();
            if ( !$currentUser->isEnabled() )
            {
                eZUser::logoutCurrent();
                $currentUser = eZUser::currentUser();
            }
            else
            {
                return null;
            }
        }

        $ini        = eZINI::instance();
        $moduleName = $uri->element();
        $viewName   = $uri->element( 1 );
        $anonymousAccessList = $ini->variable( "SiteAccessSettings", "AnonymousAccessList" );
        foreach ( $anonymousAccessList as $anonymousAccess )
        {
            $elements = explode( '/', $anonymousAccess );
            if ( !isset( $elements[1] ) )
            {
                if ( $moduleName == $elements[0] )
                {
                    return null;
                }
            }
            else
            {
                if ( $moduleName == $elements[0] and
                     $viewName == $elements[1] )
                {
                    return null;
                }
            }
        }

        return $check;
    }
1045355
public function getUser() {
    if ($this->user !== null) {
      // we've already determined this and cached the value.
      return $this->user;
    }

    return $this->user = $this->getUserFromAvailableData();
  }
1063369
protected function getLoggedUser()
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (is_string($user)) {
            $user = null;
        }

        return $user;
    }
267854
def _current_user_manager(self, session=None):
        """"""
        if session is None:
            session = db.session()

        try:
            user = g.user
        except Exception:
            return session.query(User).get(0)

        if sa.orm.object_session(user) is not session:
            # this can happen when called from a celery task during development
            # (with CELERY_ALWAYS_EAGER=True): the task SA session is not
            # app.db.session, and we should not attach this object to
            # the other session, because it can make weird, hard-to-debug
            # errors related to session.identity_map.
            return session.query(User).get(user.id)
        else:
            return user
714458
@CheckReturnValue(when = When.NEVER)
  public boolean isLoggedIn() {
    authLock.readLock().lock();
    try {
      return activeUser != null && activeUser.isLoggedIn();
    } finally {
      authLock.readLock().unlock();
    }
  }
317468
static function current()
    {
        $current = false;

        if (is_user_logged_in()) {
            $current = new static();
            $user = wp_get_current_user();

            // $current->wp_user = $user;
            
            foreach($user->data as $name => $value) {
                $current->$name = $value;
            }   
        }

        return $current;
    }
712414
protected function getCurrentUser()
    {
        if ($this->tokenStorage && ($token = $this->tokenStorage->getToken())) {
            $user = $token->getUser();

            if ($user instanceof UserInterface) {
                return $user;
            }
        }

        return;
    }
320204
private function getUser()
    {
        if (function_exists('auth') && auth()->check()) {
            return auth()->user()->toArray();
        }

        if (class_exists(\Cartalyst\Sentinel\Sentinel::class) && $user = Sentinel::check()) {
            return $user->toArray();
        }

        return null;
    }
459451
function getCurrentUser() {
    var fields = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        fields[_i - 0] = arguments[_i];
    }
    return getCurrentServer().user;
}