/**
* Return compiled PHP code for a handlebars token
*
* @param array<string,array|string|integer> $context current compile context
* @param array<string,array|boolean> $info parsed information
*
* @return string Return compiled code segment for the token
*/
protected static function compileToken(&$context, $info)
{
list($raw, $vars, $token, $indent) = $info;
$context['tokens']['partialind'] = $indent;
$context['currentToken'] = $token;
// Do not touch the tag, keep it as is.
if ($raw === -1) {
return ".'" . Token::toString($token) . "'.";
}
if ($ret = static::operator($token[Token::POS_OP], $context, $vars)) {
return $ret;
}
if (isset($vars[0][0])) {
if ($ret = static::customHelper($context, $vars, $raw)) {
return $ret;
}
if ($vars[0][0] === 'else') {
return static::doElse($context);
}
if ($vars[0][0] === 'lookup') {
return static::compileLookup($context, $vars, $raw);
}
}
return static::compileVariable($context, $vars, $raw);
}