| @@ 18-38 (lines=21) @@ | ||
| 15 | use Zend\ServiceManager\FactoryInterface; | |
| 16 | use Zend\ServiceManager\ServiceLocatorInterface; | |
| 17 | ||
| 18 | final class LogThrowableFactory implements FactoryInterface | |
| 19 | { | |
| 20 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) | |
| 21 |     { | |
| 22 | /** @var ThrowableLogger $throwableLogger */ | |
| 23 | $throwableLogger = $container->get(ThrowableLogger::class); | |
| 24 | ||
| 25 | return new LogThrowable($throwableLogger); | |
| 26 | } | |
| 27 | ||
| 28 | /** | |
| 29 | * Create service | |
| 30 | * | |
| 31 | * @param ServiceLocatorInterface $serviceLocator | |
| 32 | * @return mixed | |
| 33 | */ | |
| 34 | public function createService(ServiceLocatorInterface $serviceLocator) | |
| 35 |     { | |
| 36 | return $this($serviceLocator->getServiceLocator(), ThrowableLogger::class); | |
| 37 | } | |
| 38 | } | |
| 39 | ||
| @@ 18-38 (lines=21) @@ | ||
| 15 | use Zend\ServiceManager\FactoryInterface; | |
| 16 | use Zend\ServiceManager\ServiceLocatorInterface; | |
| 17 | ||
| 18 | final class LogThrowableFactory implements FactoryInterface | |
| 19 | { | |
| 20 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) | |
| 21 |     { | |
| 22 | /** @var ThrowableLogger $throwableLogger */ | |
| 23 | $throwableLogger = $container->get(ThrowableLogger::class); | |
| 24 | ||
| 25 | return new LogThrowable($throwableLogger); | |
| 26 | } | |
| 27 | ||
| 28 | /** | |
| 29 | * Create service | |
| 30 | * | |
| 31 | * @param ServiceLocatorInterface $serviceLocator | |
| 32 | * @return mixed | |
| 33 | */ | |
| 34 | public function createService(ServiceLocatorInterface $serviceLocator) | |
| 35 |     { | |
| 36 | return $this($serviceLocator->getServiceLocator(), ThrowableLogger::class); | |
| 37 | } | |
| 38 | } | |
| 39 | ||