Get the current user.

@return UserInterface|null Returns the current user in case of success, null otherwise.
554979
public function getUser() {
        $token = null;
        if (null === $this->user) {
            $token = $this->getTokenStorage()->getToken();
        }
        if (null !== $token) {
            $this->user = $token->getUser();
        }
        if (true === ($this->user instanceof UserInterface)) {
            return $this->user;
        }
        return null;
    }
980775
public function getUser()
    {
        if (null !== $this->user) {
            return $this->user;
        }

        $this->parseUserInfo();

        return $this->user;
    }
887243
public function getCurrentUser()
	{
		$instance = $this->app['session']->get('user');

		if (!($instance instanceof User))
		{
			$instance = new User;
		}

		return $instance;
	}
991320
public function user()
    {
        if ($this->loggedOut) {
            return NULL;
        }
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (!is_null($this->user)) {
            if ($this->session->get('expires_at') < Carbon::now()) {
                $this->logout();

                return NULL;
            }

            return $this->user;
        }
        // First we will try to load the user using the identifier in the session if
        // one exists. Otherwise we will check for a "remember me" cookie in this
        // request, and if one exists, attempt to retrieve the user using that.
        $id = $this->session->get($this->getName());
        $user = NULL;
        if (!is_null($id)) {
            $token = $this->validateToken($id);
            if (!$token) {
                return NULL;
            }
            $user = new User();
            if ($token->hasClaim('sub')) {
                $user->id = $token->getClaim('sub');
            }
            if ($token->hasClaim('name')) {
                $user->name = $token->getClaim('name');
            }
            if ($token->hasClaim('email')) {
                $user->email = $token->getClaim('email');
            }
            if ($token->hasClaim('roles')) {
                $user->roles = explode(' ', $token->getClaim('roles'));
            }
            if ($token->hasClaim('registries')) {
                $user->registries = explode(' ', $token->getClaim('registries'));
            }
            if ($token->hasClaim('cpf')) {
                $user->cpf = $token->getClaim('cpf');
            }
            if ($token->hasClaim('avatar')) {
                $user->avatar = $token->getClaim('avatar');
            }
            if ($user) {
                $this->fireAuthenticatedEvent($user);
            }
        }

        return $this->user = $user;
    }
202372
protected function _getCurrentUser($user = null)
    {
        $this->_setCurrentUser($user);

        if (!$this->_currentUserInstance &&
            isset($this->_currentUserViewVar) &&
            !empty($this->viewVars[$this->_currentUserViewVar])
        ) {
            $this->_currentUserInstance = $this->viewVars[$this->_currentUserViewVar];
        }

        return $this->_currentUserInstance;
    }
1249764
public function getCurrentUser()
    {
        if ($token = $this->tokenStorage->getToken()) {
            if (($user = $token->getUser()) && is_object($user)) {
                return $user;
            }
        }

        throw new \Exception('Authorization needed', ErrorCode::CODE_UNAUTHORIZED);
    }
521273
protected function getUserString()
    {
        $user = $this->core->auth()->user();

        if ( ! $user) return null;

        return $user->getUsername();
    }
795065
public function getUser()
    {
        if (! $this->_user) {
            $request = $this->getRequest();

            $this->_user = $this->loader->getUser($request->getParam($this->usernameFieldName), $request->getParam($this->organizationFieldName));
        }
        return $this->_user;
    }
876063
public function getUser()
    {
        if ($this->user_id) {
            return $this->hasOne(Yii::$app->user->identityClass, ['id' => 'user_id']);
        }
        return null;
    }
470066
public function getUser()
    {
        if (null === $this->user && $this->isLogin()) {
            $username = Base::instance()->get(static::SESSION_USER);
            $this->user = Security::instance()->getUserProvider()->loadByUsername($username);

            try {
                Authentication::instance()->checkUser($this->user);
            } catch(Exception $e) {
                $this->user = null;
            }
        }

        return $this->user;
    }
144036
public function getCurrentUser()
    {
        if ($this->currentuser === null) {
            $hash = $this->getCurrentSessionHash();
            if ($hash === false) {
                return false;
            }

            $uid = $this->getSessionUID($hash);
            if ($uid === false) {
                return false;
            }

            $this->currentuser = $this->getUser($uid);
        }
        return $this->currentuser;
    }
1185504
protected function getCurrentUser()
    {
        /** @var \RcmUser\Service\RcmUserService $rcmUserService */
        $rcmUserService = $this->serviceLocator->get(
            \RcmUser\Service\RcmUserService::class
        );

        return $rcmUserService->getCurrentUser();
    }
607959
public function getUser()
    {
        if (is_null($this->user)) {
            /**
             * @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception
             */
            $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
            throw $exception;
        }

        return $this->user;
    }
82370
public function getAuthUser()
    {
        $user = null;
        if ($this->api_auth()->check()) {
            $user = $this->api_auth()->user();
        } else if (\Auth::check()) {
            $user = \Auth::user();
        }
        return $user;
    }
162208
public function getUser()
    {
        if ($this->_oUser == null) {
            $this->_oUser = parent::getUser();
        }

        return $this->_oUser;
    }
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();
  }
1012580
public function user()
    {
        if (! $this->user) {
            $this->user = app(Users::class)->find(auth()->guard()->id());
        }

        return $this->user;
    }