<?php
/**
 * Typography Variable Processor
 *
 * @package Brandy\DynamicCss\Processors
 */

namespace Brandy\DynamicCss\Processors;

use Brandy\Utils\StylesDataHelpers;

/**
 * Processor for typography CSS variables
 */
class TypographyVariableProcessor extends AbstractVariableProcessor {

	/**
	 * Check if this processor supports the given type
	 *
	 * @param string $type Variable type.
	 * @return bool
	 */
	public function supports( string $type ): bool {
		return 'typography' === $type;
	}

	/**
	 * Process typography variable data
	 *
	 * @param array $variable_data Variable configuration.
	 * @return array Device-keyed CSS variables
	 */
	public function process( array $variable_data ): array {
		return StylesDataHelpers::get_typography_css_variables(
			$variable_data['value'],
			$variable_data['selector'] ?? ''
		);
	}
}
