src/Leevel/View/Parser.php
protected function compileTheme(array &$theme): void
    {
        foreach ($theme['children'] as $key => $value) {
            $source = $value['source'];

            // 编译子对象
            $this->compileTheme($value);
            $theme['children'][$key] = $value;

            // 置换对象
            $start = strpos($theme['content'], $source);
            $len = $value['position']['end'] - $value['position']['start'] + 1;

            $theme['content'] = substr_replace(
                $theme['content'], $value['content'],
                $start, $len);
        }

        // 编译自身
        if ($theme['compiler']) {
            $compilers = $theme['compiler'].'Compiler';
            $this->compiler->{$compilers}($theme);
        }
    }
protected function compileTheme(array &$theme): void
    {
        foreach ($theme['children'] as $key => $value) {
            $source = $value['source'];

            // 编译子对象
            $this->compileTheme($value);
            $theme['children'][$key] = $value;

            // 置换对象
            $start = strpos($theme['content'], $source);
            $len = $value['position']['end'] - $value['position']['start'] + 1;

            $theme['content'] = substr_replace(
                $theme['content'], $value['content'],
                $start, $len);
        }

        // 编译自身
        if ($theme['compiler']) {
            $compilers = $theme['compiler'].'Compiler';
            $this->compiler->{$compilers}($theme);
        }
    }
分析模板调用编译器编译.

@param array $theme