Improved code formatting

This commit is contained in:
Jan Böhmer 2024-09-09 00:24:24 +02:00
parent d4fb2ba46a
commit ef22856e5c

View file

@ -487,7 +487,7 @@ class OEMSecretsProvider implements InfoProviderInterface
* 4. Remaining distributors are sorted alphabetically by region and country_code. * 4. Remaining distributors are sorted alphabetically by region and country_code.
*/ */
private function processBatch( private function processBatch(
array $product, array $product,
string $provider_id, string $provider_id,
array &$basicInfoResults, array &$basicInfoResults,
@ -495,7 +495,7 @@ class OEMSecretsProvider implements InfoProviderInterface
array &$imagesResults, array &$imagesResults,
array &$parametersResults, array &$parametersResults,
array &$purchaseInfoResults array &$purchaseInfoResults
): ?PartDetailDTO ): ?PartDetailDTO
{ {
if (!isset($product['manufacturer'], $product['part_number'])) { if (!isset($product['manufacturer'], $product['part_number'])) {
throw new \InvalidArgumentException("Missing required product data: 'manufacturer' or 'part_number'"); throw new \InvalidArgumentException("Missing required product data: 'manufacturer' or 'part_number'");
@ -531,8 +531,8 @@ class OEMSecretsProvider implements InfoProviderInterface
} }
$existingBasicInfo = isset($basicInfoResults[$provider_id]) && is_array($basicInfoResults[$provider_id]) $existingBasicInfo = isset($basicInfoResults[$provider_id]) && is_array($basicInfoResults[$provider_id])
? $basicInfoResults[$provider_id] ? $basicInfoResults[$provider_id]
: []; : [];
$basicInfoResults[$provider_id] = $this->createOrUpdateBasicInfo( $basicInfoResults[$provider_id] = $this->createOrUpdateBasicInfo(
$provider_id, $provider_id,
@ -654,7 +654,7 @@ class OEMSecretsProvider implements InfoProviderInterface
} }
/** /**
* Extracts pricing information from the product data, converts it to PriceDTO objects, * Extracts pricing information from the product data, converts it to PriceDTO objects,
* and returns them as an array. * and returns them as an array.
* *
@ -790,7 +790,7 @@ class OEMSecretsProvider implements InfoProviderInterface
return $parameters; return $parameters;
} }
/** /**
* Creates a PurchaseInfoDTO object containing distributor and pricing information for a product. * Creates a PurchaseInfoDTO object containing distributor and pricing information for a product.
* Ensures that the distributor name is valid and prices are available. * Ensures that the distributor name is valid and prices are available.
* *
@ -885,12 +885,12 @@ class OEMSecretsProvider implements InfoProviderInterface
* @return array The updated or newly created PartDetailDTO containing basic product information. * @return array The updated or newly created PartDetailDTO containing basic product information.
*/ */
private function createOrUpdateBasicInfo( private function createOrUpdateBasicInfo(
string $provider_id, string $provider_id,
array $product, array $product,
string $description, string $description,
string $thenotes, string $thenotes,
?array $existingBasicInfo ?array $existingBasicInfo
): array { ): array {
// If there is no existing basic info array, we create a new one // If there is no existing basic info array, we create a new one
if (is_null($existingBasicInfo)) { if (is_null($existingBasicInfo)) {
return [ return [
@ -917,7 +917,7 @@ class OEMSecretsProvider implements InfoProviderInterface
'provider_key' => $existingBasicInfo['provider_key'] ?? $this->getProviderKey(), 'provider_key' => $existingBasicInfo['provider_key'] ?? $this->getProviderKey(),
'provider_id' => $existingBasicInfo['provider_id'] ?? $provider_id, 'provider_id' => $existingBasicInfo['provider_id'] ?? $provider_id,
'name' => $existingBasicInfo['name'] ?? $product['part_number'], 'name' => $existingBasicInfo['name'] ?? $product['part_number'],
// Update description if it's null/empty // Update description if it's null/empty
'description' => !empty($existingBasicInfo['description']) 'description' => !empty($existingBasicInfo['description'])
? $existingBasicInfo['description'] ? $existingBasicInfo['description']
: $description, : $description,
@ -1088,7 +1088,7 @@ class OEMSecretsProvider implements InfoProviderInterface
return null; return null;
} }
// Array to store parsed parameters // Array to store parsed parameters
$parameters = []; $parameters = [];
// Split the description using the ';' separator // Split the description using the ';' separator