Skip to content

Commit

Permalink
Merge pull request #499 from BitBagCommerce/feature/op-290-code-style
Browse files Browse the repository at this point in the history
OP-290 - code style
  • Loading branch information
marekrzytki authored Jun 7, 2024
2 parents 8d50d5f + d7df253 commit 1ea6ed9
Show file tree
Hide file tree
Showing 113 changed files with 1,590 additions and 1,798 deletions.
2 changes: 1 addition & 1 deletion features/admin/managing_frequently_asked_questions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Managing frequently asked questions
Given the store has a frequently asked question
When I go to the frequently asked questions page
And I delete this frequently asked question
Then I should be notified that the fequently asked question has been deleted
Then I should be notified that the frequently asked question has been deleted
And I should see empty list of frequently asked questions

@ui
Expand Down
4 changes: 2 additions & 2 deletions features/shop/displaying_media.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Feature: Displaying media

@ui
Scenario: Displaying media no standard template
And there is an existing "image" media with "media_with_parameteres" code
And there is an existing "image" media with "media_with_parameters" code
When I go to the homepage
And I want to see a media with code "media_with_parameteres"
And I want to see a media with code "media_with_parameters"
2 changes: 1 addition & 1 deletion src/Assigner/SectionsAssignerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

interface SectionsAssignerInterface
{
public function assign(SectionableInterface $sectionable, array $sectionsCodes): void;
public function assign(SectionableInterface $sectionsAware, array $sectionsCodes): void;
}
36 changes: 6 additions & 30 deletions src/Controller/Action/Admin/ImportDataAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,14 @@

final class ImportDataAction
{
/** @var ImportProcessorInterface */
private $importProcessor;

/** @var FormFactoryInterface */
private $formFactory;

/** @var RequestStack */
private $requestStack;

/** @var FormErrorsFlashHelperInterface */
private $formErrorsFlashHelper;

/** @var TranslatorInterface */
private $translator;

/** @var Environment */
private $twig;

public function __construct(
ImportProcessorInterface $importProcessor,
FormFactoryInterface $formFactory,
RequestStack $requestStack,
FormErrorsFlashHelperInterface $formErrorsFlashHelper,
TranslatorInterface $translator,
Environment $twig,
private ImportProcessorInterface $importProcessor,
private FormFactoryInterface $formFactory,
private RequestStack $requestStack,
private FormErrorsFlashHelperInterface $formErrorsFlashHelper,
private TranslatorInterface $translator,
private Environment $twig,
) {
$this->importProcessor = $importProcessor;
$this->formFactory = $formFactory;
$this->requestStack = $requestStack;
$this->formErrorsFlashHelper = $formErrorsFlashHelper;
$this->translator = $translator;
$this->twig = $twig;
}

public function __invoke(Request $request): Response
Expand Down
18 changes: 3 additions & 15 deletions src/Controller/Action/Admin/ProductSearchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,11 @@

final class ProductSearchAction
{
/** @var ProductRepositoryInterface */
private $productRepository;

/** @var LocaleContextInterface */
private $localeContext;

/** @var ViewHandler */
private $viewHandler;

public function __construct(
ProductRepositoryInterface $productRepository,
LocaleContextInterface $localeContext,
ViewHandler $viewHandler,
private ProductRepositoryInterface $productRepository,
private LocaleContextInterface $localeContext,
private ViewHandler $viewHandler,
) {
$this->productRepository = $productRepository;
$this->localeContext = $localeContext;
$this->viewHandler = $viewHandler;
}

public function __invoke(Request $request): Response
Expand Down
18 changes: 3 additions & 15 deletions src/Controller/Action/Admin/TaxonSearchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,11 @@

final class TaxonSearchAction
{
/** @var TaxonRepositoryInterface */
private $taxonRepository;

/** @var LocaleContextInterface */
private $localeContext;

/** @var ViewHandler */
private $viewHandler;

public function __construct(
TaxonRepositoryInterface $taxonRepository,
LocaleContextInterface $localeContext,
ViewHandler $viewHandler,
private TaxonRepositoryInterface $taxonRepository,
private LocaleContextInterface $localeContext,
private ViewHandler $viewHandler,
) {
$this->taxonRepository = $taxonRepository;
$this->localeContext = $localeContext;
$this->viewHandler = $viewHandler;
}

public function __invoke(Request $request): Response
Expand Down
18 changes: 3 additions & 15 deletions src/Controller/Action/Admin/UploadEditorImageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,11 @@

final class UploadEditorImageAction
{
/** @var MediaProviderResolverInterface */
private $mediaProviderResolver;

/** @var MediaRepositoryInterface */
private $mediaRepository;

/** @var FactoryInterface */
private $mediaFactory;

public function __construct(
MediaProviderResolverInterface $mediaProviderResolver,
MediaRepositoryInterface $mediaRepository,
FactoryInterface $mediaFactory,
private MediaProviderResolverInterface $mediaProviderResolver,
private MediaRepositoryInterface $mediaRepository,
private FactoryInterface $mediaFactory,
) {
$this->mediaProviderResolver = $mediaProviderResolver;
$this->mediaRepository = $mediaRepository;
$this->mediaFactory = $mediaFactory;
}

public function __invoke(Request $request): Response
Expand Down
14 changes: 4 additions & 10 deletions src/Controller/Helper/FormErrorsFlashHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@

final class FormErrorsFlashHelper implements FormErrorsFlashHelperInterface
{
/** @var RequestStack */
private $requestStack;

/** @var TranslatorInterface */
private $translator;

public function __construct(RequestStack $requestStack, TranslatorInterface $translator)
{
$this->requestStack = $requestStack;
$this->translator = $translator;
public function __construct(
private RequestStack $requestStack,
private TranslatorInterface $translator,
) {
}

public function addFlashErrors(FormInterface $form): void
Expand Down
6 changes: 1 addition & 5 deletions src/Controller/PageSlugController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@

final class PageSlugController
{
/** @var SlugGeneratorInterface */
private $slugGenerator;

public function __construct(SlugGeneratorInterface $slugGenerator)
public function __construct(private SlugGeneratorInterface $slugGenerator)
{
$this->slugGenerator = $slugGenerator;
}

public function generateAction(Request $request): JsonResponse
Expand Down
6 changes: 4 additions & 2 deletions src/EventListener/ResourceDeleteSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@

final class ResourceDeleteSubscriber implements EventSubscriberInterface
{
public function __construct(private UrlGeneratorInterface $router, private RequestStack $requestStack)
{
public function __construct(
private UrlGeneratorInterface $router,
private RequestStack $requestStack,
) {
}

public static function getSubscribedEvents(): array
Expand Down
6 changes: 1 addition & 5 deletions src/Form/Type/WysiwygType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@

final class WysiwygType extends AbstractType
{
/** @var UrlGeneratorInterface */
private $urlGenerator;

public function __construct(UrlGeneratorInterface $urlGenerator)
public function __construct(private UrlGeneratorInterface $urlGenerator)
{
$this->urlGenerator = $urlGenerator;
}

public function configureOptions(OptionsResolver $resolver): void
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ imports:
- { resource: "@BitBagSyliusCmsPlugin/Resources/config/resources.yml" }
- { resource: "@BitBagSyliusCmsPlugin/Resources/config/fos_ck_editor/fos_ck_editor.yml" }
- { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids.yml" }
- { resource: "@BitBagSyliusCmsPlugin/Resources/config/services.yml" }
- { resource: "@BitBagSyliusCmsPlugin/Resources/config/services.xml" }

parameters:
sylius.sitemap.path: "%kernel.project_dir%/var/sitemap"
Expand Down
Empty file modified src/Resources/config/serializer/Entity.Media.yml
100755 → 100644
Empty file.
Empty file modified src/Resources/config/serializer/Entity.Section.yml
100755 → 100644
Empty file.
47 changes: 47 additions & 0 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<imports>
<import resource="services/**.xml" />
</imports>

<parameters>
<parameter key="bitbag_sylius_cms_plugin.media_provider.interface">BitBag\SyliusCmsPlugin\MediaProvider\ProviderInterface</parameter>
</parameters>

<services>
<defaults public="true" />
<service id="bitbag_sylius_cms_plugin.reader.csv" class="BitBag\SyliusCmsPlugin\Reader\CsvReader" />

<service id="bitbag_sylius_cms_plugin.processor.import" class="BitBag\SyliusCmsPlugin\Processor\ImportProcessor">
<argument type="service" id="bitbag_sylius_cms_plugin.importer.chain" />
<argument type="service" id="bitbag_sylius_cms_plugin.reader.csv" />
<argument type="service" id="doctrine.orm.entity_manager" />
</service>

<service id="bitbag_sylius_cms_plugin.command.import_from_csv" class="BitBag\SyliusCmsPlugin\Command\ImportFromCsvCommand">
<argument type="service" id="bitbag_sylius_cms_plugin.processor.import" />
<tag name="console.command" />
</service>

<service id="bitbag_sylius_cms_plugin.downloader.image" class="BitBag\SyliusCmsPlugin\Downloader\ImageDownloader">
<argument type="service" id="filesystem" />
</service>

<service id="bitbag_sylius_cms_plugin.registry.media_provider" class="Sylius\Component\Registry\ServiceRegistry">
<argument>%bitbag_sylius_cms_plugin.media_provider.interface%</argument>
<argument>Media provider</argument>
</service>

<service id="bitbag_sylius_cms_plugin.media_uploader" class="BitBag\SyliusCmsPlugin\Uploader\MediaUploader">
<argument type="service" id="bitbag_sylius_cms_plugin.media.filesystem" />
</service>

<service id="bitbag_sylius_cms_plugin.media.filesystem" class="Gaufrette\Filesystem">
<factory service="knp_gaufrette.filesystem_map" method="get" />
<argument>%bitbag_sylius_cms_plugin.uploader.filesystem%</argument>
</service>

<service id="bitbag_sylius_cms_plugin.sorter.sections" class="BitBag\SyliusCmsPlugin\Sorter\SectionsSorter" />
</services>
</container>
56 changes: 0 additions & 56 deletions src/Resources/config/services.yml

This file was deleted.

23 changes: 23 additions & 0 deletions src/Resources/config/services/assigner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<defaults public="true" />

<service id="bitbag_sylius_cms_plugin.assigner.channels" class="BitBag\SyliusCmsPlugin\Assigner\ChannelsAssigner">
<argument type="service" id="sylius.repository.channel" />
</service>

<service id="bitbag_sylius_cms_plugin.assigner.products" class="BitBag\SyliusCmsPlugin\Assigner\ProductsAssigner">
<argument type="service" id="sylius.repository.product" />
</service>

<service id="bitbag_sylius_cms_plugin.assigner.taxons" class="BitBag\SyliusCmsPlugin\Assigner\TaxonsAssigner">
<argument type="service" id="sylius.repository.taxon" />
</service>

<service id="bitbag_sylius_cms_plugin.assigner.sections" class="BitBag\SyliusCmsPlugin\Assigner\SectionsAssigner">
<argument type="service" id="bitbag_sylius_cms_plugin.repository.section" />
</service>
</services>
</container>
20 changes: 0 additions & 20 deletions src/Resources/config/services/assigner.yml

This file was deleted.

Loading

0 comments on commit 1ea6ed9

Please sign in to comment.