. */ namespace SP\Modules\Web\Controllers\Helpers; use DI\Container; use DI\DependencyException; use DI\NotFoundException; use Psr\Container\ContainerInterface; use SP\Config\Config; use SP\Config\ConfigDataInterface; use SP\Core\Context\ContextInterface; use SP\Core\Events\EventDispatcher; use SP\Http\Request; use SP\Mvc\View\Template; /** * Class HelperBase * * @package SP\Modules\Web\Controllers\Helpers */ abstract class HelperBase { protected Template $view; protected ConfigDataInterface $configData; protected ContextInterface $context; protected EventDispatcher $eventDispatcher; protected Config $config; protected ContainerInterface $dic; protected Request $request; /** * Constructor * * @throws DependencyException * @throws NotFoundException */ final public function __construct( Template $template, Config $config, ContextInterface $context, EventDispatcher $eventDispatcher, Container $container) { $this->dic = $container; $this->request = $this->dic->get(Request::class); $this->view = $template; $this->config = $config; $this->configData = $config->getConfigData(); $this->context = $context; $this->eventDispatcher = $eventDispatcher; if (method_exists($this, 'initialize')) { $this->initialize(); } } }