PHP Класс BugReporter

An object for sending captured error info to an HTTP server. An object for sending captured error info to an HTTP server. In particular this is made to work with the Trac plugin Autotrac, though it would be quite simple to make another HTTP server to work with it. A simple way to use this object is to create an error handler to the following function report_bug(): function report_bug ($p_number, $p_string, $p_file, $p_line) { $reporter = new BugReporter ($p_number, $p_string, $p_file, $p_line); $reporter->setServer ("http://myserver.com/mydirectory") $reporter->sendToServer(); } The errors are always sent to the server URL plus the extension "/report". So the above example would POST the error variables to http://myserver.com/mydirectory/newreport . The error variables POSTed are: - f_backtrace - f_id - f_software - f_str - f_num - f_file - f_line - f_backtrace * - f_description - f_email
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( integer $p_number, string $p_string, string $p_file, integer $p_line, string $p_software, integer $p_version, string $p_time = "", mixed $p_backtrace = "" )
__convertBacktraceArrayToString ( array $p_backtrace ) : string Convert the backtrace array into a backtrace string.
getBacktraceString ( ) : string Get the backtrace string.
getDescription ( ) : integer Get the error reporter's description of the error.
getEmail ( ) : integer Get the error reporter's email address
getErrorNum ( ) : integer Get the number of the error.
getFile ( ) : string Get the name of the file in which the error occerrud.
getFileWithoutPath ( ) : string Return the name of the error-file, not including the path.
getFormToken ( $p_client ) : mixed Get form token to protect against CSRF attacks.
getId ( ) : string Get the Error ID Code
getLine ( ) : integer Get the line number the error occurred in.
getPHPVersion ( ) : string Gets PHP version
getPingStatus ( ) : The
getServer ( ) : string Returns the current developers' server.
getServerOS ( ) : string Gets OS info
getSoftware ( ) : string Get the name of the software the error occurred in.
getStr ( ) : The Get the error message
getTime ( ) : string Get the time of the error.
getVersion ( ) : string Get the version of the software the error occurred in.
setBacktraceString ( $p_backtrace ) : void Get Manually set the backtrace string.
setDescription ( $p_description ) : void Set the reporter's description of the error
setEmail ( $p_email ) : void Set the error reporter's email address.
setErrorNum ( $p_errorNum ) : void Manually set the number of the error which occurred.
setFile ( $p_file ) : void Manually set the file in which the error occurred.
setLine ( $p_line ) : void Manually set the line number in which the error occurred.
setPingStatus ( $p_pingingStatus ) : void When pinging status is is set to false, pingServer() returns true without actually pinging the server.
setServer ( string $p_server ) : void This changes the developers' default server.
setSoftware ( $p_software ) : void Manually set the software in which the error occurred.
setStr ( $p_str ) : void Manually set the message of the error which occurred.
setTime ( $p_time ) : void Manually set the time at which the error occurred.
setVersion ( $p_version ) : void Manually set the software version of the error which occurred.

Описание методов

__construct() публичный Метод

public __construct ( integer $p_number, string $p_string, string $p_file, integer $p_line, string $p_software, integer $p_version, string $p_time = "", mixed $p_backtrace = "" )
$p_number integer The PHP error number.
$p_string string The error message.
$p_file string The file which encountered the error.
$p_line integer The line number of the file which encountered the error.
$p_software string The name of the software that encountered an error.
$p_version integer The version of the software that encountered an error.
$p_time string The date and time. If left blank, it is the current date and time.
$p_backtrace mixed The stack trace. This can be an array or string.

__convertBacktraceArrayToString() публичный Метод

Convert the backtrace array into a backtrace string.
public __convertBacktraceArrayToString ( array $p_backtrace ) : string
$p_backtrace array array The array to be converted.
Результат string The array as a string.

getBacktraceString() публичный Метод

Get the backtrace string.
public getBacktraceString ( ) : string
Результат string The traceback

getDescription() публичный Метод

Get the error reporter's description of the error.
public getDescription ( ) : integer
Результат integer Get the user's description of the error

getEmail() публичный Метод

Get the error reporter's email address
public getEmail ( ) : integer
Результат integer Get the email address of the user.

getErrorNum() публичный Метод

Get the number of the error.
public getErrorNum ( ) : integer
Результат integer The error number

getFile() публичный Метод

Get the name of the file in which the error occerrud.
public getFile ( ) : string
Результат string The name of the file the crash occurred in.

getFileWithoutPath() публичный Метод

Return the name of the error-file, not including the path.
public getFileWithoutPath ( ) : string
Результат string The name of the file, not including the path.

getFormToken() публичный Метод

Get form token to protect against CSRF attacks.
public getFormToken ( $p_client ) : mixed
Результат mixed String The form token False If the no token was get.

getId() публичный Метод

Get the Error ID Code
public getId ( ) : string
Результат string the file's ID-code.

getLine() публичный Метод

Get the line number the error occurred in.
public getLine ( ) : integer
Результат integer The line number the error occurred in.

getPHPVersion() публичный Метод

Gets PHP version
public getPHPVersion ( ) : string
Результат string php version

getPingStatus() публичный Метод

public getPingStatus ( ) : The
Результат The pinging status

getServer() публичный Метод

Returns the current developers' server.
public getServer ( ) : string
Результат string The current server's URL.

getServerOS() публичный Метод

Gets OS info
public getServerOS ( ) : string
Результат string OS info

getSoftware() публичный Метод

Get the name of the software the error occurred in.
public getSoftware ( ) : string
Результат string The name of the software the error occurred in.

getStr() публичный Метод

Get the error message
public getStr ( ) : The
Результат The error-string

getTime() публичный Метод

Get the time of the error.
public getTime ( ) : string
Результат string The time at which the crash occurred

getVersion() публичный Метод

Get the version of the software the error occurred in.
public getVersion ( ) : string
Результат string The version of the software the error occurred in

setBacktraceString() публичный Метод

Get Manually set the backtrace string.
public setBacktraceString ( $p_backtrace ) : void
Результат void

setDescription() публичный Метод

Set the reporter's description of the error
public setDescription ( $p_description ) : void
Результат void

setEmail() публичный Метод

Set the error reporter's email address.
public setEmail ( $p_email ) : void
Результат void

setErrorNum() публичный Метод

Manually set the number of the error which occurred.
public setErrorNum ( $p_errorNum ) : void
Результат void

setFile() публичный Метод

Manually set the file in which the error occurred.
public setFile ( $p_file ) : void
Результат void

setLine() публичный Метод

Manually set the line number in which the error occurred.
public setLine ( $p_line ) : void
Результат void

setPingStatus() публичный Метод

When pinging status is is set to false, pingServer() returns true without actually pinging the server.
public setPingStatus ( $p_pingingStatus ) : void
Результат void

setServer() публичный Метод

This changes the developers' default server.
public setServer ( string $p_server ) : void
$p_server string The URL of the new server.
Результат void

setSoftware() публичный Метод

Manually set the software in which the error occurred.
public setSoftware ( $p_software ) : void
Результат void

setStr() публичный Метод

Manually set the message of the error which occurred.
public setStr ( $p_str ) : void
Результат void

setTime() публичный Метод

Manually set the time at which the error occurred.
public setTime ( $p_time ) : void
Результат void

setVersion() публичный Метод

Manually set the software version of the error which occurred.
public setVersion ( $p_version ) : void
Результат void