ameliabooking
/
vendor
/
melograno
/
usage-tracker
/
src
/
Collectors
/
Common
/
WpEnvironmentCollector.php
WpEnvironmentCollector.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AmeliaVendor\Melograno\UsageTracker\Collectors\Common; |
| 6 | |
| 7 | class WpEnvironmentCollector |
| 8 | { |
| 9 | /** |
| 10 | * @return array<string, mixed> |
| 11 | */ |
| 12 | public function collect(): array |
| 13 | { |
| 14 | global $wp_version; |
| 15 | |
| 16 | return array_filter([ |
| 17 | 'wp_version' => $wp_version ?? null, |
| 18 | 'php_version' => PHP_VERSION, |
| 19 | 'locale' => function_exists('get_locale') ? get_locale() : null, |
| 20 | 'is_multisite' => function_exists('is_multisite') ? is_multisite() : null, |
| 21 | 'timezone' => function_exists('wp_timezone_string') ? wp_timezone_string() : null, |
| 22 | ], static function ($value) { |
| 23 | return $value !== null; |
| 24 | }); |
| 25 | } |
| 26 | } |
| 27 |