setStateAccessor() public method

public setStateAccessor ( Finite\State\Accessor\StateAccessorInterface $stateAccessor )
$stateAccessor Finite\State\Accessor\StateAccessorInterface
コード例 #1
0
 /**
  * @param NULL|mixed $state scalar
  */
 public function __construct($state = NULL)
 {
     $this->stateMachine = new StateMachine($this);
     $this->getLoader()->load($this->stateMachine);
     // intentionally set after ArrayLoader::load, as it sets symfony accessor
     $this->stateMachine->setStateAccessor(new StatefulPropertyStateAccessor());
     $this->stateMachine->initialize();
     $this->setFiniteState($state ?: $this->getInitialState());
     $this->onModify();
 }
コード例 #2
0
ファイル: ArrayLoaderTest.php プロジェクト: yohang/finite
 public function testLoadWithCustomStateAccessor()
 {
     $sa = $this->getMock('Finite\\State\\Accessor\\PropertyPathStateAccessor', array(), array(), 'CustomAccessor');
     $sm = new StateMachine();
     $sm->setStateAccessor($sa);
     $this->object->load($sm);
     $this->assertAttributeInstanceOf('CustomAccessor', 'stateAccessor', $sm);
 }