API / Minn\Runtime / DebugMode

DebugMode final class

Minn\Runtime\DebugMode · public/minn/src/Minn/Runtime/DebugMode.php · 104 lines

PHP's error settings from the debug constants, as the reference's boot sets them (wp_debug_mode(); contracts/fixtures/debug-mode.json holds the oracle's answer for each combination, and the unit suite replays it). WP_DEBUG reports every level, or only errors and warnings. With it on, WP_DEBUG_DISPLAY turns display on or off (null leaves PHP's own setting) and WP_DEBUG_LOG sends the log to a file. A request that answers a machine never displays errors.

Constants and properties

constQUIET = 4983

What PHP reports while WP_DEBUG is off: errors and warnings, no notices, strict or deprecation messages.

privateDEFAULTS = array ( 'WP_DEBUG' => false, 'WP_DEBUG_DISPLAY' => true, 'WP_DEBUG_LOG' => false, )

The debug constants, each with the value it has when wp-config.php leaves it out.

privateREQUESTS = array ( 0 => 'XMLRPC_REQUEST', 1 => 'REST_REQUEST', 2 => 'MS_FILES_REQUEST', 3 => 'WP_INSTALLING', 4 => 'DOING_AJAX', )

The request constants answersMachine() reads.

Public

staticsettings(array $constants, string $contentDir): array#

The settings the debug constants ask for: the error level, and the ini values to set (none for what they leave alone).

$constantsarray<string, mixed>the debug constants defined, by name; a missing one reads as its default
@return array{level: int, ini: array<string, string>}
staticlogPath(mixed $setting, string $contentDir): ?string#

Where WP_DEBUG_LOG sends the log. True, 1 or "true" in any case mean debug.log in the content folder; any other string but "" and "0" is the path itself, "false" included; anything else keeps no log.

staticanswersMachine(array $constants, array $server): bool#

Whether what the boot knows marks a request that answers a machine, whose errors must never print into the answer: XML-RPC, REST or ms-files declared at all, an install or ajax declared true, or a request that asks for or sends JSON (a JSONP or XML one is not). The facade's wp_debug_mode() asks the same through wp_installing(), wp_doing_ajax() and wp_is_json_request(), filters included.

$constantsarray<string, mixed>the request constants defined, by name
$serverarray<string, mixed>the request's server variables
staticdefined(): array#

The debug and request constants defined right now, by name.

@return array<string, mixed>
staticapply(array $settings): void#

Sets PHP's error level and ini values to what settings() asked for.

$settingsarray{level: int, ini: array<string, string>}