Get associated userId

@return int|null
553222
public function getUserId()
    {
        if (null === $this->userId && null !== $this->user) {
            $this->userId = $this->user->id;
        }

        return $this->userId;
    }
1012035
public static function getAuthorUserId()
    {
        return (Yii::$app instanceof \luya\web\Application) ? Yii::$app->adminuser->getId() : self::$_authorUserId;
    }
1200625
public function id()
	{
		if ($this->loggedOut)
		{
			return null;
		}

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

		return $this->user()->ID;
	}
268545
public function getAuthor()
    {
        $module = Yii::$app->getModule(Module::$name);

        return $this->hasOne($module->userIdentityClass, ['id' => 'createdBy']);
    }
830278
public function getID(): ?string
    {
        $sessionKey = $this->getSessionKey();
        if (strlen($sessionKey) === 0) {
            return null;
        }
        $cacheKey = 'id-' . $sessionKey;
        if (!isset(self::$cache[$cacheKey])) {
            self::$cache[$cacheKey] = null;
            $data = Internal\Data::getValue('.temp/bearcms/userkeys/' . md5($sessionKey));
            if ($data !== null) {
                self::$cache[$cacheKey] = $data;
            }
        }
        return self::$cache[$cacheKey];
    }
1180969
public function getUserId() {
    if (array_key_exists(self::USER_ATTR, $this->payload)) {
      return $this->payload[self::USER_ATTR];
    }
    throw new Exception("No user_id in token");
  }
1089879
public static function getUserIdSalt()
    {
        $salt = Option::get(self::OPTION_USERID_SALT);
        if (empty($salt)) {
            $salt = Common::getRandomString($len = 40, $alphabet = "abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMNOPRSTUVWXYZ0123456789_-$");
            Option::set(self::OPTION_USERID_SALT, $salt, 1);
        }
        return $salt;
    }
204275
public function getCurrentUserId()
    {
        $contents = $this
            ->call('GET', self::USER_RESOURCE)
            ->getBody()
            ->getContents();

        $json = json_decode($contents, true);

        return $json['user_id'];
    }
145321
protected function getUser()
    {
        if ($this->_user === null) {
            $user = $this->module->model('UserIdentity');
            $this->_user = $user::findByUsername($this->username);
        }
        return $this->_user;
    }
830555
public function getUser()
    {
        if (null === $this->getTokenStorage()->getToken()) {
            return null;
        }

        return $this->getTokenStorage()->getToken()->getUser();
    }
1332534
public function getUserInRequest() {
    if (isset($_COOKIE[$this->cookieName])) {
      $user = $this->validateToken($_COOKIE[$this->cookieName],
          $this->clientId);
      if ($user) {
        $accountInfo = $this->getUserById($user->getUserId());
        $accountInfo->setProviderId($user->getProviderId());
        return $accountInfo;
      }
    }
    return null;
  }
1251870
protected function getUserId()
    {
        if (!$this->users) {
            $userStorage = $this->entityTypeManager->getStorage('user');

            $this->users = $userStorage->loadByProperties(['status' => true]);
        }

        return array_rand($this->users);
    }
1216123
public function get_user_id()
    {
        if (is_object($this->user)) {
            return $this->user->ID;
        }
        else if (isset($_SESSION['user_id'])) {
            return $_SESSION['user_id'];
        }

        return null;
    }
1252462
public function getUser()
    {
        if ($user = $this->provider->user()) {
            return ($field = $this->field) ? (string) $user->{$field} : $user->getAuthIdentifier();
        }
    }
1050464
public function findAuthenticatedUser()
    {

        $token = $this->getSecurityTokenStorage()->getToken();

        if (null !== $token) {

            $user = $token->getUser();

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

        }
        return null;
    }
295350
public function getAuthorName()
    {
        if ($this->fvAuthorUID) {
            $app = Application::getFacadeApplication();
            $ui = $app->make(UserInfoRepository::class)->getByID($this->fvAuthorUID);
        } else {
            $ui = null;
        }

        return $ui === null ? t('(Unknown)') : $ui->getUserDisplayName();
    }
651804
private function findNonExistingUserGroupId()
    {
        $userGroupManager = $this->getUserGroupManager();
        for ( $i = 0; $i < 20; $i++ )
        {
            $id = uniqid('UserGroup#', true);
            if ( !$userGroupManager()->checkUserGroupExistence( $id ) )
            {
                return $id;
            }
        }

        throw new \Exception( 'Possible endless loop when attempting to find a new id for UserGroup.' );
    }