accessToken; } /** * Determine if the current API token has a given scope. */ public function anikeenTokenCan(string $scope): bool { $scopes = (array) ($this->accessToken->scopes ?? []); return in_array('*', $scopes, true) || in_array($scope, $scopes, true); } /** * Determine if the current API token has any of the given scopes. */ public function anikeenTokenCanAny(array $scopes): bool { foreach ($scopes as $scope) { if ($this->anikeenTokenCan($scope)) { return true; } } return false; } /** * Set the current access token for the user. */ public function withAnikeenAccessToken(stdClass $accessToken): self { $this->accessToken = $accessToken; return $this; } }