@@ -370,8 +370,9 @@ private function getProductShortURL(string $product_code): string
370370 */
371371 private function getProductImages (?array $ images ): array
372372 {
373- if (!is_array ($ images ))
373+ if (!is_array ($ images )) {
374374 return [];
375+ }
375376
376377 // 1) Only real image entries with URL
377378 $ imgs = array_values (array_filter ($ images , fn ($ i ) => is_array ($ i ) && !empty ($ i ['url ' ])));
@@ -395,8 +396,9 @@ private function getProductImages(?array $images): array
395396 if (!str_starts_with ($ url , 'http:// ' ) && !str_starts_with ($ url , 'https:// ' )) {
396397 $ url = 'https://www.buerklin.com ' . $ url ;
397398 }
398- if (!filter_var ($ url , FILTER_VALIDATE_URL ))
399+ if (!filter_var ($ url , FILTER_VALIDATE_URL )) {
399400 continue ;
401+ }
400402
401403 $ byUrl [$ url ] = $ url ;
402404 }
@@ -412,21 +414,24 @@ private function attributesToParameters(array $features, ?string $group = null):
412414 $ out = [];
413415
414416 foreach ($ features as $ f ) {
415- if (!is_array ($ f ))
417+ if (!is_array ($ f )) {
416418 continue ;
419+ }
417420
418421 $ name = $ f ['name ' ] ?? null ;
419- if (!is_string ($ name ) || trim ($ name ) === '' )
422+ if (!is_string ($ name ) || trim ($ name ) === '' ) {
420423 continue ;
424+ }
421425
422426 $ vals = [];
423427 foreach (($ f ['featureValues ' ] ?? []) as $ fv ) {
424428 if (is_array ($ fv ) && isset ($ fv ['value ' ]) && is_string ($ fv ['value ' ]) && trim ($ fv ['value ' ]) !== '' ) {
425429 $ vals [] = trim ($ fv ['value ' ]);
426430 }
427431 }
428- if (count ($ vals ) === 0 )
432+ if (empty ($ vals )) {
429433 continue ;
434+ }
430435
431436 // Multiple values: join with comma
432437 $ value = implode (', ' , array_values (array_unique ($ vals )));
@@ -462,29 +467,32 @@ private function attributesToParameters(array $features, ?string $group = null):
462467 public function searchByKeyword (string $ keyword ): array
463468 {
464469 $ keyword = strtoupper (trim ($ keyword ));
465- if ($ keyword === '' ) {
466- return [];
467- }
470+ if (!empty ($ keyword )) {
468471
469- $ response = $ this ->makeAPICall ('/products/search/ ' , [
470- 'pageSize ' => 50 ,
471- 'currentPage ' => 0 ,
472- 'query ' => $ keyword ,
473- 'sort ' => 'relevance ' ,
474- ]);
472+ $ response = $ this ->makeAPICall ('/products/search/ ' , [
473+ 'pageSize ' => 50 ,
474+ 'currentPage ' => 0 ,
475+ 'query ' => $ keyword ,
476+ 'sort ' => 'relevance ' ,
477+ ]);
475478
476- $ products = $ response ['products ' ] ?? [];
479+ $ products = $ response ['products ' ] ?? [];
477480
478- // Normal case: products found in search results
479- if (is_array ($ products ) && count ($ products ) > 0 ) {
480- return array_map (fn ($ p ) => $ this ->getPartDetail ($ p ), $ products );
481- }
481+ // Normal case: products found in search results
482+ if (is_array ($ products ) && ! empty ($ products )) {
483+ return array_map (fn ($ p ) => $ this ->getPartDetail ($ p ), $ products );
484+ }
482485
483- // Fallback: try direct lookup by code
484- try {
485- $ product = $ this ->getProduct ($ keyword );
486- return [$ this ->getPartDetail ($ product )];
487- } catch (\Throwable $ e ) {
486+ // Fallback: try direct lookup by code
487+ try {
488+ $ product = $ this ->getProduct ($ keyword );
489+ return [$ this ->getPartDetail ($ product )];
490+ } catch (\Throwable $ e ) {
491+ return [];
492+ }
493+ }
494+ else
495+ {
488496 return [];
489497 }
490498 }
@@ -502,7 +510,7 @@ public function getCapabilities(): array
502510 return [
503511 ProviderCapabilities::BASIC ,
504512 ProviderCapabilities::PICTURE ,
505- //ProviderCapabilities::DATASHEET, // currently not implemented
513+ //ProviderCapabilities::DATASHEET, // currently not implemented
506514 ProviderCapabilities::PRICE ,
507515 ProviderCapabilities::FOOTPRINT ,
508516 ];
@@ -513,8 +521,9 @@ private function complianceToParameters(array $product, ?string $group = 'Compli
513521 $ params = [];
514522
515523 $ add = function (string $ name , $ value ) use (&$ params , $ group ) {
516- if ($ value === null )
524+ if ($ value === null ) {
517525 return ;
526+ }
518527
519528 if (is_bool ($ value )) {
520529 $ value = $ value ? 'Yes ' : 'No ' ;
@@ -523,8 +532,9 @@ private function complianceToParameters(array $product, ?string $group = 'Compli
523532 return ;
524533 } else {
525534 $ value = trim ((string ) $ value );
526- if ($ value === '' )
535+ if ($ value === '' ) {
527536 return ;
537+ }
528538 }
529539
530540 $ params [] = ParameterDTO::parseValueField (
0 commit comments