<?php
/**
 * Run user snippet PHP in the global namespace.
 *
 * eval() from CodeSnippet\Module would define functions as CodeSnippet\name, while
 * add_action( '…', 'name' ) registers a global callback — mismatched and breaks typical snippets.
 *
 * @package CodeSnippet
 */

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

if ( ! function_exists( 'wp_powersuite_code_snippet_eval' ) ) {
	/**
	 * @param string $code Raw PHP (no <?php tag).
	 */
	function wp_powersuite_code_snippet_eval( string $code ): void {
		if ( $code === '' ) {
			return;
		}
		// phpcs:ignore Generic.PHP.ForbiddenFunctions.Found -- Intentional: user PHP snippets.
		eval( $code );
	}
}
