public function get($id)
 {
     try {
         return $this->container[$id];
     } catch (\InvalidArgumentException $prev) {
         throw AcclimateNotFoundException::fromPrevious($id, $prev);
     } catch (\Exception $prev) {
         throw AcclimateContainerException::fromPrevious($id, $prev);
     }
 }
 public function get($id)
 {
     try {
         return $this->container->get($id);
     } catch (PhpDiNotFoundException $prev) {
         throw AcclimateNotFoundException::fromPrevious($id, $prev);
     } catch (\Exception $prev) {
         throw AcclimateContainerException::fromPrevious($id, $prev);
     }
 }
 public function get($id)
 {
     try {
         $result = $this->container->get($id);
     } catch (\Exception $prev) {
         throw AcclimateContainerException::fromPrevious($id, $prev);
     }
     if ($result === null) {
         throw AcclimateNotFoundException::fromPrevious($id);
     }
     return $result;
 }
 public function get($id)
 {
     if ($this->container->bound($id)) {
         try {
             return $this->container->make($id);
         } catch (\Exception $prev) {
             throw AcclimateContainerException::fromPrevious($id, $prev);
         }
     } else {
         throw AcclimateNotFoundException::fromPrevious($id);
     }
 }
Ejemplo n.º 5
0
 public function get($id)
 {
     if (isset($this->data[$id])) {
         try {
             if ($this->data[$id] instanceof \Closure) {
                 $this->data[$id] = call_user_func($this->data[$id], $this->delegateLookupContainer);
             }
         } catch (\Exception $prev) {
             throw ContainerException::fromPrevious($id, $prev);
         }
         return $this->data[$id];
     } else {
         throw NotFoundException::fromPrevious($id);
     }
 }
 /**
  * @dataProvider getDataForFactoryTest
  */
 public function testFactoryMethodProducesException($id, $prev, $message)
 {
     $exception = ContainerException::fromPrevious($id, $prev);
     $this->assertEquals($message, $exception->getMessage());
 }