* @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\QueryHandler; use PrestaShop\PrestaShop\Core\ConfigurationInterface; use PrestaShop\PrestaShop\Core\Domain\ShowcaseCard\ConfigurationMap; use PrestaShop\PrestaShop\Core\Domain\ShowcaseCard\Exception\ShowcaseCardException; use PrestaShop\PrestaShop\Core\Domain\ShowcaseCard\Query\GetShowcaseCardIsClosed; /** * Finds out if a showcase card has been closed */ final class GetShowcaseCardIsClosedHandler implements GetShowcaseCardIsClosedHandlerInterface { /** * @var ConfigurationInterface */ private $configuration; /** * @var ConfigurationMap */ private $configurationMap; /** * @param ConfigurationInterface $configuration * @param ConfigurationMap $configurationMap */ public function __construct(ConfigurationInterface $configuration, ConfigurationMap $configurationMap) { $this->configuration = $configuration; $this->configurationMap = $configurationMap; } /** * @param GetShowcaseCardIsClosed $query * * @return bool * * @throws ShowcaseCardException */ public function handle(GetShowcaseCardIsClosed $query) { $configurationName = $this->configurationMap->getConfigurationNameForClosedStatus($query->getShowcaseCard()); return (bool) $this->configuration->get($configurationName); } }