. */ namespace SP\Modules\Web\Controllers; use SP\Config\Config; use SP\Core\Acl; use SP\Core\Events\EventDispatcher; use SP\Core\Session\Session; use SP\Core\Traits\InjectableTrait; use SP\Core\UI\Theme; use SP\Storage\Database; /** * Class SimpleControllerBase * * @package SP\Modules\Web\Controllers */ abstract class SimpleControllerBase { use InjectableTrait; /** @var int Módulo a usar */ protected $action; /** @var string Nombre del controlador */ protected $controllerName; /** @var EventDispatcher */ protected $eventDispatcher; /** @var Config */ protected $config; /** @var Session */ protected $session; /** @var Database */ protected $db; /** @var Theme */ protected $theme; /** @var Acl */ protected $acl; /** * Constructor */ public function __construct() { $this->injectDependencies(); $class = static::class; $this->controllerName = substr($class, strrpos($class, '\\') + 1, -strlen('Controller')); if (method_exists($this, 'initialize')) { $this->initialize(); } } /** * @param Config $config * @param Session $session * @param Database $db * @param Theme $theme * @param EventDispatcher $ev * @param Acl $acl */ public function inject(Config $config, Session $session, Database $db, Theme $theme, EventDispatcher $ev, Acl $acl) { $this->config = $config; $this->session = $session; $this->db = $db; $this->theme = $theme; $this->eventDispatcher = $ev; $this->acl = $acl; } }