. */ namespace SP\Repositories; use SP\Config\Config; use SP\Core\Dic\Container; use SP\Core\Events\EventDispatcher; use SP\Core\Session\Session; use SP\Storage\Database; use SP\Storage\DatabaseInterface; /** * Class Repository * * @package SP\Repositories */ abstract class Repository { /** * @var Config */ protected $config; /** * @var Session */ protected $session; /** * @var EventDispatcher */ protected $eventDispatcher; /** * @var DatabaseInterface */ protected $db; /** * @var Container */ private $dic; /** * Repository constructor. * * @param Container $dic * @param Config $config * @param Database $database * @param Session $session * @param EventDispatcher $eventDispatcher * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ final public function __construct(Container $dic, Config $config, Database $database, Session $session, EventDispatcher $eventDispatcher) { $this->dic = $dic; $this->config = $config; $this->db = $database; $this->session = $session; $this->eventDispatcher = $eventDispatcher; if (method_exists($this, 'initialize')) { $this->initialize(); } } }