| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Mcp\Abilities\Appliers\V3\Serializer; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
/** |
| 10 |
* Groups CSS declarations by breakpoint + pseudo-state for the serializer's output. |
| 11 |
* |
| 12 |
* Structure: blocks[breakpoint][state][property] = value |
| 13 |
* where state === '' represents the base (no pseudo-state) group. |
| 14 |
*/ |
| 15 |
class V3_Block_Accumulator { |
| 16 |
|
| 17 |
/** @var array<string, array<string, array<string, string>>> */ |
| 18 |
private array $blocks = []; |
| 19 |
|
| 20 |
public function push( string $breakpoint, ?string $state, string $property, string $value ): void { |
| 21 |
$state_key = $state ?? ''; |
| 22 |
|
| 23 |
$this->blocks[ $breakpoint ][ $state_key ][ $property ] = $value; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* @return array<string, array<string, array<string, string>>> |
| 28 |
*/ |
| 29 |
public function all(): array { |
| 30 |
return $this->blocks; |
| 31 |
} |
| 32 |
} |
| 33 |
|