custom_css). Emits the * canonical Span PropValue from generate(). */ class Span_Property_Converter extends Property_Converter_Base { private string $property; private ?string $pattern; /** * @param string $property The schema property this converter owns. * @param string|null $pattern The Span regex sourced from the schema, or null for no constraint. */ public function __construct( string $property, ?string $pattern = null ) { $this->property = $property; $this->pattern = $pattern; } protected function get_supported_properties(): array { return [ $this->property ]; } protected function do_convert( Conversion_Context $context, array $rule ): bool { $value = trim( $rule['value'] ); if ( '' === $value ) { return false; } if ( null !== $this->pattern && 1 !== preg_match( $this->pattern, $value ) ) { return false; } $context->set_prop( $this->property, Span_Prop_Type::generate( $value ) ); return true; } }