Skip to content

Commit

Permalink
FFWEB-3191: Improve code style after CS library updates
Browse files Browse the repository at this point in the history
Improve code style after CS library updates
  • Loading branch information
Rayn93 authored Oct 9, 2024
1 parent 17b1aca commit c41df6e
Show file tree
Hide file tree
Showing 39 changed files with 51 additions and 48 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## Unreleased
### Improve
- Improve code style after CS library updates
- Product export - improve load variants properties
- Product export - improve load variants properties

## [v5.2.1] - 2024.08.14
### Fix
- Remove uasort() deprecation for CMS export
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ modifications in order to fit their needs. For more advanced features please che
For Shopware 6.4 please use SDK version 4.x:
https://github.com/FACT-Finder-Web-Components/shopware6-plugin

For Shopware 6.6 please use Shopware marketplace version:
https://store.shopware.com/en/factf26713613196f/factfinder-ai-powered-search-product-discovery.html
For Shopware 6.6 please use SDK version 6.x:
https://github.com/FACT-Finder-Web-Components/shopware6-plugin/tree/release/6.x

## FACT-Finder® Supported Sections

Expand Down Expand Up @@ -184,9 +184,6 @@ Following settings are used for uploading already exported feed to a given FTP/S

## Category Pages

**Note:**
This feature is experimental, and it is highly possible that it will be significantly modified in a near future.

Plugin offers a way to use FACT-Finder® Web Components on category pages using page builder Shopping Experiences. There
is two CMS blocks offered:

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"scripts": {
"test": [
"vendor/bin/phpstan analyse -c phpstan.neon",
"vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 512M",
"php-cs-fixer fix --dry-run -v",
"phpspec run --format=dot",
"phpmd src text phpmd.xml.dist",
Expand Down
2 changes: 1 addition & 1 deletion src/Api/TestConnectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
private readonly ClientBuilder $clientBuilder,
private readonly CommunicationConfig $config,
private readonly UploadService $uploadService,
private readonly LoggerInterface $factfinderLogger
private readonly LoggerInterface $factfinderLogger,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Api/UiFeedExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(
private FeedExportHandler $feedExportHandler,
private DataExportCommand $dataExportCommand,
private RefreshExportCacheHandler $refreshCacheHandler,
private LoggerInterface $factfinderLogger
private LoggerInterface $factfinderLogger,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Api/UpdateFieldRolesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class UpdateFieldRolesController extends AbstractController
public function __construct(
FieldRolesInterface $fieldRolesService,
EntityRepository $channelRepository,
LoggerInterface $factfinderLogger
LoggerInterface $factfinderLogger,
) {
$this->fieldRoles = $fieldRolesService;
$this->channelRepository = $channelRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/DataExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(
EntityRepository $languageRepository,
CurrencyFieldsProvider $currencyFieldsProvider,
FieldsProvider $fieldProviders,
ContainerInterface $container
ContainerInterface $container,
) {
$this->channelService = $channelService;
$this->channelRepository = $channelRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Communication/AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AdapterFactory extends BaseAdapterFactory
{
public function __construct(
ClientBuilder $clientBuilder,
Communication $config
Communication $config,
) {
parent::__construct(
$clientBuilder,
Expand Down
2 changes: 1 addition & 1 deletion src/Communication/PushImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(
Import $importAdapter,
Communication $communicationConfig,
FtpConfig $uploadConfig,
SalesChannelService $salesChannelService
SalesChannelService $salesChannelService,
) {
$this->communicationConfig = $communicationConfig;
$this->uploadConfig = $uploadConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/Config/CachedFieldRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getRoles(?string $salesChannelId): array

public function update(
array $fieldRoles,
?string $salesChannelId
?string $salesChannelId,
): void {
$salesChannelId = $salesChannelId ?? '';
$this->decorated->update($fieldRoles, $salesChannelId);
Expand Down
2 changes: 1 addition & 1 deletion src/Config/ExtensionConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExtensionConfig extends BaseConfig

public function __construct(
SystemConfigService $systemConfig,
?RequestStack $requestStack = null
?RequestStack $requestStack = null,
) {
$this->setRequest($requestStack);
parent::__construct($systemConfig);
Expand Down
4 changes: 2 additions & 2 deletions src/DataAbstractionLayer/FeedPreprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FeedPreprocessor
public function __construct(
PropertyFormatter $propertyFormatter,
EventDispatcherInterface $eventDispatcher,
ExportCustomFields $customFields
ExportCustomFields $customFields,
) {
$this->propertyFormatter = $propertyFormatter;
$this->eventDispatcher = $eventDispatcher;
Expand Down Expand Up @@ -156,7 +156,7 @@ private function formEntry(
Context $context,
?string $variationKey = '',
?array $customFields = null,
?array $filterAttributes = null
?array $filterAttributes = null,
): array {
return [
'id' => Uuid::randomHex(),
Expand Down
2 changes: 1 addition & 1 deletion src/DataAbstractionLayer/FeedPreprocessorEntryReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FeedPreprocessorEntryReader

public function __construct(
SalesChannelService $channelService,
EntityRepository $entryRepository
EntityRepository $entryRepository,
) {
$this->channelService = $channelService;
$this->entryRepository = $entryRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/CurrencyFieldsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CurrencyFieldsProvider
public function __construct(
EntityRepository $currencyRepository,
ExportSettings $exportSettings,
NumberFormatter $numberFormatter
NumberFormatter $numberFormatter,
) {
$this->currencyRepository = $currencyRepository;
$this->exportSettings = $exportSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Data/Entity/ProductEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ProductEntity implements ExportEntityInterface, ProductEntityInterface
public function __construct(
Product $product,
\Traversable $productFields,
\Traversable $cachedProductFields
\Traversable $cachedProductFields,
) {
$this->product = $product;
$this->productFields = iterator_to_array($productFields);
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Data/Entity/VariantEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
Product $product,
array $parentData,
PropertyFormatter $propertyFormatter,
iterable $variantFields
iterable $variantFields,
) {
$this->product = $product;
$this->parentData = $parentData;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Data/Factory/GenericEntityFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GenericEntityFactory implements FactoryInterface
public function __construct(
PropertyFormatter $propertyFormatter,
FieldsProvider $fieldsProviders,
\Traversable $exportedEntityTypes
\Traversable $exportedEntityTypes,
) {
$this->propertyFormatter = $propertyFormatter;
$this->fieldsProvider = $fieldsProviders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
FeedPreprocessorEntryReader $feedPreprocessorReader,
FeedPreprocessorEntryPersister $entryPersister,
FeedPreprocessor $feedPreprocessor,
\Traversable $cachedFields
\Traversable $cachedFields,
) {
$this->channelService = $channelService;
$this->decoratedFactory = $decoratedFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Data/Factory/ProductEntityFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(
PropertyFormatter $propertyFormatter,
FieldsProvider $fieldsProviders,
CurrencyFieldsProvider $currencyFieldsProvider,
\Traversable $variantFields
\Traversable $variantFields,
) {
$this->propertyFormatter = $propertyFormatter;
$this->fieldsProvider = $fieldsProviders;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Field/CategoryPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CategoryPath implements FieldInterface
public function __construct(
SalesChannelService $channelService,
CategoryBreadcrumbBuilder $breadcrumbBuilder,
string $categoryPathFieldName
string $categoryPathFieldName,
) {
$this->fieldName = $categoryPathFieldName;
$this->channelService = $channelService;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Field/CustomFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(
EntityRepository $customFieldRepository,
EntityRepository $languageRepository,
ExportSettings $exportSettings,
CustomFieldsService $customFieldsService
CustomFieldsService $customFieldsService,
) {
$this->propertyFormatter = $propertyFormatter;
$this->salesChannelService = $salesChannelService;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Field/FilterAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getValue(Entity $entity): string

if ($entity->getChildren()) {
$attributes = $entity->getChildren()->reduce(
fn(array $result, Product $child): array => $result + array_map($this->propertyFormatter, $child->getOptions()->getElements()),
fn (array $result, Product $child): array => $result + array_map($this->propertyFormatter, $child->getOptions()->getElements()),
$attributes
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Export/Field/ParentCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ParentCategory implements FieldInterface

public function __construct(
SalesChannelService $channelService,
CategoryBreadcrumbBuilder $breadcrumbBuilder
CategoryBreadcrumbBuilder $breadcrumbBuilder,
) {
$this->channelService = $channelService;
$this->breadcrumbBuilder = $breadcrumbBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/Export/SalesChannelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SalesChannelService

public function __construct(
CachedSalesChannelContextFactory $channelContextFactory,
EntityRepository $channelRepository
EntityRepository $channelRepository,
) {
$this->channelRepository = $channelRepository;
$this->channelContextFactory = $channelContextFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/Storefront/Controller/ProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function execute(
string $endpoint,
Request $request,
ClientBuilder $clientBuilder,
EventDispatcherInterface $eventDispatcher
EventDispatcherInterface $eventDispatcher,
): Response {
$client = $clientBuilder
->withServerUrl($this->config->getServerUrl())
Expand Down
4 changes: 2 additions & 2 deletions src/Storefront/Controller/ResultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ResultController extends StorefrontController

public function __construct(
Communication $config,
GenericPageLoader $pageLoader
GenericPageLoader $pageLoader,
) {
$this->pageLoader = $pageLoader;
$this->config = $config;
Expand All @@ -42,7 +42,7 @@ public function result(
Request $request,
SalesChannelContext $context,
SearchAdapter $searchAdapter,
Engine $mustache
Engine $mustache,
): Response {
$page = $this->pageLoader->load($request, $context);
$response = $this->renderStorefront('@Parent/storefront/page/factfinder/result.html.twig', ['page' => $page]);
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/CategoryPageResponseSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
Communication $config,
SearchAdapter $searchAdapter,
Engine $mustache,
CategoryPath $categoryPath
CategoryPath $categoryPath,
) {
$this->httpCacheEnabled = $httpCacheEnabled;
$this->categoryRepository = $categoryRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/CategoryPageSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
Communication $config,
ExtensionConfig $extensionConfig,
string $categoryPathFieldName,
array $categoryPageAddParams = []
array $categoryPageAddParams = [],
) {
$this->cmsPageRoute = $cmsPageRoute;
$this->config = $config;
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/ConfigurationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
RouterInterface $router,
array $fieldRoles,
array $communicationParameters,
array $configurationAddParams = []
array $configurationAddParams = [],
) {
$this->config = $config;
$this->extensionConfig = $extensionConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/FeedPreprocessorEntrySubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FeedPreprocessorEntrySubscriber implements EventSubscriberInterface

public function __construct(
EntityRepository $productRepository,
CategoryPath $categoryPath
CategoryPath $categoryPath,
) {
$this->productRepository = $productRepository;
$this->categoryFieldGenerator = $categoryPath;
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/ProductIndexerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
EntityRepository $languageRepository,
FeedPreprocessor $feedPreprocessor,
FeedPreprocessorEntryPersister $entryPersister,
ExportSettings $exportSettings
ExportSettings $exportSettings,
) {
$this->productRepository = $productRepository;
$this->languageRepository = $languageRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/TestUtil/ProductVariantMockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ProductVariantMockFactory
{
public function create(
ProductEntity $parent,
array $data = []
array $data = [],
): ProductEntity {
$variant = new ProductEntity();
$size = $data['size'] ?? 'S';
Expand Down
2 changes: 1 addition & 1 deletion src/Upload/UploadService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class UploadService
{
public function __construct(
private readonly FtpConfig $config,
private readonly FilesystemFactory $filesystemFactory
private readonly FilesystemFactory $filesystemFactory,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Utilites/Ssr/PriceFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(
SalesChannelService $channelService,
CurrencyFormatter $currencyFormatter,
CachedFieldRoles $fieldRolesService,
array $fieldRoles
array $fieldRoles,
) {
$this->channelService = $channelService;
$this->currencyFormatter = $currencyFormatter;
Expand Down
4 changes: 2 additions & 2 deletions src/Utilites/Ssr/SearchAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SearchAdapter
public function __construct(
ClientBuilder $clientBuilder,
Communication $config,
PriceFormatter $priceFormatter
PriceFormatter $priceFormatter,
) {
$this->clientBuilder = $clientBuilder;
$this->config = $config;
Expand All @@ -29,7 +29,7 @@ public function __construct(
public function search(
string $paramString,
bool $navigationRequest,
string $salesChannelId
string $salesChannelId,
): array {
$client = $this->clientBuilder
->withServerUrl($this->config->getServerUrl())
Expand Down
2 changes: 1 addition & 1 deletion src/Utilites/Ssr/Template/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(Loader $loader)

public function render(
string $templateFile,
array $context = []
array $context = [],
): string {
return $this->engine->loadTemplate($templateFile)->render($context);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utilites/Ssr/Template/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Filter implements FilterInterface

public function __construct(
SalesChannelService $channelService,
CachedFieldRoles $fieldRolesService
CachedFieldRoles $fieldRolesService,
) {
$context = $channelService->getSalesChannelContext();
$this->fieldRoles = $fieldRolesService->getRoles($context->getSalesChannelId());
Expand Down
2 changes: 1 addition & 1 deletion src/Utilites/Ssr/Template/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Loader implements \Mustache_Loader

public function __construct(
\Mustache_Loader $loader,
FilterInterface $filter
FilterInterface $filter,
) {
$this->loader = $loader;
$this->filter = $filter;
Expand Down
Loading

0 comments on commit c41df6e

Please sign in to comment.