Skip to content

Commit

Permalink
Updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-e-dietrich committed Jan 9, 2024
1 parent 21e5d7d commit 6d247d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 2 additions & 9 deletions src/SonarQube.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
*/
final class SonarQube
{

/**
* @var array
*/
private array $extraParams = [];

/**
* @var string[]
*/
Expand All @@ -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 = [])
{
}

Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 6d247d4

Please sign in to comment.