/** * Inject helpers into the View * * In each case, injects with the custom url/serverurl implementations. * * @param View $renderer * @param ContainerInterface $container */ private function injectHelpers(View $renderer, ContainerInterface $container) { $helpers = $renderer->getHelpers(); $helpers->set('url', function () use($container) { if (!$container->has(UrlHelper::class)) { throw new Exception\MissingHelperException(sprintf('An instance of %s is required in order to create the "url" view helper; not found', UrlHelper::class)); } return $container->get(UrlHelper::class); }); $helpers->set('serverurl', function () use($container) { if (!$container->has(ServerUrlHelper::class)) { throw new Exception\MissingHelperException(sprintf('An instance of %s is required in order to create the "url" view helper; not found', ServerUrlHelper::class)); } return $container->get(ServerUrlHelper::class); }); }