| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\AtomicWidgets\PropsResolver; |
| 4 |
|
| 5 |
use Elementor\Core\Utils\Collection; |
| 6 |
use Elementor\Utils; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
class Transformers_Registry extends Collection { |
| 13 |
public function register( string $key, Transformer_Base $transformer ): self { |
| 14 |
if ( isset( $this->items[ $key ] ) ) { |
| 15 |
Utils::safe_throw( "{$key} transformer is already registered." ); |
| 16 |
|
| 17 |
return $this; |
| 18 |
} |
| 19 |
|
| 20 |
$this->items[ $key ] = $transformer; |
| 21 |
|
| 22 |
return $this; |
| 23 |
} |
| 24 |
} |
| 25 |
|