user_id = $user_id; $this->method = $method; $this->token_id = $token_id; $this->scopes = $scopes; $this->client = $client; } /** * Scope check. * * @param string $scope Scope. */ public function has_scope( string $scope ): bool { return in_array( $scope, $this->scopes, true ); } /** * Stable non-secret label for logs, e.g. "pat#12" or "app_password#1". */ public function label(): string { return $this->method . '#' . ( $this->token_id ? $this->token_id : $this->user_id ); } /** * Rate-limit key. */ public function rate_key(): string { return $this->method . ':' . $this->token_id . ':' . $this->user_id; } }