public function render()
{
$as = $this->arguments['as'];
if (false === $this->viewHelperVariableContainer->exists(AbstractMenuViewHelper::class, 'deferredArray')) {
return null;
}
if (false === $this->viewHelperVariableContainer->exists(AbstractMenuViewHelper::class, 'deferredString')) {
return null;
}
if (null === $as) {
$content = $this->viewHelperVariableContainer->get(AbstractMenuViewHelper::class, 'deferredString');
$this->unsetDeferredVariableStorage();
return $content;
} elseif (true === empty($as)) {
throw new Exception('An "as" attribute was used but was empty - use a proper string value', 1370096373);
}
if (true === $this->templateVariableContainer->exists($as)) {
$backupVariable = $this->templateVariableContainer->get($as);
$this->templateVariableContainer->remove($as);
}
$this->templateVariableContainer->add($as, $this->viewHelperVariableContainer->get(AbstractMenuViewHelper::class, 'deferredArray'));
$this->unsetDeferredVariableStorage();
$content = $this->renderChildren();
$this->templateVariableContainer->remove($as);
if (true === isset($backupVariable)) {
$this->templateVariableContainer->add($as, $backupVariable);
}
return $content;
}