. */ namespace SP\Providers; use DI\Container; use Psr\Container\ContainerInterface; use SP\Config\Config; use SP\Core\Context\ContextInterface; use SP\Core\Events\EventDispatcher; /** * Class Service * * @package SP\Providers */ abstract class Provider { const STATUS_INTERNAL_ERROR = 1000; /** * @var Config */ protected $config; /** * @var ContextInterface */ protected $context; /** * @var EventDispatcher */ protected $eventDispatcher; /** * @var ContainerInterface */ private $dic; /** * Provider constructor. * * @param Container $dic * * @throws \DI\DependencyException * @throws \DI\NotFoundException */ final public function __construct(Container $dic) { $this->dic = $dic; $this->config = $dic->get(Config::class); $this->context = $dic->get(ContextInterface::class); $this->eventDispatcher = $dic->get(EventDispatcher::class); if (method_exists($this, 'initialize')) { $this->initialize($dic); } } }