* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ class RetailcrmTemplateFactory { private $assets; private $smarty; /** * RetailcrmTemplateFactory constructor. * * @param $smarty * @param $assets */ public function __construct($smarty, $assets) { $this->smarty = $smarty; $this->assets = $assets; } /** * @param Module $module * * @return RetailcrmAbstractTemplate */ public function createTemplate(Module $module) { $settings = RetailCRM::getSettings(); if (empty($settings['url']) && empty($settings['apiKey'])) { return new RetailcrmBaseTemplate($module, $this->smarty, $this->assets); } else { return new RetailcrmSettingsTemplate($module, $this->smarty, $this->assets, $settings, RetailCRM::getSettingsNames()); } } }