/**
  * Wraps one ViewHelper argument evaluation in a closure that can be
  * rendered by passing a rendering context.
  *
  * @param ViewHelperNode $node
  * @param string $argumentName
  * @return string
  */
 public function wrapViewHelperNodeArgumentEvaluationInClosure(ViewHelperNode $node, $argumentName)
 {
     $arguments = $node->getArguments();
     $argument = $arguments[$argumentName];
     $closure = 'function() use ($renderingContext, $self) {' . chr(10);
     if ($node->getArgumentDefinition($argumentName)->getType() === 'boolean') {
         // We treat boolean nodes by compiling a closure to evaluate the stack of the boolean argument
         $compiledIfArgumentStack = $this->nodeConverter->convert(new ArrayNode($argument->getStack()));
         $closure .= $compiledIfArgumentStack['initialization'] . chr(10);
         $closure .= sprintf('return \\NamelessCoder\\Fluid\\Core\\Parser\\SyntaxTree\\BooleanNode::evaluateStack($renderingContext, %s);', $compiledIfArgumentStack['execution']) . chr(10);
     } else {
         $closure .= sprintf('$argument = unserialize(\'%s\'); return $argument->evaluate($renderingContext);', serialize($argument)) . chr(10);
     }
     $closure .= '}';
     return $closure;
 }