Get associated userId

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

        return $id;
    }
444428
private function getCurrentUserId()
    {
        if ($this->authorizationChecker->isGranted('IS_AUTHENTICATED_FULLY') // user has just logged in
            || $this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED') // user has logged in using remember_me cookie
        ) {
            $authenticationToken = $this->tokenStorage->getToken();
            $user = $authenticationToken->getUser();

            if (is_string($user)) {
                return $user;
            } elseif (method_exists($user, 'getAPIUser')) {
                return $user->getAPIUser()->id;
            }

            return $authenticationToken->getUsername();
        }

        if (!$this->session->isStarted()) {
            $this->session->start();
        }

        $request = $this->requestStack->getMasterRequest();

        if (!$request->cookies->has('yc-session-id')) {
            $request->cookies->set('yc-session-id', $this->session->getId());
        }

        return $request->cookies->get('yc-session-id');
    }
800223
public function userId()
	{
		if (isset($this->user_id)) {
			return $this->user_id ? $this->user_id : null;
		}
		
		$this->check();
		$this->user_id = false;
		
		if ('user' == $this->type) {
			if ($user_id = Authorizer::getResourceOwnerId()) {
				return $this->user_id = $user_id;
			}
		}
		
		return null;
	}
492293
public function getUser()
    {
        if ($this->_user === false) {
            foreach (Yii::$app->user->getLoginPriority() as $item) {
                if ($item::validate($this->id)) {
                    return $item::getUser($this->id);
                }
            }
        }

        return $this->_user;
    }
1161457
public static function moduleUserIdentity()
    {
        if (empty(static::$_moduleUserIdentity)) {
            $module = Yii::$app->getModule(static::parameter('userModuleUniqueId'));
            if (!empty($module) && $module instanceof UniModule) {
                $result = $module->getDataModel(static::parameter('userManagerAlias'));
                static::$_moduleUserIdentity = $result;
            }
        }

        //return null; // use for debug
        return static::$_moduleUserIdentity;
    }
1016664
public function getLoggedUser() {
		$session = BUsersSession::getInstanceAndStart();
		if (empty($session)) {
			return NULL;
		}
		return $this->itemGet($session->userid);
	}
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");
  }
1278216
public function getUid()
    {
        if (!array_key_exists(self::UID, $this->passwd)) {
            throw new \Exception('Could not get user id from passwd.');
        }
        return $this->passwd[self::UID];
    }
1254552
public function getUserId() {
		if (isset($_SESSION) && isset($_SESSION[self::SESSION_FIELD_USER_ID])) {
			return $_SESSION[self::SESSION_FIELD_USER_ID];
		}
		else {
			return null;
		}
	}
1166169
public static function getUserID()
    {
        $user = Yii::$app->getUser();

        return $user && !$user->getIsGuest() ? $user->getId() : 0;
    }
41901
function getOwnerId()
    {
        if ($this->withIdentity() instanceof iIdentityOfUser)
        {
            /** @var IdentityOAuthToken|iIdentityOfUser $identity */
            $identity = $this->withIdentity();
            $userId   = $identity->getOwnerId();
        }
        else
        {
            $userInfo = $this->getAuthInfo();
            $userId   = $userInfo['user']['uid'];
        }


        return $userId;
    }
219719
protected static function _getUserId()
    {
        if (is_null(self::$_userID)) {
            self::$_userID = null;
            if (isset(Yii::$app->user) and !empty(Yii::$app->user->id)) {
                self::$_userID = Yii::$app->user->id;
            }
        }

        return self::$_userID;
    }
382945
public function getUser()
    {
        if ( null === $this->_user && $this->userId )
        {
            $this->_user = $this->getUserMapper()
                                ->find( $this->userId );
        }

        return $this->_user;
    }
587048
protected function getUserId($user) : ?int
    {
        if ($user === null) {
            return null;
        }

        if (is_int($user)) {
            return $user;
        }

        if ($user instanceof Authenticatable) {
            return $user->getAuthIdentifier();
        }

        return null;
    }
204275
public function getCurrentUserId()
    {
        $contents = $this
            ->call('GET', self::USER_RESOURCE)
            ->getBody()
            ->getContents();

        $json = json_decode($contents, true);

        return $json['user_id'];
    }
635823
public function getUser()
    {
        if ($user = $this->provider) {
            return ($field = $this->field) ? (string) $user->get($field)  : $user->get('id');
        }
    }
959459
protected function getUser($userId = null)
    {
        if ($userId === null) {
            /** @var Token $sessionAuth */
            if ($this->session()->isStarted() && $sessionAuth = $this->session()->get('authentication')) {
                return $sessionAuth->getUser();
            }

            return false;
        }
        /** @var Repository\UsersRepository $repo */
        $repo = $this->storage()->getRepository(Entity\Users::class);

        return $repo->getUser($userId);
    }