LightnCandy\Compiler::compileToken PHP Method

compileToken() protected static method

Return compiled PHP code for a handlebars token
protected static compileToken ( array\arraystring | integer> &$context, array\array $info ) : string
$context array\arraystring | integer>
$info array\array
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;
        if ($ret = static::operator($token[Token::POS_OP], $context, $vars)) {
            return $ret;
        }
        if (isset($vars[0][0])) {
            if ($ret = static::customHelper($context, $vars, $raw, true)) {
                return static::compileOutput($context, $ret, 'FIXME: helper', $raw, false);
            }
            if ($context['flags']['else'] && $vars[0][0] === 'else') {
                return static::doElse($context, $vars);
            }
            if ($vars[0][0] === 'lookup') {
                return static::compileLookup($context, $vars, $raw);
            }
            if ($vars[0][0] === 'log') {
                return static::compileLog($context, $vars, $raw);
            }
        }
        return static::compileVariable($context, $vars, $raw, false);
    }