| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\AtomicWidgets\Styles; |
| 4 |
|
| 5 |
class Style_Variant { |
| 6 |
private ?string $breakpoint = null; |
| 7 |
private ?string $state = null; |
| 8 |
|
| 9 |
/** @var array<string, array> */ |
| 10 |
private array $props = []; |
| 11 |
|
| 12 |
public static function make(): self { |
| 13 |
return new self(); |
| 14 |
} |
| 15 |
|
| 16 |
public function set_breakpoint( string $breakpoint ): self { |
| 17 |
$this->breakpoint = $breakpoint; |
| 18 |
return $this; |
| 19 |
} |
| 20 |
|
| 21 |
public function set_state( string $state ): self { |
| 22 |
$this->state = $state; |
| 23 |
return $this; |
| 24 |
} |
| 25 |
|
| 26 |
public function add_prop( string $key, $value ): self { |
| 27 |
$this->props[ $key ] = $value; |
| 28 |
return $this; |
| 29 |
} |
| 30 |
|
| 31 |
public function add_props( array $props ): self { |
| 32 |
$this->props = array_merge( $this->props, $props ); |
| 33 |
return $this; |
| 34 |
} |
| 35 |
|
| 36 |
public function build(): array { |
| 37 |
return [ |
| 38 |
'meta' => [ |
| 39 |
'breakpoint' => $this->breakpoint, |
| 40 |
'state' => $this->state, |
| 41 |
], |
| 42 |
'props' => $this->props, |
| 43 |
]; |
| 44 |
} |
| 45 |
} |
| 46 |
|