* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Domain\ShowcaseCard\CommandHandler; use PrestaShop\PrestaShop\Core\ConfigurationInterface; use PrestaShop\PrestaShop\Core\Domain\ShowcaseCard\Command\CloseShowcaseCardCommand; use PrestaShop\PrestaShop\Core\Domain\ShowcaseCard\ConfigurationMap; /** * Saves the showcase card status to keep it closed */ final class CloseShowcaseCardHandler implements CloseShowcaseCardHandlerInterface { /** * @var ConfigurationInterface */ private $configuration; /** * @var ConfigurationMap */ private $configurationMap; /** * CloseShowcaseCardHandler constructor. * * @param ConfigurationInterface $configuration * @param ConfigurationMap $configurationMap */ public function __construct(ConfigurationInterface $configuration, ConfigurationMap $configurationMap) { $this->configuration = $configuration; $this->configurationMap = $configurationMap; } /** * @param CloseShowcaseCardCommand $command */ public function handle(CloseShowcaseCardCommand $command) { $configurationName = $this->configurationMap->getConfigurationNameForClosedStatus($command->getShowcaseCard()); $this->configuration->set($configurationName, '1'); } }