PHP 클래스 lithium\core\ErrorHandler

{{{ embed:lithium\tests\cases\core\ErrorHandlerTest::testExceptionCatching(2-7) }}} Using a series of cascading rules and handlers, it is possible to capture and handle very specific errors and exceptions.
상속: extends StaticObject
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_checks Default checks are for code, stack and message.
$_config Configuration parameters.
$_exceptionHandler Currently registered exception handler.
$_isRunning State of error/exception handling.
$_runOptions

공개 메소드들

메소드 설명
apply ( $object, array $conditions, $handler )
config ( array $config = [] ) : Current Configure the ErrorHandler.
handle ( object | array $info, array $scope = [] ) : boolean Receives the handled errors and exceptions that have been caught, and processes them in a normalized manner.
isRunning ( ) Returns the state of the ErrorHandler, indicating whether or not custom error/exception handers have been regsitered.
matches ( $info, $conditions )
reset ( ) Setup basic error handling checks/types, as well as register the error and exception handlers and wipes out all configuration and resets the error handler to its initial state when loaded. Mainly used for testing.
run ( array $config = [] ) Register error and exception handlers.
stop ( ) Unooks ErrorHandler's exception and error handlers, and restores PHP's defaults. May have unexpected results if it is not matched with a prior call to run(), or if other error handlers are set after a call to run().
trace ( array $stack ) : array Trim down a typical stack trace to class & method calls.

보호된 메소드들

메소드 설명
_origin ( array $stack ) : string Determine frame from the stack trace where the error/exception was first generated.

메소드 상세

_origin() 보호된 정적인 메소드

Determine frame from the stack trace where the error/exception was first generated.
protected static _origin ( array $stack ) : string
$stack array Stack trace from error/exception that was produced.
리턴 string Class where error/exception was generated.

apply() 공개 정적인 메소드

public static apply ( $object, array $conditions, $handler )
$conditions array

config() 공개 정적인 메소드

Configure the ErrorHandler.
public static config ( array $config = [] ) : Current
$config array Configuration directives.
리턴 Current configuration set.

handle() 공개 정적인 메소드

Receives the handled errors and exceptions that have been caught, and processes them in a normalized manner.
public static handle ( object | array $info, array $scope = [] ) : boolean
$info object | array
$scope array
리턴 boolean True if successfully handled, false otherwise.

isRunning() 공개 정적인 메소드

Returns the state of the ErrorHandler, indicating whether or not custom error/exception handers have been regsitered.
public static isRunning ( )

matches() 공개 정적인 메소드

public static matches ( $info, $conditions )

reset() 공개 정적인 메소드

Setup basic error handling checks/types, as well as register the error and exception handlers and wipes out all configuration and resets the error handler to its initial state when loaded. Mainly used for testing.
public static reset ( )

run() 공개 정적인 메소드

This method (ErrorHandler::run()) needs to be called as early as possible in the bootstrap cycle; immediately after require-ing bootstrap/libraries.php is your best bet.
public static run ( array $config = [] )
$config array The configuration with which to start the error handler. Available options include: - `'trapErrors'` _boolean_: Defaults to `false`. If set to `true`, PHP errors will be caught by `ErrorHandler` and handled in-place. Execution will resume in the same context in which the error occurred. - `'convertErrors'` _boolean_: Defaults to `true`, and specifies that all PHP errors should be converted to `ErrorException`s and thrown from the point where the error occurred. The exception will be caught at the first point in the stack trace inside a matching `try`/`catch` block, or that has a matching error handler applied using the `apply()` method.

stop() 공개 정적인 메소드

Unooks ErrorHandler's exception and error handlers, and restores PHP's defaults. May have unexpected results if it is not matched with a prior call to run(), or if other error handlers are set after a call to run().
public static stop ( )

trace() 공개 정적인 메소드

Trim down a typical stack trace to class & method calls.
public static trace ( array $stack ) : array
$stack array A `debug_backtrace()`-compatible stack trace output.
리턴 array Returns a flat stack array containing class and method references.

프로퍼티 상세

$_checks 보호되어 있는 정적으로 프로퍼티

Default checks are for code, stack and message.
protected static $_checks

$_config 보호되어 있는 정적으로 프로퍼티

Configuration parameters.
protected static $_config

$_exceptionHandler 보호되어 있는 정적으로 프로퍼티

Currently registered exception handler.
protected static $_exceptionHandler

$_isRunning 보호되어 있는 정적으로 프로퍼티

State of error/exception handling.
protected static $_isRunning

$_runOptions 보호되어 있는 정적으로 프로퍼티

protected static $_runOptions