class Debug (View source)

Supports debugging and core error handling.

Attaches custom methods to the default error handling hooks in PHP. Currently, two levels of error are supported:

  • Notice
  • Warning
  • Error

Uncaught exceptions are currently passed to the debug reporter as standard PHP errors.

Errors handled by this class are passed along to SS_Log. For configuration information, see the SS_Log class documentation.

add support for user defined config: Debug::die_on_notice(true | false) better way of figuring out the error context to display in highlighted source

Methods

public static 
show(mixed $val, bool $showHeader = true, HTTPRequest $request = null)

Show the contents of val in a debug-friendly way.

public static 
array
caller()

Returns the caller for a specific method

public static 
endshow(mixed $val, bool $showHeader = true, HTTPRequest $request = null)

Close out the show dumper.

public static 
dump(mixed $val, HTTPRequest $request = null)

Quick dump of a variable.

public static 
string
text(mixed $val, HTTPRequest $request = null)

Get debug text for this object

public static 
message(string $message, bool $showHeader = true, HTTPRequest $request = null)

Show a debugging message.

public static 
create_debug_view(HTTPRequest $request = null)

Create an instance of an appropriate DebugView object.

protected static 
bool
supportsHTML(HTTPRequest $request = null)

Determine if the given request supports html output

public static 
require_developer_login()

Check if the user has permissions to run URL debug tools, else redirect them to log in.

Details

static show(mixed $val, bool $showHeader = true, HTTPRequest $request = null)

Show the contents of val in a debug-friendly way.

Debug::show() is intended to be equivalent to dprintr() Does not work on live mode.

Parameters

mixed $val
bool $showHeader
HTTPRequest $request

static array caller()

Returns the caller for a specific method

Return Value

array

static endshow(mixed $val, bool $showHeader = true, HTTPRequest $request = null)

Close out the show dumper.

Does not work on live mode

Parameters

mixed $val
bool $showHeader
HTTPRequest $request

static dump(mixed $val, HTTPRequest $request = null)

Quick dump of a variable.

Note: This method will output in live!

Parameters

mixed $val
HTTPRequest $request

Current request to influence output format

static string text(mixed $val, HTTPRequest $request = null)

Get debug text for this object

Parameters

mixed $val
HTTPRequest $request

Return Value

string

static message(string $message, bool $showHeader = true, HTTPRequest $request = null)

Show a debugging message.

Does not work on live mode

Parameters

string $message
bool $showHeader
HTTPRequest $request

static DebugView create_debug_view(HTTPRequest $request = null)

Create an instance of an appropriate DebugView object.

Parameters

HTTPRequest $request

Optional request to target this view for

Return Value

DebugView

static protected bool supportsHTML(HTTPRequest $request = null)

Determine if the given request supports html output

Parameters

HTTPRequest $request

Return Value

bool

static require_developer_login()

Check if the user has permissions to run URL debug tools, else redirect them to log in.