/** * @param string $serviceId * @return mixed */ public function get($serviceId) { foreach ($this->containers as $container) { if ($container->has($serviceId)) { return $container->get($serviceId); } } throw DiServiceNotFound::createFromServiceId($serviceId); }
/** * @throws NotFoundException * * @param string $serviceId * @return mixed */ public function get($serviceId) { if (!$this->has($serviceId)) { throw DiServiceNotFound::createFromServiceId($serviceId); } if (!isset($this->services[$serviceId])) { $this->services[$serviceId] = $this->getServiceFromFactory($serviceId); } return $this->services[$serviceId]; }