PHP Class TheSeer\phpDox\ErrorHandler

ファイルを表示 Open project: theseer/phpdox Class Usage Examples

Public Methods

Method Description
__construct ( Version $version ) ErrorHandler constructor.
__destruct ( ) : void Destructor
clearLastError ( )
handleError ( integer $errno, string $errstr, string $errfile, integer $errline ) General System error handler
handleException ( Exception | Throwable $exception ) : void System Exception Handler
handleShutdown ( ) : void System shutdown handler
register ( ) : void Init method

Private Methods

Method Description
getLastError ( ) : array This method implements a workaround for PHP < 7 where no error_clear_last() exists by considering a last error of type E_USER_NOTICE as "cleared".
renderException ( Exception | Throwable $exception )

Method Details

__construct() public method

ErrorHandler constructor.
public __construct ( Version $version )
$version Version

__destruct() public method

Destructor
public __destruct ( ) : void
return void

clearLastError() public method

public clearLastError ( )

handleError() public method

Capture error messages and transform them into an exception
public handleError ( integer $errno, string $errstr, string $errfile, integer $errline )
$errno integer Error code
$errstr string Error message
$errfile string Filename error occured in
$errline integer Line of error

handleException() public method

System Exception Handler
public handleException ( Exception | Throwable $exception ) : void
$exception Exception | Throwable The exception to handle
return void

handleShutdown() public method

Used to grab fatal errors and handle them gracefully
public handleShutdown ( ) : void
return void

register() public method

Register shutdown, exception and error handler
public register ( ) : void
return void