tokens->verifyAccessToken($value, verifyExpiration: $this->verifyExpiration); } catch (TokenExpiredException $e) { throw new ForbiddenOperationException(self::TOKEN_EXPIRED, previous: $e); } catch (InvalidTokenException $e) { throw new ForbiddenOperationException(self::INVALID_TOKEN, previous: $e); } if ($this->verifyAccount && !$this->validateAccount((new TokenReader($token))->getAccountId())) { throw new ForbiddenOperationException(self::INVALID_TOKEN); } return null; } private function validateAccount(int $accountId): bool { /** @var Account|null $account */ $account = Account::find()->excludeDeleted()->andWhere(['id' => $accountId])->one(); return $account !== null && $account->status !== Account::STATUS_BANNED; } }