private function protectedInclude()
    {
        $_tpl = $this;

        // View Helpers:
        // * Include another view into the current view:
        $_view = function ($tplName, $params = []) use ($_tpl) {
            $tplCopy = clone $_tpl; // Don't want to mess with the calling template's settings.
            echo($tplCopy->render($tplName, $params));
            unset($tplCopy);
        };
        // * Encode html for a 'Safe String'.
        $_ss = function ($str) {
            return htmlspecialchars($str, ENT_QUOTES);
        };

        // Extract template parameters into this local namespace.
        $allParams = (object) array_merge((array)self::$staticParams, (array)$this->params);
        extract(get_object_vars($allParams));
        unset($allParams);

        // Included template has access to variables local to this function.
        include($this->templateFile);
    }
private function protectedInclude()
    {
        $_tpl = $this;

        // View Helpers:
        // * Include another view into the current view:
        $_view = function ($tplName, $params = []) use ($_tpl) {
            $tplCopy = clone $_tpl; // Don't want to mess with the calling template's settings.
            echo($tplCopy->render($tplName, $params));
            unset($tplCopy);
        };
        // * Encode html for a 'Safe String'.
        $_ss = function ($str) {
            return htmlspecialchars($str, ENT_QUOTES);
        };

        // Extract template parameters into this local namespace.
        $allParams = (object) array_merge((array)self::$staticParams, (array)$this->params);
        extract(get_object_vars($allParams));
        unset($allParams);

        // Included template has access to variables local to this function.
        include($this->templateFile);
    }
private function protectedInclude ( ) { $ _tpl = $ this ; // View Helpers: // * Include another view into the current view: $ _view = function ( $ tplName , $ params = [ ] ) use ( $ _tpl ) { $ tplCopy = clone $ _tpl ; // Don't want to mess with the calling template's settings. echo ( $ tplCopy -> render ( $ tplName , $ params ) ) ; unset ( $ tplCopy ) ; } ; // * Encode html for a 'Safe String'. $ _ss = function ( $ str ) { return htmlspecialchars ( $ str , ENT_QUOTES ) ; } ; // Extract template parameters into this local namespace. $ allParams = ( object ) array_merge ( ( array ) self :: $ staticParams , ( array ) $ this -> params ) ; extract ( get_object_vars ( $ allParams ) ) ; unset ( $ allParams ) ; // Included template has access to variables local to this function. include ( $ this -> templateFile ) ; }
Wrap our template include into a method scope.
This allows our template to have access only to the template params.
It also prevents collisions with the global namespace.

This function also defines some template helpers:
$_ss(string $str) - Safe String. Html encode the string.
$_view(string $tplName, array $params) - include another template into the current one.

@return void
Wrap our template include into a method scope . This allows our template to have access only to the template params . It also prevents collisions with the global namespace .