src/Psr11Container.php 1 location
|
@@ 50-56 (lines=7) @@
|
| 47 |
|
$container = $this; |
| 48 |
|
|
| 49 |
|
try { |
| 50 |
|
switch (true) { |
| 51 |
|
case ($maybeFactory instanceof Just): |
| 52 |
|
/** @var Just $maybeFactory */ |
| 53 |
|
return ($maybeFactory->get())($container, $id); |
| 54 |
|
case ($maybeFactory instanceof Nothing): |
| 55 |
|
throw NotFoundException::forKey($id); |
| 56 |
|
} |
| 57 |
|
} catch (\Throwable $e) { |
| 58 |
|
if ($e instanceof NotFoundExceptionInterface) { |
| 59 |
|
throw $e; |
src/TypedContainer.php 1 location
|
@@ 44-50 (lines=7) @@
|
| 41 |
|
$container = $this; |
| 42 |
|
|
| 43 |
|
try { |
| 44 |
|
switch (true) { |
| 45 |
|
case ($maybeFactory instanceof Just): |
| 46 |
|
/** @var Just $maybeFactory */ |
| 47 |
|
return Result::just(($maybeFactory->get())($container, $id)); |
| 48 |
|
case ($maybeFactory instanceof Nothing): |
| 49 |
|
return Result::notFound(); |
| 50 |
|
} |
| 51 |
|
} catch (\Throwable $e) { |
| 52 |
|
return Result::exception($e); |
| 53 |
|
} |