File: /wordpress/plugins/wp-cloud-client/beta/src/Handler/GetDebugStatusHandler.php
<?php
declare(strict_types=1);
namespace VPlugins\WPCloudClient\Handler;
use VPlugins\WPCloudClient\Debug\WpConfigEditor;
final class GetDebugStatusHandler extends AbstractHandler {
/**
* Class constructor.
*
* @param WpConfigEditor $editor wp-config.php editor service.
*/
public function __construct(
private readonly WpConfigEditor $editor,
) {}
/**
* Return the action name.
*
* @return string Action name.
*/
public function action(): string {
return 'get_debug_status';
}
/**
* Return the current state of all WP debug constants.
*
* @param array<string, mixed> $params Unused.
* @return array<string, mixed> Current debug constant values.
*
* @throws \RuntimeException If wp-config.php cannot be read.
*/
public function execute( array $params ): array {
$constants = $this->editor->getConstants();
return [
'wp_debug' => $constants['WP_DEBUG'] ?? false,
'wp_debug_log' => $constants['WP_DEBUG_LOG'] ?? false,
'wp_debug_display' => $constants['WP_DEBUG_DISPLAY'] ?? false,
'script_debug' => $constants['SCRIPT_DEBUG'] ?? false,
];
}
}