Constants

VERSION

VERSION = '0.3' : string

FirePHP version

LOG

LOG = 'LOG' : string

Firebug LOG level

Logs a message to firebug console.

INFO

INFO = 'INFO' : string

Firebug INFO level

Logs a message to firebug console and displays an info icon before the message.

WARN

WARN = 'WARN' : string

Firebug WARN level

Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.

ERROR

ERROR = 'ERROR' : string

Firebug ERROR level

Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.

DUMP

DUMP = 'DUMP' : string

Dumps a variable to firebug's server panel

TRACE

TRACE = 'TRACE' : string

Displays a stack trace in firebug console

EXCEPTION

EXCEPTION = 'EXCEPTION' : string

Displays an exception in firebug console

Increments the firebug error count.

TABLE

TABLE = 'TABLE' : string

Displays an table in firebug console

GROUP_START

GROUP_START = 'GROUP_START' : string

Starts a group in firebug console

GROUP_END

GROUP_END = 'GROUP_END' : string

Ends a group in firebug console

Properties

$instance

$instance : \Behavior\FirePHP

Singleton instance of FirePHP

Type

\Behavior\FirePHP

$inExceptionHandler

$inExceptionHandler : boolean

Flag whether we are logging from within the exception handler

Type

boolean

$throwErrorExceptions

$throwErrorExceptions : boolean

Flag whether to throw PHP errors that have been converted to ErrorExceptions

Type

boolean

$convertAssertionErrorsToExceptions

$convertAssertionErrorsToExceptions : boolean

Flag whether to convert PHP assertion errors to Exceptions

Type

boolean

$throwAssertionExceptions

$throwAssertionExceptions : boolean

Flag whether to throw PHP assertion errors that have been converted to Exceptions

Type

boolean

$messageIndex

$messageIndex : integer

Wildfire protocol message index

Type

integer

$options

$options : array

Options for the library

Type

array

$objectFilters

$objectFilters : array

Filters used to exclude object members when encoding

Type

array

$objectStack

$objectStack : object

A stack of objects used to detect recursion during object encoding

Type

object

$enabled

$enabled : boolean

Flag to enable/disable logging

Type

boolean

$logToInsightConsole

$logToInsightConsole : object

The insight console to log to if applicable

Type

object

$json_objectStack

$json_objectStack : 

Keep a list of objects as we descend into the array so we can detect recursion.

Type

Methods

__sleep()

__sleep() : array

When the object gets serialized only include specific object members.

Returns

array

getInstance()

getInstance(boolean  $AutoCreate = false) : \Behavior\FirePHP

Gets singleton instance of FirePHP

Parameters

boolean $AutoCreate

Returns

\Behavior\FirePHP

init()

init() : \Behavior\FirePHP

Creates FirePHP object and stores it for singleton access

Returns

\Behavior\FirePHP

setInstance()

setInstance(\Behavior\FirePHP  $instance) : \Behavior\FirePHP

Set the instance of the FirePHP singleton

Parameters

\Behavior\FirePHP $instance

The FirePHP object instance

Returns

\Behavior\FirePHP

setLogToInsightConsole()

setLogToInsightConsole(object  $console) : void

Set an Insight console to direct all logging calls to

Parameters

object $console

The console object to log to

setEnabled()

setEnabled(boolean  $Enabled) : void

Enable and disable logging to Firebug

Parameters

boolean $Enabled

TRUE to enable, FALSE to disable

getEnabled()

getEnabled() : boolean

Check if logging is enabled

Returns

boolean —

TRUE if enabled

setObjectFilter()

setObjectFilter(string  $Class, array  $Filter) : void

Specify a filter to be used when encoding an object

Filters are used to exclude object members.

Parameters

string $Class

The class name of the object

array $Filter

An array of members to exclude

setOptions()

setOptions(array  $Options) : void

Set some options for the library

Options:

  • maxDepth: The maximum depth to traverse (default: 10)
  • maxObjectDepth: The maximum depth to traverse objects (default: 5)
  • maxArrayDepth: The maximum depth to traverse arrays (default: 5)
  • useNativeJsonEncode: If true will use json_encode() (default: true)
  • includeLineNumbers: If true will include line numbers and filenames (default: true)

Parameters

array $Options

The options to be set

getOptions()

getOptions() : array

Get options from the library

Returns

array —

The currently set options

setOption()

setOption(string  $Name, mixed  $Value) : void

Set an option for the library

Parameters

string $Name
mixed $Value

Throws

\Behavior\Exception

getOption()

getOption(string  $Name) : mixed

Get an option from the library

Parameters

string $Name

Throws

\Behavior\Exception

Returns

mixed

registerErrorHandler()

registerErrorHandler(  $throwErrorExceptions = false) : mixed

Register FirePHP as your error handler

Will throw exceptions for each php error.

Parameters

$throwErrorExceptions

Returns

mixed —

Returns a string containing the previously defined error handler (if any)

errorHandler()

errorHandler(integer  $errno, string  $errstr, string  $errfile, integer  $errline, array  $errcontext) 

FirePHP's error handler

Throws exception for each php error that will occur.

Parameters

integer $errno
string $errstr
string $errfile
integer $errline
array $errcontext

registerExceptionHandler()

registerExceptionHandler() : mixed

Register FirePHP as your exception handler

Returns

mixed —

Returns the name of the previously defined exception handler, or NULL on error. If no previous handler was defined, NULL is also returned.

exceptionHandler()

exceptionHandler(\Behavior\Exception  $Exception) 

FirePHP's exception handler

Logs all exceptions to your firebug console and then stops the script.

Parameters

\Behavior\Exception $Exception

Throws

\Behavior\Exception

registerAssertionHandler()

registerAssertionHandler(boolean  $convertAssertionErrorsToExceptions = true, boolean  $throwAssertionExceptions = false) : mixed

Register FirePHP driver as your assert callback

Parameters

boolean $convertAssertionErrorsToExceptions
boolean $throwAssertionExceptions

Returns

mixed —

Returns the original setting or FALSE on errors

assertionHandler()

assertionHandler(string  $file, integer  $line, mixed  $code) 

FirePHP's assertion handler

Logs all assertions to your firebug console and then stops the script.

Parameters

string $file

File source of assertion

integer $line

Line source of assertion

mixed $code

Assertion code

group()

group(string  $Name, array  $Options = null) : true

Start a group for following messages.

Options: Collapsed: [true|false] Color: [#RRGGBB|ColorName]

Parameters

string $Name
array $Options

OPTIONAL Instructions on how to log the group

Throws

\Behavior\Exception

Returns

true

groupEnd()

groupEnd() : true

Ends a group you have started before

Throws

\Behavior\Exception

Returns

true

log()

log(\Behavior\mixes  $Object, string  $Label = null,   $Options = array()) : true

Log object with label to firebug console

Parameters

\Behavior\mixes $Object
string $Label
$Options

Throws

\Behavior\Exception

Returns

true

info()

info(\Behavior\mixes  $Object, string  $Label = null,   $Options = array()) : true

Log object with label to firebug console

Parameters

\Behavior\mixes $Object
string $Label
$Options

Throws

\Behavior\Exception

Returns

true

warn()

warn(\Behavior\mixes  $Object, string  $Label = null,   $Options = array()) : true

Log object with label to firebug console

Parameters

\Behavior\mixes $Object
string $Label
$Options

Throws

\Behavior\Exception

Returns

true

error()

error(\Behavior\mixes  $Object, string  $Label = null,   $Options = array()) : true

Log object with label to firebug console

Parameters

\Behavior\mixes $Object
string $Label
$Options

Throws

\Behavior\Exception

Returns

true

dump()

dump(string  $Key, mixed  $Variable,   $Options = array()) : true

Dumps key and variable to firebug server panel

Parameters

string $Key
mixed $Variable
$Options

Throws

\Behavior\Exception

Returns

true

trace()

trace(string  $Label) : true

Log a trace in the firebug console

Parameters

string $Label

Throws

\Behavior\Exception

Returns

true

table()

table(string  $Label, string  $Table,   $Options = array()) : true

Log a table in the firebug console

Parameters

string $Label
string $Table
$Options

Throws

\Behavior\Exception

Returns

true

to()

to() 

Insight API wrapper

plugin()

plugin() 

Insight API wrapper

detectClientExtension()

detectClientExtension() : boolean

Check if FirePHP is installed on client

Returns

boolean

fb()

fb(mixed  $Object) : true

Log varible to Firebug

Parameters

mixed $Object

The variable to be logged

Throws

\Behavior\Exception

Returns

true —

Return TRUE if message was added to headers, FALSE otherwise

getAllRequestHeaders()

getAllRequestHeaders() : array

Get all request headers

Returns

array

jsonEncode()

jsonEncode(object  $Object,   $skipObjectEncode = false) : string

Encode an object into a JSON string

Uses PHP's jeson_encode() if available

Parameters

object $Object

The object to be encoded

$skipObjectEncode

Returns

string —

The JSON string

setProcessorUrl()

setProcessorUrl(  $URL) 

Parameters

$URL

setRendererUrl()

setRendererUrl(  $URL) 

Parameters

$URL

_standardizePath()

_standardizePath(string  $Path) : string

Standardizes path for windows systems.

Parameters

string $Path

Returns

string

_escapeTrace()

_escapeTrace(array  $Trace) : array

Escape trace path for windows systems

Parameters

array $Trace

Returns

array

_escapeTraceFile()

_escapeTraceFile(string  $File) : string

Escape file information of trace for windows systems

Parameters

string $File

Returns

string

headersSent()

headersSent(string  $Filename, integer  $Linenum) 

Check if headers have already been sent

Parameters

string $Filename
integer $Linenum

setHeader()

setHeader(string  $Name, string  $Value) 

Send header

Parameters

string $Name
string $Value

getUserAgent()

getUserAgent() : string|false

Get user agent

Returns

string|false

getRequestHeader()

getRequestHeader(  $Name) : string|false

Get a request header

Parameters

$Name

Returns

string|false

newException()

newException(string  $Message) : \Behavior\Exception

Returns a new exception

Parameters

string $Message

Returns

\Behavior\Exception

encodeTable()

encodeTable(array  $Table) : array

Encodes a table by encoding each row and column with encodeObject()

Parameters

array $Table

The table to be encoded

Returns

array

encodeObject()

encodeObject(Object  $Object,   $ObjectDepth = 1,   $ArrayDepth = 1,   $MaxDepth = 1) : array

Encodes an object including members with protected and private visibility

Parameters

Object $Object

The object to be encoded

$ObjectDepth
$ArrayDepth
$MaxDepth

Returns

array —

All members of the object

is_utf8()

is_utf8(mixed  $str) : boolean

Returns true if $string is valid UTF-8 and false otherwise.

Parameters

mixed $str

String to be tested

Returns

boolean

json_utf82utf16()

json_utf82utf16(string  $utf8) : string

convert a string from one UTF-8 char to one UTF-16 char

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.

Parameters

string $utf8

UTF-8 character

Returns

string —

UTF-16 character

json_encode()

json_encode(mixed  $var) : mixed

encodes an arbitrary variable into JSON format

Parameters

mixed $var

any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in ASCII or UTF-8 format!

Returns

mixed —

JSON string representation of input var or an error if a problem occurs

json_name_value()

json_name_value(string  $name, mixed  $value) : string

array-walking function for use in generating JSON-formatted name-value pairs

Parameters

string $name

name of key to use

mixed $value

reference to an array element to be encoded

Returns

string —

JSON-formatted name-value pair, like '"name":value'