| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace YayMailScoped\YayCommerce\AdminShell\Support; |
| 4 | 4 | |
| 5 | -\defined('ABSPATH') || exit; | |
| 5 | +defined('ABSPATH') || exit; | |
| 6 | 6 | /** |
| 7 | 7 | * Slug utilities. |
| 8 | 8 | * |
| 9 | 9 | * Plugin slugs can contain characters that are valid in wp_options keys |
| @@ -24,17 +24,17 @@ | ||
| 24 | 24 | * - Return '_' for empty / all-special input (never empty string) |
| 25 | 25 | * |
| 26 | 26 | * Idempotent: to_var_name( to_var_name( $x ) ) === to_var_name( $x ). |
| 27 | 27 | */ |
| 28 | - public static function to_var_name(string $slug) : string | |
| 28 | + public static function to_var_name(string $slug): string | |
| 29 | 29 | { |
| 30 | - $name = \preg_replace('/[^A-Za-z0-9_]/', '_', $slug); | |
| 31 | - $name = \preg_replace('/_+/', '_', (string) $name); | |
| 32 | - $name = \trim((string) $name, '_'); | |
| 30 | + $name = preg_replace('/[^A-Za-z0-9_]/', '_', $slug); | |
| 31 | + $name = preg_replace('/_+/', '_', (string) $name); | |
| 32 | + $name = trim((string) $name, '_'); | |
| 33 | 33 | if ('' === $name) { |
| 34 | 34 | return '_'; |
| 35 | 35 | } |
| 36 | - if (\preg_match('/^\\d/', $name)) { | |
| 36 | + if (preg_match('/^\d/', $name)) { | |
| 37 | 37 | $name = '_' . $name; |
| 38 | 38 | } |
| 39 | 39 | return $name; |
| 40 | 40 | } |