Skip to content

Commit

Permalink
use inline var
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVHG committed Feb 5, 2025
1 parent 352ac36 commit 967143c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/Http/Authentication/AuthenticateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,12 @@ private function handleApiKey(
return (new RemovedApiKey($apiKey))->toResponse();
}

$defaultQuery = $this->defaultQueryRepository->getByApiKey($apiKey);
if ($defaultQuery === null && !empty($this->consumerResolver->getDefaultQuery($apiKey))) {
$defaultQuery = $this->consumerResolver->getDefaultQuery($apiKey);
}

$this->container
->extend(Consumer::class)
->setConcrete(
new Consumer(
$apiKey,
$defaultQuery
$this->defaultQueryRepository->getByApiKey($apiKey) ?? $this->consumerResolver->getDefaultQuery($apiKey)
)
);

Expand Down
2 changes: 1 addition & 1 deletion tests/Http/Authentication/AuthenticateRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function it_handles_valid_requests_with_api_key(ServerRequestInterface $r
->with('my_active_api_key')
->willReturn('ACTIVE');

$this->consumerResolver->expects($this->exactly(2))
$this->consumerResolver->expects($this->once())
->method('getDefaultQuery')
->with('my_active_api_key')
->willReturn('my_default_search_query');
Expand Down

0 comments on commit 967143c

Please sign in to comment.