/** * @param ContainerInterface $container * @return SendApiProblemResponseListener */ public function __invoke(ContainerInterface $container) { $config = $container->get('config'); $displayExceptions = isset($config['view_manager']) && isset($config['view_manager']['display_exceptions']) && $config['view_manager']['display_exceptions']; $listener = new SendApiProblemResponseListener(); $listener->setDisplayExceptions($displayExceptions); if ($container->has('Response')) { $response = $container->get('Response'); if ($response instanceof HttpResponse) { $listener->setApplicationResponse($response); } } return $listener; }
/** * {@inheritDoc} * @return SendApiProblemResponseListener */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config'); $displayExceptions = isset($config['view_manager']) && isset($config['view_manager']['display_exceptions']) && $config['view_manager']['display_exceptions']; $listener = new SendApiProblemResponseListener(); $listener->setDisplayExceptions($displayExceptions); if ($serviceLocator->has('Response')) { $response = $serviceLocator->get('Response'); if ($response instanceof HttpResponse) { $listener->setApplicationResponse($response); } } return $listener; }