PHP Class Metabor\Statemachine\Statemachine

Author: Oliver Tischlinger
Inheritance: extends Metabor\Observer\Subject, implements MetaborStd\Statemachine\StatemachineInterface
Show file Open project: metabor/statemachine Class Usage Examples

Public Methods

Method Description
__construct ( object $subject, MetaborStd\Statemachine\ProcessInterface $process, string $stateName = null, MetaborStd\Statemachine\Factory\TransitionSelectorInterface $transitonSelector = null, MetaborStd\Semaphore\MutexInterface $mutex = null )
acquireLock ( ) : boolean Use this function if you want to aquire lock before calling triggerEvent or checkTransitions.
checkTransitions ( ArrayAccess $context = null )
dispatchEvent ( MetaborStd\Event\DispatcherInterface $dispatcher, string $name, ArrayAccess $context = null )
getCurrentContext ( ) : ArrayAccess
getCurrentState ( )
getLastState ( ) : MetaborStd\Statemachine\StateInterface
getProcess ( ) : MetaborStd\Statemachine\ProcessInterface
getSelectedTransition ( ) : MetaborStd\Statemachine\TransitionInterface
getSubject ( )
onDispatcherReady ( ) is called after dispatcher was executed.
triggerEvent ( string $name, ArrayAccess $context = null )

Protected Methods

Method Description
acquireLockOrThrowException ( )
doCheckTransitions ( ArrayAccess $context, MetaborStd\Event\EventInterface $event = null )

Method Details

__construct() public method

public __construct ( object $subject, MetaborStd\Statemachine\ProcessInterface $process, string $stateName = null, MetaborStd\Statemachine\Factory\TransitionSelectorInterface $transitonSelector = null, MetaborStd\Semaphore\MutexInterface $mutex = null )
$subject object
$process MetaborStd\Statemachine\ProcessInterface
$stateName string
$transitonSelector MetaborStd\Statemachine\Factory\TransitionSelectorInterface
$mutex MetaborStd\Semaphore\MutexInterface

acquireLock() public method

Lock is aquired automatically when calling dispatchEvent or checkTransitions.
public acquireLock ( ) : boolean
return boolean

acquireLockOrThrowException() protected method

checkTransitions() public method

public checkTransitions ( ArrayAccess $context = null )
$context ArrayAccess

dispatchEvent() public method

public dispatchEvent ( MetaborStd\Event\DispatcherInterface $dispatcher, string $name, ArrayAccess $context = null )
$dispatcher MetaborStd\Event\DispatcherInterface
$name string
$context ArrayAccess

doCheckTransitions() protected method

protected doCheckTransitions ( ArrayAccess $context, MetaborStd\Event\EventInterface $event = null )
$context ArrayAccess
$event MetaborStd\Event\EventInterface

getCurrentContext() public method

getCurrentState() public method

public getCurrentState ( )

getLastState() public method

public getLastState ( ) : MetaborStd\Statemachine\StateInterface
return MetaborStd\Statemachine\StateInterface

getProcess() public method

public getProcess ( ) : MetaborStd\Statemachine\ProcessInterface
return MetaborStd\Statemachine\ProcessInterface

getSelectedTransition() public method

public getSelectedTransition ( ) : MetaborStd\Statemachine\TransitionInterface
return MetaborStd\Statemachine\TransitionInterface

getSubject() public method

See also: MetaborStd\Statemachine\StatemachineInterface::getSubject()
public getSubject ( )

onDispatcherReady() public method

is called after dispatcher was executed.
public onDispatcherReady ( )

triggerEvent() public method

public triggerEvent ( string $name, ArrayAccess $context = null )
$name string
$context ArrayAccess