diff --git a/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php b/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php index d428910d..23eee528 100644 --- a/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php +++ b/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php @@ -50,6 +50,8 @@ class GenericWebProvider implements InfoProviderInterface use FixAndValidateUrlTrait; + public const OPTION_CHECK_FOR_DELEGATION = 'check_for_delegation'; + public const DISTRIBUTOR_NAME = 'Website'; private readonly HttpClientInterface $httpClient; @@ -99,7 +101,7 @@ class GenericWebProvider implements InfoProviderInterface try { return [ - $this->getDetails($keyword, false) //We already tried delegation + $this->getDetails($keyword, [self::OPTION_CHECK_FOR_DELEGATION => false]) //We already tried delegation ]; } catch (ProviderIDNotSupportedException $e) { return []; } @@ -312,8 +314,10 @@ class GenericWebProvider implements InfoProviderInterface - public function getDetails(string $id, bool $check_for_delegation = true): PartDetailDTO + public function getDetails(string $id, array $options = []): PartDetailDTO { + //We check for delegation by default + $check_for_delegation = $options[self::OPTION_CHECK_FOR_DELEGATION] ?? true; $url = $this->fixAndValidateURL($id); if ($check_for_delegation) { diff --git a/src/Services/InfoProviderSystem/Providers/MouserProvider.php b/src/Services/InfoProviderSystem/Providers/MouserProvider.php index 3171c994..49ca2d50 100644 --- a/src/Services/InfoProviderSystem/Providers/MouserProvider.php +++ b/src/Services/InfoProviderSystem/Providers/MouserProvider.php @@ -76,7 +76,7 @@ class MouserProvider implements InfoProviderInterface return $this->settings->apiKey !== '' && $this->settings->apiKey !== null; } - public function searchByKeyword(string $keyword): array + public function searchByKeyword(string $keyword, array $options = []): array { /* SearchByKeywordRequest description: @@ -144,7 +144,7 @@ class MouserProvider implements InfoProviderInterface return $this->responseToDTOArray($response); } - public function getDetails(string $id): PartDetailDTO + public function getDetails(string $id, array $options = []): PartDetailDTO { /* SearchByPartRequest description: