PHP Class Finite\StateMachine\StateMachine

Author: Yohan Giarelli ([email protected])
Inheritance: implements Finite\StateMachine\StateMachineInterface
Mostrar archivo Open project: yohang/finite Class Usage Examples

Protected Properties

Property Type Description
$currentState Finite\State\StateInterface The current state.
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$graph string
$object object The stateful object.
$stateAccessor Finite\State\Accessor\StateAccessorInterface
$states array The available states.
$transitions array The available transitions.

Public Methods

Method Description
__construct ( object $object = null, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null, Finite\State\Accessor\StateAccessorInterface $stateAccessor = null )
addState ( $state )
addTransition ( $transition, $initialState = null, $finalState = null )
apply ( $transitionName, array $parameters = [] )
can ( $transition, array $parameters = [] )
findStateWithProperty ( $property, $value = null ) {@inheritDoc}
getCurrentState ( )
getDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
getGraph ( )
getObject ( )
getState ( $name )
getStates ( )
getTransition ( $name )
getTransitions ( )
hasStateAccessor ( )
initialize ( )
setDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )
setGraph ( $graph )
setObject ( $object )
setStateAccessor ( Finite\State\Accessor\StateAccessorInterface $stateAccessor )

Protected Methods

Method Description
findInitialState ( ) : string Find and return the Initial state if exists.

Private Methods

Method Description
dispatchTransitionEvent ( Finite\Transition\TransitionInterface $transition, Finite\Event\TransitionEvent $event, type $transitionState ) Dispatches event for the transition

Method Details

__construct() public method

public __construct ( object $object = null, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null, Finite\State\Accessor\StateAccessorInterface $stateAccessor = null )
$object object
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$stateAccessor Finite\State\Accessor\StateAccessorInterface

addState() public method

public addState ( $state )

addTransition() public method

public addTransition ( $transition, $initialState = null, $finalState = null )

apply() public method

public apply ( $transitionName, array $parameters = [] )
$parameters array

can() public method

public can ( $transition, array $parameters = [] )
$parameters array

findInitialState() protected method

Find and return the Initial state if exists.
protected findInitialState ( ) : string
return string

findStateWithProperty() public method

{@inheritDoc}
public findStateWithProperty ( $property, $value = null )

getCurrentState() public method

public getCurrentState ( )

getDispatcher() public method

public getDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
return Symfony\Component\EventDispatcher\EventDispatcherInterface

getGraph() public method

public getGraph ( )

getObject() public method

public getObject ( )

getState() public method

public getState ( $name )

getStates() public method

public getStates ( )

getTransition() public method

public getTransition ( $name )

getTransitions() public method

public getTransitions ( )

hasStateAccessor() public method

public hasStateAccessor ( )

initialize() public method

public initialize ( )

setDispatcher() public method

public setDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface

setGraph() public method

public setGraph ( $graph )

setObject() public method

public setObject ( $object )

setStateAccessor() public method

public setStateAccessor ( Finite\State\Accessor\StateAccessorInterface $stateAccessor )
$stateAccessor Finite\State\Accessor\StateAccessorInterface

Property Details

$currentState protected_oe property

The current state.
protected StateInterface,Finite\State $currentState
return Finite\State\StateInterface

$dispatcher protected_oe property

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $dispatcher
return Symfony\Component\EventDispatcher\EventDispatcherInterface

$graph protected_oe property

protected string $graph
return string

$object protected_oe property

The stateful object.
protected object $object
return object

$stateAccessor protected_oe property

protected StateAccessorInterface,Finite\State\Accessor $stateAccessor
return Finite\State\Accessor\StateAccessorInterface

$states protected_oe property

The available states.
protected array $states
return array

$transitions protected_oe property

The available transitions.
protected array $transitions
return array