PHP Interface Kraken\Supervision\SupervisorInterface

Show file Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
__invoke ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] ) : Kraken\Promise\PromiseInterface Solve given Error or Exception with set of params using solver's handler method.
existsParam ( string $key ) : boolean Check if param saved under $key exists.
existsSolver ( string $exception ) : boolean Check if solver for $exception does exist.
getParam ( string $key ) : mixed | null Return param saved under $key or null if it does not exist.
getSolver ( string $exception ) : Kraken\Supervision\SolverInterface | null Return solver for $exception or null if it does not exist.
removeParam ( string $key ) Remove param saved under $key.
removeSolver ( string $exception ) Remove solver for $exception.
setParam ( string $key, mixed $value ) Set value of param saved under $key.
setSolver ( string $exception, Kraken\Supervision\SolverInterface | string | string[] $handler ) Set solver for $exception.
solve ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] ) : Kraken\Promise\PromiseInterface Handle error or exception of $ex using known handlers.

Method Details

__invoke() public method

Solve given Error or Exception with set of params using solver's handler method.
See also: SupervisorInterface::solve
public __invoke ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] ) : Kraken\Promise\PromiseInterface
$ex Erro\Error | Exceptio\Exception
$params mixed[]
return Kraken\Promise\PromiseInterface

existsParam() public method

Check if param saved under $key exists.
public existsParam ( string $key ) : boolean
$key string
return boolean

existsSolver() public method

Check if solver for $exception does exist.
public existsSolver ( string $exception ) : boolean
$exception string
return boolean

getParam() public method

Return param saved under $key or null if it does not exist.
public getParam ( string $key ) : mixed | null
$key string
return mixed | null $value

getSolver() public method

Return solver for $exception or null if it does not exist.
public getSolver ( string $exception ) : Kraken\Supervision\SolverInterface | null
$exception string
return Kraken\Supervision\SolverInterface | null

removeParam() public method

Remove param saved under $key.
public removeParam ( string $key )
$key string

removeSolver() public method

Remove solver for $exception.
public removeSolver ( string $exception )
$exception string

setParam() public method

Set value of param saved under $key.
public setParam ( string $key, mixed $value )
$key string
$value mixed

setSolver() public method

IllegalCallException is thrown if given $handler cannot be resolved.
public setSolver ( string $exception, Kraken\Supervision\SolverInterface | string | string[] $handler )
$exception string
$handler Kraken\Supervision\SolverInterface | string | string[]

solve() public method

Returns FulfilledPromise if handler for exception does exist and was executed properly. If handler does not exist or other errors and/or exception were thrown then RejectedPromise is returned.
public solve ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] ) : Kraken\Promise\PromiseInterface
$ex Erro\Error | Exceptio\Exception
$params mixed[]
return Kraken\Promise\PromiseInterface