Debugger
in package
Simple debugger PHP 7.1+
Tags
Table of Contents
Properties
- $errorTypes : array<string|int, string>
- $session : string
- $attachments : array<string, mixed>
- $dir : string|null
- $email : string|null
- $file : string
- $memory : array<string, mixed>|null
- $query : array<string|int, array<string, mixed>>
- $runtimeError : array<string, string|int>|null
- $suppressed : bool
- $time : float
- $url : string|null
- $work : string|bool
Methods
- __construct() : mixed
- addAttachment() : void
- Append additional data to debugger
- disable() : void
- Disable debugger in html - turn to file work mode
- errorAccess() : void
- Logs the view of non-existent page
- getDir() : string|null
- Get working directory
- getWorkState() : string|bool
- Get work mode
- handleError() : null
- Ignore suppressed @ warnings
- handlerException() : void
- Handle exception based on mode
- handleShutDown() : void
- Handle shutdown
- loadMemory() : mixed|null
- Load memory from session
- log() : void
- Write error message into file
- renderDebugger() : void
- Prints debugger status bar
- renderError() : void
- Prints exception
- saveMemory() : void
- Save current debug into memory
- sendNotifyMail() : bool
- Send notify email with basic information about error
- setMail() : void
- Set email address
- sql() : void
- Log database request
- renderDebuggerLine() : void
- Prints debugger line
- exceptionFileExists() : bool
- Check if file log for current error already exist
- formatFileName() : string
- Format file name
- formatMemory() : float
- Format memory
- formatTime() : float
- Format time
- getData() : array<string, array<string|int, mixed>>
- Load all data for current debugger
- getRequestHeaders() : array<string|int, string>
- Returns request headers if possible
- getRequestMode() : int
- Returns request mode
- getResponseHeaders() : array<string|int, string>
- Returns response headers
- getTable() : string
- Get table with data
Properties
$errorTypes
public
static array<string|int, string>
$errorTypes
= [E_ERROR => 'FATAL ERROR', E_USER_ERROR => 'USER ERROR', E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR', E_PARSE => 'PARSE ERROR', E_CORE_ERROR => 'CORE ERROR', E_COMPILE_ERROR => 'COMPILE ERROR', E_WARNING => 'WARNING', E_USER_WARNING => 'USER WARNING', E_CORE_WARNING => 'CORE WARNING', E_COMPILE_WARNING => 'COMPILE WARNING', E_NOTICE => 'NOTICE', E_USER_NOTICE => 'USER NOTICE', E_STRICT => 'STRICT STANDARDS', E_DEPRECATED => 'DEPRECATED', E_USER_DEPRECATED => 'USER DEPRECATED']
$session
public
static string
$session
= 'rs-debugger'
$attachments
private
static array<string, mixed>
$attachments
= []
$dir
private
static string|null
$dir
= null
private
static string|null
$email
= null
Send notification on mail if hidden
$file
private
static string
$file
= 'exception'
$memory
private
static array<string, mixed>|null
$memory
= null
$query
private
static array<string|int, array<string, mixed>>
$query
= []
$runtimeError
private
static array<string, string|int>|null
$runtimeError
= null
$suppressed
private
static bool
$suppressed
= false
log suppressed errors
$time
private
static float
$time
= 0
$url
private
static string|null
$url
= null
$work
private
static string|bool
$work
= false
Methods
__construct()
public
__construct(string|bool $work[, string|null $dir = null ][, int|null $level = null ]) : mixed
Parameters
- $work : string|bool
- $dir : string|null = null
- $level : int|null = null
addAttachment()
Append additional data to debugger
public
static addAttachment(string $mark, string $name[, string|null $content = null ]) : void
Parameters
- $mark : string
- $name : string
- $content : string|null = null
disable()
Disable debugger in html - turn to file work mode
public
static disable([bool $terminate = false ]) : void
Parameters
- $terminate : bool = false
errorAccess()
Logs the view of non-existent page
public
static errorAccess(Throwable $e, string|null $path) : void
Parameters
- $e : Throwable
- $path : string|null
Tags
getDir()
Get working directory
public
static getDir() : string|null
Return values
string|nullgetWorkState()
Get work mode
public
static getWorkState() : string|bool
Return values
string|boolhandleError()
Ignore suppressed @ warnings
public
static handleError(int $errno, string $errstr[, string|null $errfile = null ][, int|null $errline = null ][, array<string|int, mixed>|null $errcontext = null ]) : null
Parameters
- $errno : int
- $errstr : string
- $errfile : string|null = null
- $errline : int|null = null
- $errcontext : array<string|int, mixed>|null = null
Return values
nullhandlerException()
Handle exception based on mode
public
static handlerException(Throwable $e) : void
Parameters
- $e : Throwable
handleShutDown()
Handle shutdown
public
static handleShutDown() : void
loadMemory()
Load memory from session
public
static loadMemory() : mixed|null
Return values
mixed|nulllog()
Write error message into file
public
static log(string $message[, string $file = 'error' ]) : void
Parameters
- $message : string
- $file : string = 'error'
renderDebugger()
Prints debugger status bar
public
static renderDebugger() : void
renderError()
Prints exception
public
static renderError(Throwable $e) : void
Parameters
- $e : Throwable
saveMemory()
Save current debug into memory
public
static saveMemory() : void
sendNotifyMail()
Send notify email with basic information about error
public
static sendNotifyMail(string $email, string $message) : bool
Parameters
- $email : string
- $message : string
Return values
boolsetMail()
Set email address
public
static setMail(string $email) : void
Parameters
- $email : string
sql()
Log database request
public
static sql(string $query, int|null $rows, float $time) : void
Parameters
- $query : string
- $rows : int|null
- $time : float
renderDebuggerLine()
Prints debugger line
protected
static renderDebuggerLine(array<string, array<string|int, mixed>> $data[, int|null $i = null ]) : void
Parameters
- $data : array<string, array<string|int, mixed>>
- $i : int|null = null
exceptionFileExists()
Check if file log for current error already exist
private
static exceptionFileExists(string $hash) : bool
Parameters
- $hash : string
Return values
boolformatFileName()
Format file name
private
static formatFileName(string $filePath) : string
Parameters
- $filePath : string
Return values
stringformatMemory()
Format memory
private
static formatMemory(int $num) : float
Parameters
- $num : int
Return values
floatformatTime()
Format time
private
static formatTime(float $time[, int $num = 2 ]) : float
Parameters
- $time : float
- $num : int = 2
Return values
floatgetData()
Load all data for current debugger
private
static getData(float $totalTime) : array<string, array<string|int, mixed>>
Parameters
- $totalTime : float
Return values
array<string, array<string|int, mixed>>getRequestHeaders()
Returns request headers if possible
private
static getRequestHeaders() : array<string|int, string>
Return values
array<string|int, string>getRequestMode()
Returns request mode
private
static getRequestMode() : int
Return values
intgetResponseHeaders()
Returns response headers
private
static getResponseHeaders() : array<string|int, string>
Return values
array<string|int, string>getTable()
Get table with data
private
static getTable(string $name, array<string, string> $array) : string
Parameters
- $name : string
- $array : array<string, string>