Skip to content

Stagehand_FSM 2.0.0 (stable)

Compare
Choose a tag to compare
@iteman iteman released this 01 Nov 03:23
· 226 commits to master since this release
v2.0.0

Release Date: 2013-08-01

What's New in Stagehand_FSM 2.0.0

Migration to PHP 5.3

(Issue #2)

Stagehand_FSM has been migrated to PHP 5.3. As of this version, it only works with PHP 5.3.2+.

New and Improved API

(Issue #3)

Stagehand_FSM v2 has introduced new and improved API. The following code shows how to create a state machine and how to activate the state machine.

<?php
use Stagehand\FSM\StateMachine\StateMachineBuilder;

$stateMachineBuilder = new StateMachineBuilder();
$stateMachineBuilder->addState('locked');
$stateMachineBuilder->addState('unlocked');
$stateMachineBuilder->setStartState('locked');
$stateMachineBuilder->addTransition('locked', 'insertCoin', 'unlocked');
$stateMachineBuilder->addTransition('unlocked', 'pass', 'locked');
$stateMachine = $stateMachineBuilder->getStateMachine();

$stateMachine->start();
echo $stateMachine->getCurrentState()->getStateID() . PHP_EOL; // "locked"
$stateMachine->triggerEvent('insertCoin');
echo $stateMachine->getCurrentState()->getStateID() . PHP_EOL; // "unlocked"
$stateMachine->triggerEvent('pass');
echo $stateMachine->getCurrentState()->getStateID() . PHP_EOL; // "locked"

For more information, see the StateMachineTest class.

End of Support for Nested State Machine and History Marker

(Issue #4)

Stagehand_FSM v2 no longer supports Nested State Machine and History Marker.