getConfig($container); $this->injectDisplayExceptions($strategy, $config); $this->injectExceptionMessage($strategy, $config); return $strategy; } /** * Create and return ExceptionStrategy instance * * For use with zend-servicemanager v2; proxies to __invoke(). * * @param ServiceLocatorInterface $container * @return ExceptionStrategy */ public function createService(ServiceLocatorInterface $container) { return $this($container, ExceptionStrategy::class); } /** * Inject strategy with configured display_exceptions flag. * * @param ExceptionStrategy $strategy * @param array $config */ private function injectDisplayExceptions(ExceptionStrategy $strategy, array $config) { $flag = array_key_exists('display_exceptions', $config) ? $config['display_exceptions'] : true; $strategy->setDisplayExceptions($flag); } /** * Inject strategy with configured exception_message * * @param ExceptionStrategy $strategy * @param array $config */ private function injectExceptionMessage(ExceptionStrategy $strategy, array $config) { if (isset($config['exception_message'])) { $strategy->setMessage($config['exception_message']); } } }