Permalink
Browse files

Add README.

  • Loading branch information...
1 parent 8196e9d commit da45e4f729371191c1bae5e81f85fb3024f94bf7 @lukemorton lukemorton committed Apr 30, 2012
Showing with 46 additions and 0 deletions.
  1. +46 −0 README.md
View
@@ -0,0 +1,46 @@
+# StateMachine
+
+Define a finite state machine like so:
+
+``` php
+<?php
+namespace Gignite\StateMachine\Mocks;
+
+use Gignite\StateMachine\State;
+
+class HumanStateMachine extends \Gignite\StateMachine\StateMachine {
+
+ public static function state_definitions()
+ {
+ // -> Undead ->
+ // / \
+ // -> Unborn -> Born -> Dead -> -> Super Dead
+ // \ /
+ // - <- -
+ return array(
+ new State('unborn', array(
+ 'start' => TRUE,
+ 'to' => array('born'),
+ )),
+
+ new State('born', array(
+ 'to' => array('dead'),
+ )),
+
+ new State('dead', array(
+ 'to' => array('unborn', 'undead', 'super_dead'),
+ )),
+
+ new State('undead', array(
+ 'to' => array('super_dead'),
+ )),
+
+ new State('super_dead', array(
+ 'final' => TRUE,
+ )),
+ );
+ }
+
+}
+?>
+```

0 comments on commit da45e4f

Please sign in to comment.