Skip to content

Commit 9ad894e

Browse files
committed
Try fixing PHPStan issues
1 parent c60fafb commit 9ad894e

File tree

1 file changed

+5
-41
lines changed

1 file changed

+5
-41
lines changed

src/Services/InfoProviderSystem/Providers/BuerklinProvider.php

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO;
3232
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
3333
use App\Settings\InfoProviderSystem\BuerklinSettings;
34-
use App\Services\OAuth\OAuthTokenManager;
3534
use Psr\Cache\CacheItemPoolInterface;
3635
use Symfony\Component\DependencyInjection\Attribute\Autowire;
3736
use Symfony\Component\HttpClient\HttpOptions;
@@ -53,7 +52,6 @@ class BuerklinProvider implements BatchInfoProviderInterface
5352

5453
public function __construct(
5554
private readonly HttpClientInterface $client,
56-
private readonly OAuthTokenManager $authTokenManager,
5755
private readonly CacheItemPoolInterface $partInfoCache,
5856
private readonly BuerklinSettings $settings,
5957
) {
@@ -199,20 +197,6 @@ public function isActive(): bool
199197
&& $this->settings->password !== '';
200198
}
201199

202-
/**
203-
* @param string $id
204-
* @return PartDetailDTO
205-
*/
206-
private function queryDetail(string $id): PartDetailDTO
207-
{
208-
$product = $this->getProduct($id);
209-
if ($product === null) {
210-
throw new \RuntimeException('Could not find product code: ' . $id);
211-
}
212-
213-
return $this->getPartDetail($product);
214-
}
215-
216200
/**
217201
* Sanitizes a field by removing any HTML tags and other unwanted characters
218202
* @param string|null $field
@@ -423,18 +407,8 @@ private function getProductImages(?array $images): array
423407
);
424408
}
425409

426-
427-
428-
/**
429-
* @param array|null $attributes
430-
* @return ParameterDTO[]
431-
*/
432410
private function attributesToParameters(array $features, ?string $group = null): array
433411
{
434-
if (!is_array($features)) {
435-
return [];
436-
}
437-
438412
$out = [];
439413

440414
foreach ($features as $f) {
@@ -482,7 +456,9 @@ private function attributesToParameters(array $features, ?string $group = null):
482456
return array_values($byName);
483457
}
484458

485-
459+
/**
460+
* @return PartDetailDTO[]
461+
*/
486462
public function searchByKeyword(string $keyword): array
487463
{
488464
$keyword = strtoupper(trim($keyword));
@@ -513,8 +489,6 @@ public function searchByKeyword(string $keyword): array
513489
}
514490
}
515491

516-
517-
518492
public function getDetails(string $id): PartDetailDTO
519493
{
520494
// Detail endpoint is /products/{code}/
@@ -613,6 +587,7 @@ private function complianceToParameters(array $product, ?string $group = 'Compli
613587
*/
614588
public function searchByKeywordsBatch(array $keywords): array
615589
{
590+
/** @var array<string, SearchResultDTO[]> $results */
616591
$results = [];
617592

618593
foreach ($keywords as $keyword) {
@@ -622,6 +597,7 @@ public function searchByKeywordsBatch(array $keywords): array
622597
}
623598

624599
// Reuse existing single search -> returns PartDetailDTO[]
600+
/** @var PartDetailDTO[] $partDetails */
625601
$partDetails = $this->searchByKeyword($keyword);
626602

627603
// Convert to SearchResultDTO[]
@@ -634,18 +610,6 @@ public function searchByKeywordsBatch(array $keywords): array
634610
return $results;
635611
}
636612

637-
private function searchProducts(string $query): array
638-
{
639-
$response = $this->makeAPICall('/products/search/', [
640-
'pageSize' => 50,
641-
'currentPage' => 0,
642-
'query' => $query,
643-
'sort' => 'relevance',
644-
]);
645-
646-
return $response['products'] ?? [];
647-
}
648-
649613
/**
650614
* Converts a PartDetailDTO into a SearchResultDTO for bulk search.
651615
*/

0 commit comments

Comments
 (0)