protected static function partialBlock(&$context, $vars) {
        if (count($context['partialblock']) > 0) {
            $ended = false;
            $append = $context['currentToken'][Token::POS_LOTHER] . $context['currentToken'][Token::POS_LSPACE];
            array_walk($context['partialblock'], function (&$pb) use ($append) {
                $pb .= $append;
            });
            if ($context['currentToken'][Token::POS_OP] === '/') {
                if (static::blockEnd($context, $vars, '#>') !== null) {
                    $c = $context['stack'][count($context['stack']) - 4];
                    $found = Partial::resolve($context, $vars[0][0]) !== null;
                    $v = $found ? "@partial-block{$context['parsed'][0][$c][1][Parser::PARTIALBLOCK]}" : "{$vars[0][0]}";
                    if (count($context['partialblock']) == 1) {
                        if ($found) {
                            $context['partials'][$v] = $context['partialblock'][0];
                        }
                        $context['usedPartial'][$v] = $context['partialblock'][0];
                        Partial::compileDynamic($context, $v);
                        if ($found) {
                            Partial::read($context, $vars[0][0]);
                        }
                    }
                    array_shift($context['partialblock']);
                    $context['parsed'][0] = array_slice($context['parsed'][0], 0, $c + 1);
                    $ended = true;
                }
            }
            $append = Token::toString($context['currentToken']);
            array_walk($context['partialblock'], function (&$pb) use ($context, $append) {
                $pb .= $append;
            });
            return $ended;
        }
    }
protected static function partialBlock(&$context, $vars) {
        if (count($context['partialblock']) > 0) {
            $ended = false;
            $append = $context['currentToken'][Token::POS_LOTHER] . $context['currentToken'][Token::POS_LSPACE];
            array_walk($context['partialblock'], function (&$pb) use ($append) {
                $pb .= $append;
            });
            if ($context['currentToken'][Token::POS_OP] === '/') {
                if (static::blockEnd($context, $vars, '#>') !== null) {
                    $c = $context['stack'][count($context['stack']) - 4];
                    $found = Partial::resolve($context, $vars[0][0]) !== null;
                    $v = $found ? "@partial-block{$context['parsed'][0][$c][1][Parser::PARTIALBLOCK]}" : "{$vars[0][0]}";
                    if (count($context['partialblock']) == 1) {
                        if ($found) {
                            $context['partials'][$v] = $context['partialblock'][0];
                        }
                        $context['usedPartial'][$v] = $context['partialblock'][0];
                        Partial::compileDynamic($context, $v);
                        if ($found) {
                            Partial::read($context, $vars[0][0]);
                        }
                    }
                    array_shift($context['partialblock']);
                    $context['parsed'][0] = array_slice($context['parsed'][0], 0, $c + 1);
                    $ended = true;
                }
            }
            $append = Token::toString($context['currentToken']);
            array_walk($context['partialblock'], function (&$pb) use ($context, $append) {
                $pb .= $append;
            });
            return $ended;
        }
    }
protected static function partialBlock ( & $ context , $ vars ) { if ( count ( $ context [ 'partialblock' ] ) > 0 ) { $ ended = false ; $ append = $ context [ 'currentToken' ] [ Token :: POS_LOTHER ] . $ context [ 'currentToken' ] [ Token :: POS_LSPACE ] ; array_walk ( $ context [ 'partialblock' ] , function ( & $ pb ) use ( $ append ) { $ pb .= $ append ; } ) ; if ( $ context [ 'currentToken' ] [ Token :: POS_OP ] === '/' ) { if ( static :: blockEnd ( $ context , $ vars , '#>' ) !== null ) { $ c = $ context [ 'stack' ] [ count ( $ context [ 'stack' ] ) - 4 ] ; $ found = Partial :: resolve ( $ context , $ vars [ 0 ] [ 0 ] ) !== null ; $ v = $ found ? "@partial-block{$context['parsed'][0][$c][1][Parser::PARTIALBLOCK]}" : "{$vars[0][0]}" ; if ( count ( $ context [ 'partialblock' ] ) == 1 ) { if ( $ found ) { $ context [ 'partials' ] [ $ v ] = $ context [ 'partialblock' ] [ 0 ] ; } $ context [ 'usedPartial' ] [ $ v ] = $ context [ 'partialblock' ] [ 0 ] ; Partial :: compileDynamic ( $ context , $ v ) ; if ( $ found ) { Partial :: read ( $ context , $ vars [ 0 ] [ 0 ] ) ; } } array_shift ( $ context [ 'partialblock' ] ) ; $ context [ 'parsed' ] [ 0 ] = array_slice ( $ context [ 'parsed' ] [ 0 ] , 0 , $ c + 1 ) ; $ ended = true ; } } $ append = Token :: toString ( $ context [ 'currentToken' ] ) ; array_walk ( $ context [ 'partialblock' ] , function ( & $ pb ) use ( $ context , $ append ) { $ pb .= $ append ; } ) ; return $ ended ; } }
validate partial block token

@param array<string,array|string|integer> $context current compile context
@param array<boolean|integer|string|array> $vars parsed arguments list

@return boolean|null Return true when partial block ends
validate partial block token