<?php
/**
 * Email Template Helper
 */
class EmailTemplate
{

    /**
     * Render an email template with data
     * 
     * @param string $templateName
     * @param array $data
     * @return string
     */
    public static function render($templateName, $data = [])
    {
        $templatePath = __DIR__ . '/../../includes/emails/' . $templateName . '.php';

        if (!file_exists($templatePath)) {
            return "Error: Template not found.";
        }

        extract($data);
        ob_start();
        include $templatePath;
        return ob_get_clean();
    }
}
