PHP Class SM\StateMachine\StateMachine

Inheritance: implements SM\StateMachine\StateMachineInterface
显示文件 Open project: winzou/state-machine

Protected Properties

Property Type Description
$callbackFactory SM\Callback\CallbackFactoryInterface
$config array
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$object object

Public Methods

Method Description
__construct ( object $object, array $config, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null, SM\Callback\CallbackFactoryInterface $callbackFactory = null )
apply ( $transition, $soft = false ) {@inheritDoc}
can ( $transition ) {@inheritDoc}
getGraph ( ) {@inheritDoc}
getObject ( ) {@inheritDoc}
getPossibleTransitions ( ) {@inheritDoc}
getState ( ) {@inheritDoc}

Protected Methods

Method Description
callCallbacks ( SM\Event\TransitionEvent $event, string $position ) : boolean Builds and calls the defined callbacks
setState ( string $state ) Set a new state to the underlying object

Method Details

__construct() public method

public __construct ( object $object, array $config, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null, SM\Callback\CallbackFactoryInterface $callbackFactory = null )
$object object Underlying object for the state machine
$config array Config array of the graph
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface EventDispatcher or null not to dispatch events
$callbackFactory SM\Callback\CallbackFactoryInterface CallbackFactory or null to use the default one

apply() public method

{@inheritDoc}
public apply ( $transition, $soft = false )

callCallbacks() protected method

Builds and calls the defined callbacks
protected callCallbacks ( SM\Event\TransitionEvent $event, string $position ) : boolean
$event SM\Event\TransitionEvent
$position string
return boolean

can() public method

{@inheritDoc}
public can ( $transition )

getGraph() public method

{@inheritDoc}
public getGraph ( )

getObject() public method

{@inheritDoc}
public getObject ( )

getPossibleTransitions() public method

{@inheritDoc}

getState() public method

{@inheritDoc}
public getState ( )

setState() protected method

Set a new state to the underlying object
protected setState ( string $state )
$state string

Property Details

$callbackFactory protected_oe property

protected CallbackFactoryInterface,SM\Callback $callbackFactory
return SM\Callback\CallbackFactoryInterface

$config protected_oe property

protected array $config
return array

$dispatcher protected_oe property

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

$object protected_oe property

protected object $object
return object