Example #1
0
 /**
  * Process variable
  *
  * @param Context $context current context
  * @param array   $current section node data
  * @param boolean $escaped escape result or not
  *
  * @return string the result
  */
 private function _getVariable(Context $context, $current, $escaped)
 {
     $name = $current[Tokenizer::NAME];
     $value = $context->get($name);
     if ($name == '@index') {
         return $context->lastIndex();
     }
     if ($name == '@key') {
         return $context->lastKey();
     }
     if ($escaped) {
         $args = $this->handlebars->getEscapeArgs();
         array_unshift($args, $value);
         $value = call_user_func_array($this->handlebars->getEscape(), array_values($args));
     }
     return $value;
 }