. */ namespace SP\Repositories; use SP\Config\Config; use SP\Core\Context\ContextInterface; use SP\Core\Events\EventDispatcher; use SP\Storage\Database\Database; /** * Class Repository * * @package SP\Repositories */ abstract class Repository { /** * @var Config */ protected $config; /** * @var ContextInterface */ protected $context; /** * @var EventDispatcher */ protected $eventDispatcher; /** * @var Database */ protected $db; /** * Repository constructor. * * @param Config $config * @param Database $database * @param ContextInterface $session * @param EventDispatcher $eventDispatcher */ final public function __construct(Config $config, Database $database, ContextInterface $session, EventDispatcher $eventDispatcher) { $this->config = $config; $this->db = $database; $this->context = $session; $this->eventDispatcher = $eventDispatcher; if (method_exists($this, 'initialize')) { $this->initialize(); } } }