From 7471b30704064b5b97e9918654d170f4a13e1d69 Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Wed, 2 Oct 2024 14:13:13 +0200 Subject: [PATCH] Remove unused parameter --- CHANGELOG.md | 1 + config/services/command.php | 9 ++++----- src/Command/FeedGeneratorCommand.php | 18 ++++++++++-------- .../WebgriffeSyliusClerkExtension.php | 3 ++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 258ec93..4dddc23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,3 +7,4 @@ - The file `@WebgriffeSyliusClerkPlugin/Resources/config/shop_routing.yml` has been removed. Use `@WebgriffeSyliusClerkPlugin/config/shop_routing.php` instead. - The file `@WebgriffeSyliusClerkPlugin/Resources/config/admin_routing.yml` has been removed. - The file `@WebgriffeSyliusClerkPlugin/Resources/config/feed_routing.yml` has been removed. Use `@WebgriffeSyliusClerkPlugin/config/feed_routing.php` instead. +- The parameter `webgriffe_sylius_clerk.storage_feed_path` has been removed. diff --git a/config/services/command.php b/config/services/command.php index d079688..11a60ac 100644 --- a/config/services/command.php +++ b/config/services/command.php @@ -12,11 +12,10 @@ $services->set('webgriffe_sylius_clerk.command.generate_feed', FeedGeneratorCommand::class) ->args([ - service(FeedGenerator::class), - service('sylius.repository.channel'), - service('router'), - service('monolog.logger'), - param('webgriffe_sylius_clerk.storage_feed_path'), + '$feedGenerator' => service(FeedGenerator::class), + '$channelRepository' => service('sylius.repository.channel'), + '$router' => service('router'), + '$logger' => service('monolog.logger'), ]) ->tag('console.command') ; diff --git a/src/Command/FeedGeneratorCommand.php b/src/Command/FeedGeneratorCommand.php index 6b7504e..15c04e0 100644 --- a/src/Command/FeedGeneratorCommand.php +++ b/src/Command/FeedGeneratorCommand.php @@ -28,19 +28,21 @@ final class FeedGeneratorCommand extends Command private ?OutputInterface $output = null; public function __construct( - private FeedGeneratorInterface $feedGenerator, - private ChannelRepositoryInterface $channelRepository, - private RouterInterface $router, - private LoggerInterface $logger, - private string $storagePath, + private readonly FeedGeneratorInterface $feedGenerator, + private readonly ChannelRepositoryInterface $channelRepository, + private readonly RouterInterface $router, + private readonly LoggerInterface $logger, + private readonly string $storagePath, ) { - parent::__construct(); + parent::__construct(self::$defaultName); } protected function configure(): void { - $this->setDescription('Generate JSON feed for Clerk.io') - ->addArgument('channelCode', InputArgument::REQUIRED, 'Channel code'); + $this + ->setDescription('Generate JSON feed for Clerk.io') + ->addArgument('channelCode', InputArgument::REQUIRED, 'Channel code') + ; } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/DependencyInjection/WebgriffeSyliusClerkExtension.php b/src/DependencyInjection/WebgriffeSyliusClerkExtension.php index c886de5..3f7ec71 100644 --- a/src/DependencyInjection/WebgriffeSyliusClerkExtension.php +++ b/src/DependencyInjection/WebgriffeSyliusClerkExtension.php @@ -24,7 +24,8 @@ public function load(array $configs, ContainerBuilder $container): void $publicApiKeyProviderServiceDefinition = $container->getDefinition('webgriffe_sylius_clerk.provider.public_api_key'); $publicApiKeyProviderServiceDefinition->setArgument('$clerkStores', $config['stores']); - $container->setParameter('webgriffe_sylius_clerk.storage_feed_path', (string) $config['storage_feed_path']); + $generateFeedCommand = $container->getDefinition('webgriffe_sylius_clerk.command.generate_feed'); + $generateFeedCommand->setArgument('$storagePath', $config['storage_feed_path']); } public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface