* @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\Form\IdentifiableObject\Handler; use PrestaShop\PrestaShop\Core\Form\IdentifiableObject\DataHandler\FormDataHandlerInterface; use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * Creates new form handlers. */ final class FormHandlerFactory implements FormHandlerFactoryInterface { /** * @var HookDispatcherInterface */ private $hookDispatcher; /** * @var TranslatorInterface */ private $translator; /** * @var bool */ private $isDemoModeEnabled; /** * @param HookDispatcherInterface $hookDispatcher * @param TranslatorInterface $translator * @param bool $isDemoModeEnabled */ public function __construct( HookDispatcherInterface $hookDispatcher, TranslatorInterface $translator, $isDemoModeEnabled ) { $this->hookDispatcher = $hookDispatcher; $this->translator = $translator; $this->isDemoModeEnabled = $isDemoModeEnabled; } /** * {@inheritdoc} */ public function create(FormDataHandlerInterface $dataHandler) { return new FormHandler( $dataHandler, $this->hookDispatcher, $this->translator, $this->isDemoModeEnabled ); } }