* @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\Theme\CommandHandler; use PrestaShop\PrestaShop\Core\Addon\Theme\ThemeManager; use PrestaShop\PrestaShop\Core\Domain\Theme\Command\ResetThemeLayoutsCommand; use PrestaShop\PrestaShop\Core\Domain\Theme\Exception\CannotResetThemeLayoutsException; /** * Class ResetThemeLayoutsHandler */ final class ResetThemeLayoutsHandler implements ResetThemeLayoutsHandlerInterface { /** * @var ThemeManager */ private $themeManager; /** * @param ThemeManager $themeManager */ public function __construct(ThemeManager $themeManager) { $this->themeManager = $themeManager; } /** * {@inheritdoc} */ public function handle(ResetThemeLayoutsCommand $command) { if (!$this->themeManager->reset($command->getThemeName()->getValue())) { throw new CannotResetThemeLayoutsException(sprintf('Cannot reset "%s" theme page layouts.', $command->getThemeName()->getValue())); } } }