To pass parameters by reference they must be assigned to an array by reference and the function/method being called must accept those parameters by reference. If either condition is not met, the parameter will be passed by value.

Signature

Parameters

::debug()public

Prints a debugging message if global or code-specific debugging is enabled

Signature

voiddebug(string$message,boolean$force=FALSE )

Parameters

string

$message

The debug message

boolean

$force

If debugging should be forced even when global debugging is off

::disableContext()public

Disables including the context information with exception and error messages

The context information includes the following superglobals:

$_SERVER

$_POST

$_GET

$_SESSION

$_FILES

$_COOKIE

Signature

voiddisableContext()

::dump()public

Creates a string representation of any variable using predefined strings for booleans, NULL and empty strings

The string output format of this method is very similar to the output of print_r() except that the following values are represented as special strings:

TRUE: '{true}'

FALSE: '{false}'

NULL: '{null}'

'': '{empty_string}'

Signature

stringdump(mixed$data)

Parameters

mixed

$data

The value to dump

Returns

The string representation of the value

::enableDebugging()public

Enables debug messages globally, i.e. they will be shown for any call to debug()

Signature

voidenableDebugging(boolean$flag)

Parameters

boolean

$flag

If debugging messages should be shown

::enableDynamicConstants()public

Turns on a feature where undefined constants are automatically created with the string value equivalent to the name

This functionality only works if enableErrorHandling() has been called first. This functionality may have a very slight performance impact since a E_STRICT error message must be captured and then a call to define() is made.

Signature

voidenableDynamicConstants()

::enableErrorHandling()public

Turns on developer-friendly error handling that includes context information including a backtrace and superglobal dumps

All errors that match the current error_reporting() level will be redirected to the destination and will include a full backtrace. In addition, dumps of the following superglobals will be made to aid in debugging:

$_SERVER

$_POST

$_GET

$_SESSION

$_FILES

$_COOKIE

The superglobal dumps are only done once per page, however a backtrace in included for each error.

If an email address is specified for the destination, only one email will be sent per script execution. If both error and exception handling are set to the same email address, the email will contain both errors and exceptions.

Signature

voidenableErrorHandling(string$destination)

Parameters

string

$destination

The destination for the errors and context information - an email address, a file path or the string 'html'

::enableExceptionHandling()public

Turns on developer-friendly uncaught exception handling that includes context information including a backtrace and superglobal dumps

Any uncaught exception will be redirected to the destination specified, and the page will execute the $closing_code callback before exiting. The destination will receive a message with the exception messaage, a full backtrace and dumps of the following superglobals to aid in debugging:

$_SERVER

$_POST

$_GET

$_SESSION

$_FILES

$_COOKIE

The superglobal dumps are only done once per page, however a backtrace in included for each error.

If an email address is specified for the destination, only one email will be sent per script execution.

If an email address is specified for the destination, only one email will be sent per script execution. If both exception and error handling are set to the same email address, the email will contain both exceptions and errors.

Signature

Parameters

string

$destination

The destination for the exception and context information - an email address, a file path or the string 'html'

callback

$closing_code

This callback will happen after the exception is handled and before page execution stops. Good for printing a footer. If no callback is provided and the exception extends fException, fException::printMessage() will be called.

array

$parameters

The parameters to send to $closing_code

::expose()public

Prints the dump() of a value

The dump will be printed in a <pre> tag with the class exposed if PHP is running anywhere but via the command line (cli). If PHP is running via the cli, the data will be printed, followed by a single line break (\n).

If multiple parameters are passed, they are exposed as an array.

Signature

voidexpose(mixed$data [, ... ] )

Parameters

mixed

$data [, ... ]

The value to show

::getDebug()public

If debugging is enabled

Signature

booleangetDebug(boolean$force=FALSE )

Parameters

boolean

$force

If debugging is forced

Returns

If debugging is enabled

::handleError()internal public

Please note: this method is public, however it is
primarily intended for internal use by Flourish and will normally not
be useful in site/application code

Handles an error, creating the necessary context information and sending it to the specified destination