public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $phpRenderer = $serviceLocator->get('ViewRenderer');
     $renderer = new TwigRenderer($serviceLocator->get(View::class), $serviceLocator->get(Twig_LoaderInterface::class), $serviceLocator->get(Twig_Environment::class), $serviceLocator->get(TwigResolver::class), $phpRenderer, $serviceLocator->get(ConfigHelper::class)->get('view_manager.layout_inheritance'));
     $renderer->setHelperPluginManager($serviceLocator->get(HelperPluginManager::class));
     return $renderer;
 }
 /**
  * Determine if the renderer can load the requested template.
  *
  * @param ViewEvent $e
  * @return bool|TwigRenderer
  */
 public function selectRenderer(ViewEvent $e)
 {
     $model = $e->getModel();
     if (!$model instanceof ViewModel) {
         return false;
     }
     if ($this->renderer->canRender($model->getTemplate())) {
         return $this->renderer;
     }
     return false;
 }
 /**
  * 
  * @param ModelInterface $model
  * @return string
  */
 public function render(ModelInterface $model)
 {
     return $this->renderer->render($model);
 }