PHP Interface Kraken\Runtime\RuntimeContainerInterface

Inheritance: extends Kraken\Runtime\RuntimeContextInterface, extends Kraken\Core\CoreGetterAwareInterface, extends Kraken\Event\EventEmitterInterface, extends Kraken\Loop\LoopGetterAwareInterface
Show file Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
create ( ) : Kraken\Promise\PromiseInterface Create container.
destroy ( ) : Kraken\Promise\PromiseInterface Destroy container.
fail ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] ) Temporarily switch container to failed workflow and allow supervisor to take control.
getHash ( ) : string | null Return failure hash if the container is in the failed state or null if it is not.
getManager ( ) : Kraken\Runtime\RuntimeManagerInterface Return runtime manager set to this container instance.
getModel ( ) : Kraken\Runtime\RuntimeModelInterface Return model on which container is working
getState ( ) : integer Return current state of the container.
isCreated ( ) : boolean Check if container is in created state.
isDestroyed ( ) : boolean Check if container is in destroyed state.
isFailed ( ) : boolean Check if container is in failed state.
isStarted ( ) : boolean Check if container is in started state.
isStopped ( ) : boolean Check if container is in stopped state.
onAfterCreate ( callable $callback ) : EventListener Attach afterCreate event handler.
onAfterDestroy ( callable $callback ) : EventListener Attach afterDestroy event handler.
onAfterStart ( callable $callback ) : EventListener Attach afterStart event handler.
onAfterStop ( callable $callback ) : EventListener Attach afterStop event handler.
onBeforeCreate ( callable $callback ) : EventListener Attach beforeCreate event handler.
onBeforeDestroy ( callable $callback ) : EventListener Attach beforeDestroy event handler.
onBeforeStart ( callable $callback ) : EventListener Attach beforeStart event handler.
onBeforeStop ( callable $callback ) : EventListener Attach beforeStop event handler.
onCreate ( callable $callback ) : EventListener Attach create event handler.
onDestroy ( callable $callback ) : EventListener Attach destroy event handler.
onStart ( callable $callback ) : EventListener Attach start event handler.
onStop ( callable $callback ) : EventListener Attach stop event handler.
start ( ) : Kraken\Promise\PromiseInterface Start container.
stop ( ) : Kraken\Promise\PromiseInterface Stop container.
succeed ( ) Switch back from failed to normal workflow.

Method Details

create() public method

Create container.
public create ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

destroy() public method

Destroy container.
public destroy ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

fail() public method

Temporarily switch container to failed workflow and allow supervisor to take control.
public fail ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] )
$ex Erro\Error | Exceptio\Exception
$params mixed[]

getHash() public method

Return failure hash if the container is in the failed state or null if it is not.
public getHash ( ) : string | null
return string | null

getManager() public method

Return runtime manager set to this container instance.
public getManager ( ) : Kraken\Runtime\RuntimeManagerInterface
return Kraken\Runtime\RuntimeManagerInterface

getModel() public method

Return model on which container is working
public getModel ( ) : Kraken\Runtime\RuntimeModelInterface
return Kraken\Runtime\RuntimeModelInterface

getState() public method

Returned value might be one of: Runtime::STATE_CREATED Runtime::STATE_STARTED Runtime::STATE_STOPPED Runtime::STATE_DESTROYED Runtime::STATE_FAILED
public getState ( ) : integer
return integer

isCreated() public method

Check if container is in created state.
public isCreated ( ) : boolean
return boolean

isDestroyed() public method

Check if container is in destroyed state.
public isDestroyed ( ) : boolean
return boolean

isFailed() public method

Check if container is in failed state.
public isFailed ( ) : boolean
return boolean

isStarted() public method

Check if container is in started state.
public isStarted ( ) : boolean
return boolean

isStopped() public method

Check if container is in stopped state.
public isStopped ( ) : boolean
return boolean

onAfterCreate() public method

Attach afterCreate event handler.
public onAfterCreate ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onAfterDestroy() public method

Attach afterDestroy event handler.
public onAfterDestroy ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onAfterStart() public method

Attach afterStart event handler.
public onAfterStart ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onAfterStop() public method

Attach afterStop event handler.
public onAfterStop ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onBeforeCreate() public method

Attach beforeCreate event handler.
public onBeforeCreate ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onBeforeDestroy() public method

Attach beforeDestroy event handler.
public onBeforeDestroy ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onBeforeStart() public method

Attach beforeStart event handler.
public onBeforeStart ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onBeforeStop() public method

Attach beforeStop event handler.
public onBeforeStop ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onCreate() public method

Attach create event handler.
public onCreate ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onDestroy() public method

Attach destroy event handler.
public onDestroy ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onStart() public method

Attach start event handler.
public onStart ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

onStop() public method

Attach stop event handler.
public onStop ( callable $callback ) : EventListener
$callback callable
return Kraken\Event\EventListener

start() public method

Start container.
public start ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

stop() public method

Stop container.
public stop ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

succeed() public method

Switch back from failed to normal workflow.
public succeed ( )