From 9ad894e8269c24d9353f5346ebcc643f529adda9 Mon Sep 17 00:00:00 2001 From: Marc Kreidler Date: Thu, 11 Dec 2025 22:23:06 +0100 Subject: [PATCH] Try fixing PHPStan issues --- .../Providers/BuerklinProvider.php | 46 ++----------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/src/Services/InfoProviderSystem/Providers/BuerklinProvider.php b/src/Services/InfoProviderSystem/Providers/BuerklinProvider.php index 2a7658f6..48776eb7 100644 --- a/src/Services/InfoProviderSystem/Providers/BuerklinProvider.php +++ b/src/Services/InfoProviderSystem/Providers/BuerklinProvider.php @@ -31,7 +31,6 @@ use App\Services\InfoProviderSystem\DTOs\PriceDTO; use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO; use App\Services\InfoProviderSystem\DTOs\SearchResultDTO; use App\Settings\InfoProviderSystem\BuerklinSettings; -use App\Services\OAuth\OAuthTokenManager; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpClient\HttpOptions; @@ -53,7 +52,6 @@ class BuerklinProvider implements BatchInfoProviderInterface public function __construct( private readonly HttpClientInterface $client, - private readonly OAuthTokenManager $authTokenManager, private readonly CacheItemPoolInterface $partInfoCache, private readonly BuerklinSettings $settings, ) { @@ -199,20 +197,6 @@ class BuerklinProvider implements BatchInfoProviderInterface && $this->settings->password !== ''; } - /** - * @param string $id - * @return PartDetailDTO - */ - private function queryDetail(string $id): PartDetailDTO - { - $product = $this->getProduct($id); - if ($product === null) { - throw new \RuntimeException('Could not find product code: ' . $id); - } - - return $this->getPartDetail($product); - } - /** * Sanitizes a field by removing any HTML tags and other unwanted characters * @param string|null $field @@ -423,18 +407,8 @@ class BuerklinProvider implements BatchInfoProviderInterface ); } - - - /** - * @param array|null $attributes - * @return ParameterDTO[] - */ private function attributesToParameters(array $features, ?string $group = null): array { - if (!is_array($features)) { - return []; - } - $out = []; foreach ($features as $f) { @@ -482,7 +456,9 @@ class BuerklinProvider implements BatchInfoProviderInterface return array_values($byName); } - + /** + * @return PartDetailDTO[] + */ public function searchByKeyword(string $keyword): array { $keyword = strtoupper(trim($keyword)); @@ -513,8 +489,6 @@ class BuerklinProvider implements BatchInfoProviderInterface } } - - public function getDetails(string $id): PartDetailDTO { // Detail endpoint is /products/{code}/ @@ -613,6 +587,7 @@ class BuerklinProvider implements BatchInfoProviderInterface */ public function searchByKeywordsBatch(array $keywords): array { + /** @var array $results */ $results = []; foreach ($keywords as $keyword) { @@ -622,6 +597,7 @@ class BuerklinProvider implements BatchInfoProviderInterface } // Reuse existing single search -> returns PartDetailDTO[] + /** @var PartDetailDTO[] $partDetails */ $partDetails = $this->searchByKeyword($keyword); // Convert to SearchResultDTO[] @@ -634,18 +610,6 @@ class BuerklinProvider implements BatchInfoProviderInterface return $results; } - private function searchProducts(string $query): array - { - $response = $this->makeAPICall('/products/search/', [ - 'pageSize' => 50, - 'currentPage' => 0, - 'query' => $query, - 'sort' => 'relevance', - ]); - - return $response['products'] ?? []; - } - /** * Converts a PartDetailDTO into a SearchResultDTO for bulk search. */