<?php

namespace Formatrica\Frontend;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Holds the active Form_Render_Extension_Interface. Defaults to the inert Null
 * extension (Free); the Pro package swaps in Pro_Form_Render_Extension during
 * boot. Form_Renderer reads current() per render.
 */
final class Form_Render_Extensions
{
    private static ?Form_Render_Extension_Interface $current = null;

    public static function current(): Form_Render_Extension_Interface
    {
        if (self::$current === null) {
            self::$current = new Null_Form_Render_Extension();
        }

        return self::$current;
    }

    public static function set(?Form_Render_Extension_Interface $extension): void
    {
        self::$current = $extension;
    }
}
