code: public function render($nameOrModel, $values = array())
      {
          $model = null;
  
          if ($nameOrModel instanceof ModelInterface) {
              $model       = $nameOrModel;
              $nameOrModel = $model->getTemplate();
  
              if (empty($nameOrModel)) {
                  throw new Exception\DomainException(sprintf(
                      '%s: received View Model argument, but template is empty', __METHOD__
                  ));
              }
  
              $values = (array) $model->getVariables();
          }
  
          if (!$this->canRender($nameOrModel)) {
              return null;
          }
  
          if ($model && $this->canRenderTrees() && $model->hasChildren()) {
              if (!isset($values['content'])) {
                  $values['content'] = '';
              }
              foreach($model as $child) {
                  /** @var \Zend\View\Model\ViewModel $child */
                  if ($this->canRender($child->getTemplate())) {
                      $template = $this->resolver->resolve($child->getTemplate(), $this);
                      return $template->render((array) $child->getVariables());
                  }
                  $child->setOption('has_parent', true);
                  $values['content'] .= $this->view->render($child);
              }
          }
  
          /** @var $template \Twig_Template */
          $template = $this->resolver->resolve($nameOrModel, $this);
          return $template->render((array) $values);
      }
docs: Processes a view script and returns the output.
  
  @param  string|ModelInterface   $nameOrModel The script/resource process, or a view model
  @param  null|array|\ArrayAccess $values      Values to use during rendering
  @return string|null The script output.
  @throws \Zend\View\Exception\DomainException