# elementor/4.3.2/modules/mcp/abilities/appliers/v3/mapper/css-declaration-parser.php

Elementor Website Builder – more than just a page builder, version 4.3.2. 57 lines.

- Page: https://pluginprobe.com/plugins/elementor/4.3.2/code/modules/mcp/abilities/appliers/v3/mapper/css-declaration-parser.php
- Raw: https://pluginprobe.com/plugins/elementor/4.3.2/raw/modules/mcp/abilities/appliers/v3/mapper/css-declaration-parser.php
- Modified: 2026-09-01T11:47:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elementor/4.3.2/code/modules/mcp/abilities/appliers/v3/mapper/css-declaration-parser.php#L10-L20`.

```php
<?php

namespace Elementor\Modules\Mcp\Abilities\Appliers\V3\Mapper;

use Elementor\Modules\Mcp\Abilities\Utils\Style_Variants_Merger;

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

/**
 * Extracts `property: value` declarations from a CSS block and normalizes selector
 * fragments into V3 pseudo-states (hover|focus|active or null).
 */
class Css_Declaration_Parser {

	/**
	 * @return array<int, array{property: string, value: string}>
	 */
	public function parse_declarations( string $css ): array {
		$rules = [];

		foreach ( explode( ';', $css ) as $declaration ) {
			$declaration = trim( $declaration );
			$separator = strpos( $declaration, ':' );

			if ( false === $separator ) {
				continue;
			}

			$property = strtolower( trim( substr( $declaration, 0, $separator ) ) );
			$value = trim( substr( $declaration, $separator + 1 ) );

			if ( '' === $property || '' === $value || 'null' === $value ) {
				continue;
			}

			$rules[] = [
				'property' => $property,
				'value' => $value,
			];
		}

		return $rules;
	}

	public function normalize_state( ?string $selector ): ?string {
		if ( null === $selector || '' === $selector ) {
			return null;
		}

		$state = strtolower( ltrim( $selector, ':' ) );

		return in_array( $state, Style_Variants_Merger::PSEUDO_STATES, true ) ? $state : null;
	}
}

```
