src/Renderer.php
public function render(string $template, array $variables = null): string
    {
        list($path__, $env__) = call_user_func($this->resolve, $template, $variables);
        
        $renderer = $this;
        unset($template, $variables);
        extract($env__);
        ob_start();
        require($path__);
        $output = ob_get_clean();

        if ($this->next) {
            // wrapper has been specified. Then continue wrapper with current output.
            list($template, $variables) = $this->next;
            $next = new Renderer($this->resolve, $this->sections, $output);
            return $next->render($template, $variables);
        } else {
            return $output;
        }
    }
public function render(string $template, array $variables = null): string
    {
        list($path__, $env__) = call_user_func($this->resolve, $template, $variables);
        
        $renderer = $this;
        unset($template, $variables);
        extract($env__);
        ob_start();
        require($path__);
        $output = ob_get_clean();

        if ($this->next) {
            // wrapper has been specified. Then continue wrapper with current output.
            list($template, $variables) = $this->next;
            $next = new Renderer($this->resolve, $this->sections, $output);
            return $next->render($template, $variables);
        } else {
            return $output;
        }
    }
public function render ( string $ template , array $ variables = null ) : string { list ( $ path__ , $ env__ ) = call_user_func ( $ this -> resolve , $ template , $ variables ) ; $ renderer = $ this ; unset ( $ template , $ variables ) ; extract ( $ env__ ) ; ob_start ( ) ; require ( $ path__ ) ; $ output = ob_get_clean ( ) ; if ( $ this -> next ) { // wrapper has been specified. Then continue wrapper with current output. list ( $ template , $ variables ) = $ this -> next ; $ next = new Renderer ( $ this -> resolve , $ this -> sections , $ output ) ; return $ next -> render ( $ template , $ variables ) ; } else { return $ output ; } }
renders a specified template and returns output string.

If the template inherits/includes other templates, then instantiate the new renderer objects
and renders them all.

@param string $template path to the template to be rendered
@param array|null $variables template variables
@return string rendered content
renders a specified template and returns output string .