. */ namespace SP\Services; use Psr\Container\ContainerInterface; use SP\Bootstrap; use SP\Config\Config; use SP\Core\Events\EventDispatcher; use SP\Core\Session\Session; /** * Class Service * * @package SP\Services */ abstract class Service { const STATUS_INTERNAL_ERROR = 1000; /** * @var Config */ protected $config; /** * @var Session */ protected $session; /** * @var EventDispatcher */ protected $eventDispatcher; /** * @var ContainerInterface */ protected $dic; /** * Service constructor. * * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ final public function __construct() { $this->dic = Bootstrap::getContainer(); $this->config = $this->dic->get(Config::class); $this->session = $this->dic->get(Session::class); $this->eventDispatcher = $this->dic->get(EventDispatcher::class); if (method_exists($this, 'initialize')) { $this->initialize(); } } }