コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
ファイル: Container.php プロジェクト: ultra-lite/container
 /**
  * @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];
 }