| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\AtomicWidgets\CssConverter; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; // Exit if accessed directly. |
| 7 |
} |
| 8 |
|
| 9 |
class Css_Var_Reference { |
| 10 |
public static function parse( string $value ): ?string { |
| 11 |
$value = trim( $value ); |
| 12 |
|
| 13 |
if ( ! preg_match( '/^var\(\s*(--)?([^,\s)]+)/i', $value, $matches ) ) { |
| 14 |
return null; |
| 15 |
} |
| 16 |
|
| 17 |
$token = trim( $matches[2] ); |
| 18 |
|
| 19 |
return '' === $token ? null : ltrim( $token, '-' ); |
| 20 |
} |
| 21 |
} |
| 22 |
|