From c8dc43a2541a2c5f69c8ebc7a901a176ef4de814 Mon Sep 17 00:00:00 2001
From: jkindly <kozupa.jakub@gmail.com>
Date: Tue, 24 Sep 2024 08:53:24 +0200
Subject: [PATCH] OP-525: Change helper to factory

---
 .../ContentElementFactory.php}                         |  4 ++--
 src/Importer/Legacy/LegacyBlockImporter.php            | 10 +++++-----
 src/Importer/Legacy/LegacyPageImporter.php             | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)
 rename src/{Helper/ContentElementHelper.php => Factory/ContentElementFactory.php} (97%)

diff --git a/src/Helper/ContentElementHelper.php b/src/Factory/ContentElementFactory.php
similarity index 97%
rename from src/Helper/ContentElementHelper.php
rename to src/Factory/ContentElementFactory.php
index 32c7acd3..18c960ae 100644
--- a/src/Helper/ContentElementHelper.php
+++ b/src/Factory/ContentElementFactory.php
@@ -2,11 +2,11 @@
 
 declare(strict_types=1);
 
-namespace Sylius\CmsPlugin\Helper;
+namespace Sylius\CmsPlugin\Factory;
 
 use Sylius\CmsPlugin\Entity\ContentConfiguration;
 
-final class ContentElementHelper
+final class ContentElementFactory
 {
     public static function createHeadingContentElement(
         ?string $locale,
diff --git a/src/Importer/Legacy/LegacyBlockImporter.php b/src/Importer/Legacy/LegacyBlockImporter.php
index 00c47eb7..587f5a8f 100644
--- a/src/Importer/Legacy/LegacyBlockImporter.php
+++ b/src/Importer/Legacy/LegacyBlockImporter.php
@@ -5,7 +5,7 @@
 namespace Sylius\CmsPlugin\Importer\Legacy;
 
 use Sylius\CmsPlugin\Entity\BlockInterface;
-use Sylius\CmsPlugin\Helper\ContentElementHelper;
+use Sylius\CmsPlugin\Factory\ContentElementFactory;
 use Sylius\CmsPlugin\Importer\AbstractImporter;
 use Sylius\CmsPlugin\Repository\BlockRepositoryInterface;
 use Sylius\CmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
@@ -47,7 +47,7 @@ public function import(array $row): void
                 $block->setName($this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row));
             }
 
-            $heading = ContentElementHelper::createHeadingContentElement(
+            $heading = ContentElementFactory::createHeadingContentElement(
                 $locale,
                 'h2',
                 $this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row),
@@ -57,7 +57,7 @@ public function import(array $row): void
                 $block->addContentElement($heading);
             }
 
-            $singleMedia = ContentElementHelper::createSingleMediaContentElement(
+            $singleMedia = ContentElementFactory::createSingleMediaContentElement(
                 $locale,
                 $this->getTranslatableColumnValue(self::IMAGE_COLUMN, $locale, $row),
             );
@@ -66,7 +66,7 @@ public function import(array $row): void
                 $block->addContentElement($singleMedia);
             }
 
-            $content = ContentElementHelper::createTextareaContentElement(
+            $content = ContentElementFactory::createTextareaContentElement(
                 $locale,
                 $this->getTranslatableColumnValue(self::CONTENT_COLUMN, $locale, $row),
             );
@@ -79,7 +79,7 @@ public function import(array $row): void
         $locales = $this->localeRepository->findAll();
         /** @var LocaleInterface $locale */
         foreach ($locales as $locale) {
-            $productsGrid = ContentElementHelper::createProductsGridContentElement(
+            $productsGrid = ContentElementFactory::createProductsGridContentElement(
                 $locale->getCode(),
                 $this->getColumnValue(self::PRODUCTS_COLUMN, $row),
             );
diff --git a/src/Importer/Legacy/LegacyPageImporter.php b/src/Importer/Legacy/LegacyPageImporter.php
index 0bdd5e59..cb3b3a16 100644
--- a/src/Importer/Legacy/LegacyPageImporter.php
+++ b/src/Importer/Legacy/LegacyPageImporter.php
@@ -6,7 +6,7 @@
 
 use Doctrine\ORM\EntityManagerInterface;
 use Sylius\CmsPlugin\Entity\PageInterface;
-use Sylius\CmsPlugin\Helper\ContentElementHelper;
+use Sylius\CmsPlugin\Factory\ContentElementFactory;
 use Sylius\CmsPlugin\Importer\AbstractImporter;
 use Sylius\CmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
 use Sylius\CmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
@@ -60,7 +60,7 @@ public function import(array $row): void
             $page->setTeaserTitle($this->getTranslatableColumnValue(self::NAME_WHEN_LINKED_COLUMN, $locale, $row));
             $page->setTeaserContent($this->getTranslatableColumnValue(self::DESCRIPTION_WHEN_LINKED_COLUMN, $locale, $row));
 
-            $heading = ContentElementHelper::createHeadingContentElement(
+            $heading = ContentElementFactory::createHeadingContentElement(
                 $locale,
                 'h2',
                 $this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row),
@@ -70,7 +70,7 @@ public function import(array $row): void
                 $page->addContentElement($heading);
             }
 
-            $singleMedia = ContentElementHelper::createSingleMediaContentElement(
+            $singleMedia = ContentElementFactory::createSingleMediaContentElement(
                 $locale,
                 $this->getTranslatableColumnValue(self::IMAGE_COLUMN, $locale, $row),
             );
@@ -79,7 +79,7 @@ public function import(array $row): void
                 $page->addContentElement($singleMedia);
             }
 
-            $content = ContentElementHelper::createTextareaContentElement(
+            $content = ContentElementFactory::createTextareaContentElement(
                 $locale,
                 $this->getTranslatableColumnValue(self::CONTENT_COLUMN, $locale, $row),
             );
@@ -92,7 +92,7 @@ public function import(array $row): void
         $locales = $this->localeRepository->findAll();
         /** @var LocaleInterface $locale */
         foreach ($locales as $locale) {
-            $productsGrid = ContentElementHelper::createProductsGridContentElement(
+            $productsGrid = ContentElementFactory::createProductsGridContentElement(
                 $locale->getCode(),
                 $this->getColumnValue(self::PRODUCTS_COLUMN, $row),
             );