/** * Get the DI container. * * @return Container * * @since 1.0 * @throws \UnexpectedValueException May be thrown if the container has not been set. */ public function getContainer() { if (!$this->container) { $this->container = Container::getInstance(); } return $this->container; }
/** * Contructor. * * @param Container $container */ public function __construct(Container $container = null) { $this->container = $container ?: Container::getInstance(); }