protected function replaceVariablesInTemplate(string $template, array $variables) : string
    {
        $template = preg_replace_callback(
            '/\{\{\s*' . self::REGEX_VARIABLE . '\s*\}\}/i',
            function (array $matches) use ($variables): string {
                return (string) $this->getValue($matches, $variables);
            },
            $template
        );

        return $template;
    }
protected function replaceVariablesInTemplate(string $template, array $variables) : string
    {
        $template = preg_replace_callback(
            '/\{\{\s*' . self::REGEX_VARIABLE . '\s*\}\}/i',
            function (array $matches) use ($variables): string {
                return (string) $this->getValue($matches, $variables);
            },
            $template
        );

        return $template;
    }
protected function replaceVariablesInTemplate ( string $ template , array $ variables ) : string { $ template = preg_replace_callback ( '/\{\{\s*' . self :: REGEX_VARIABLE . '\s*\}\}/i' , function ( array $ matches ) use ( $ variables ) : string { return ( string ) $ this -> getValue ( $ matches , $ variables ) ; } , $ template ) ; return $ template ; }
Replace variables in a given template section and execute function calls

@param string $template  The template section
@param array  $variables The current variable scope

@return string
@throws UndefinedSymbolException
@throws SyntaxErrorException
Replace variables in a given template section and execute function calls