<?php
namespace Prodigy\Includes\Helpers;

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

/**
 * Class Prodigy_Parameters
 *
 * A class that provides methods to handle specific parameters.
 */
class Prodigy_Parameters {

	/**
	 * @param array         $data
	 * @param string        $key
	 * @param string        $sanitize_type
	 * @param $default_value
	 *
	 * @return mixed|null
	 */
	public static function get_parameter( array $data, string $key, string $sanitize_type = 'sanitize_text_field', $default_value = null ) {
		if ( isset( $data[ $key ] ) && function_exists( $sanitize_type ) ) {
			return $sanitize_type( wp_unslash( $data[ $key ] ) );
		}
		return $default_value;
	}
}
