From 6d247d462000da9c6e196e5a305ca8eee07c90c7 Mon Sep 17 00:00:00 2001 From: Sean Dietrich Date: Mon, 8 Jan 2024 16:59:38 -0800 Subject: [PATCH] Updated code --- src/Project.php | 2 +- src/SonarQube.php | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Project.php b/src/Project.php index 1854a9f..6899fc9 100644 --- a/src/Project.php +++ b/src/Project.php @@ -389,7 +389,7 @@ private function getProjectHotSpots(): array $hotspots = $this->queryElements('getHotSpotsSearch', 'hotspots', function ($hotspot) { $hotspot['vulnerability_level'] = Util::getVulnerabilityLevel($hotspot['vulnerabilityProbability']); - $hotspot['line'] ??= $issue['textRange']['startLine'] ?? ''; + $hotspot['line'] ??= $hotspot['textRange']['startLine'] ?? ''; $source = $this->sonarQube->getSourceSnippet($hotspot['key']); $hotspot['source'] = array_reduce( diff --git a/src/SonarQube.php b/src/SonarQube.php index 85235d2..7db0796 100644 --- a/src/SonarQube.php +++ b/src/SonarQube.php @@ -12,12 +12,6 @@ */ final class SonarQube { - - /** - * @var array - */ - private array $extraParams = []; - /** * @var string[] */ @@ -38,7 +32,7 @@ final class SonarQube * @param Client $client * Guzzle Client. */ - public function __construct(private readonly Client $client) + public function __construct(private readonly Client $client, private readonly array $extraParams = []) { } @@ -64,8 +58,7 @@ public static function create(string $host, string $user, string $pass, array $e 'Accept' => 'application/json', ] ]); - $client->extraParams = $extraParams; - return new SonarQube($client); + return new SonarQube($client, $extraParams); } /**