Get the current user.
@return User|false
763659
public static function getCurrent()
    {
        $class = get_called_class();
        if (Session::get('user')) {
            return $class::search()->where('user_id', Session::get('user')->user_id)->execOne();
        }
        return false;
    }
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);
    }
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;
    }
1193285
public function getCurrentUser()
    {
        $userClass = $this->container->getParameter('victoire_core.user_class');
        $token = $this->container->get('security.token_storage')->getToken();

        if ($token !== null) {
            if ($token->getUser() instanceof $userClass) {
                return $token->getUser();
            }
        }
    }
1206866
public function getUser(): User
    {
        if (!$this->_user instanceof User) {
            $this->_user = Instance::ensure($this->_user, User::class);
        }
        return $this->_user;
    }
242320
public function user()
    {
        if (!is_null($this->user)) {
            return $this->user;
        }

        $token = $this->jwt->setRequest($this->request)->getToken();
        if (!$token) {
            return null;
        }

        // get cached freshed token if exists for concurrency requests
        if ($this->getCachedToken()) {
            $this->jwt = $this->jwt->setToken($this->getCachedToken());
        }

        // token validation
        if ($this->getToken() &&
            ($payload = $this->jwt->check(true)) &&
            $this->validateSubject()
        ) {
            return $this->user = $this->provider->retrieveById($payload['sub']);
        }

        return $this->user;
    }
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;
    }
888804
public function getUser()
    {
        if ($this->_user === false) {
            $customerClass = Yincart::$container->customerClass;
            $this->_user = $customerClass::findByUsername($this->username);
        }

        return $this->_user;
    }
433162
public function user()
	{
		if ($this->loggedOut)
		{
			return null;
		}

		if (!is_null($this->user))
		{
			return $this->user;
		}

		return $this->user = wp_get_current_user();
	}
172291
public function getUser()
    {
        if ($this->_user) return $this->_user;
        
	    try {
    	    $za = $this->getAuth();
            $id = $za->getIdentity();
            if (!$id) return FALSE;
        } catch (\Exception $e) {
            return FALSE;
        }
                
        if (isset($id['user_id'])) {
        
           if (!$this->_connected) return false;          
           $this->_user = User::getAuthorized($id);
           
        }
        
        return $this->_user;
    }
425059
public static function user()
    {
        if (self::check()) {
            if (is_null(static::$user)) {
                $data = Session::get(static::resource('session'));

                $data = static::query($data);

                static::$user = static::orm($data[0]);
            }

            return static::$user;
        }
    }
801891
public function user()
    {
        if ($this->loggedOut) {
            return;
        }

        // 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)) {
            return $this->user;
        }

        $id = $this->session->get($this->getName());

        // 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.
        if (! is_null($id) && $this->user = $this->provider->retrieveById($id)) {
            $this->fireAuthenticatedEvent($this->user);
        }

        // If the user is null, but we decrypt a "recaller" cookie we can attempt to
        // pull the user data on that cookie which serves as a remember cookie on
        // the application. Once we have a user we can return it to the caller.
        if (is_null($this->user) && ! is_null($recaller = $this->recaller())) {
            $this->user = $this->userFromRecaller($recaller);

            if ($this->user) {
                $this->updateSession($this->user->getAuthIdentifier());

                $this->fireLoginEvent($this->user, true);
            }
        }

        return $this->user;
    }
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;
    }
635823
public function getUser()
    {
        if ($user = $this->provider) {
            return ($field = $this->field) ? (string) $user->get($field)  : $user->get('id');
        }
    }
1103961
public function getUser()
    {
        if ($this->user === false) {
            $this->user = UserModel::findByEmail($this->email);
        }

        return $this->user;
    }
565440
protected function getUser()
    {
        if ($this->_user === null) {
            $this->_user = $this->getClient()->user;
        }
        return $this->_user;
    }
866536
protected function isCurrentUser()
    {
        return $this->credentials->check() && $this->credentials->getUser()->id == $this->wrappedObject->revisionable_id;
    }