XdebugHandler
in package
Tags
Table of Contents
Constants
- DEBUG = 'XDEBUG_HANDLER_DEBUG'
- RESTART_ID = 'internal'
- RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS'
- SUFFIX_ALLOW = '_ALLOW_XDEBUG'
- SUFFIX_INIS = '_ORIGINAL_INIS'
Properties
- $tmpIni : string|null
Methods
- __construct() : mixed
- Constructor
- check() : void
- Checks if Xdebug is loaded and the process needs to be restarted
- getAllIniFiles() : array<int, string>
- Returns an array of php.ini locations with at least one entry
- getRestartSettings() : array<string|int, mixed>|null
- Returns an array of restart settings or null
- getSkippedVersion() : string
- Returns the Xdebug version that triggered a successful restart
- isXdebugActive() : bool
- Returns whether Xdebug is loaded and active
- setLogger() : self
- Activates status message output to a PSR3 logger
- setMainScript() : self
- Sets the main script location if it cannot be called from argv
- setPersistent() : self
- Persist the settings to keep Xdebug out of sub-processes
- requiresRestart() : bool
- Allows an extending class to decide if there should be a restart
- restart() : void
- Allows an extending class to access the tmpIni
Constants
DEBUG
public
mixed
DEBUG
= 'XDEBUG_HANDLER_DEBUG'
RESTART_ID
public
mixed
RESTART_ID
= 'internal'
RESTART_SETTINGS
public
mixed
RESTART_SETTINGS
= 'XDEBUG_HANDLER_SETTINGS'
SUFFIX_ALLOW
public
mixed
SUFFIX_ALLOW
= '_ALLOW_XDEBUG'
SUFFIX_INIS
public
mixed
SUFFIX_INIS
= '_ORIGINAL_INIS'
Properties
$tmpIni
protected
string|null
$tmpIni
Methods
__construct()
Constructor
public
__construct(string $envPrefix) : mixed
The $envPrefix is used to create distinct environment variables. It is uppercased and prepended to the default base values. For example 'myapp' would result in MYAPP_ALLOW_XDEBUG and MYAPP_ORIGINAL_INIS.
Parameters
- $envPrefix : string
-
Value used in environment variables
Tags
check()
Checks if Xdebug is loaded and the process needs to be restarted
public
check() : void
This behaviour can be disabled by setting the MYAPP_ALLOW_XDEBUG environment variable to 1. This variable is used internally so that the restarted process is created only once.
getAllIniFiles()
Returns an array of php.ini locations with at least one entry
public
static getAllIniFiles() : array<int, string>
The equivalent of calling php_ini_loaded_file then php_ini_scanned_files. The loaded ini location is the first entry and may be an empty string.
Return values
array<int, string>getRestartSettings()
Returns an array of restart settings or null
public
static getRestartSettings() : array<string|int, mixed>|null
Settings will be available if the current process was restarted, or called with the settings from an existing restart.
Tags
Return values
array<string|int, mixed>|nullgetSkippedVersion()
Returns the Xdebug version that triggered a successful restart
public
static getSkippedVersion() : string
Return values
stringisXdebugActive()
Returns whether Xdebug is loaded and active
public
static isXdebugActive() : bool
true: if Xdebug is loaded and is running in an active mode. false: if Xdebug is not loaded, or it is running with xdebug.mode=off.
Return values
boolsetLogger()
Activates status message output to a PSR3 logger
public
setLogger(LoggerInterface $logger) : self
Parameters
- $logger : LoggerInterface
Return values
selfsetMainScript()
Sets the main script location if it cannot be called from argv
public
setMainScript(string $script) : self
Parameters
- $script : string
Return values
selfsetPersistent()
Persist the settings to keep Xdebug out of sub-processes
public
setPersistent() : self
Return values
selfrequiresRestart()
Allows an extending class to decide if there should be a restart
protected
requiresRestart(bool $default) : bool
The default is to restart if Xdebug is loaded and its mode is not "off".
Parameters
- $default : bool
Return values
boolrestart()
Allows an extending class to access the tmpIni
protected
restart(array<int, string> $command) : void
Parameters
- $command : array<int, string>