A State instance can (and should) be shared by multiple Transition
objects when it is the same State for their origin/from State.
A State can be a regex state (or negated regex).
A regex state can be used in a transition and when added to a
statemachine the regular expression will be matched on all currently
known states on that statemachine and new Transitions will be added
to the statemachine that match the from/to state regexes. This is very
useful to build a lot of transitions very quickly.
to build a full mesh of transitions (all states to all states):
$a = new State('a');
$b = new State('b');
$c = new State('c');
$machine->addState($a);
$machine->addState($b);
$machine->addState($c);
$state_regex_all = new State('regex:|.*|');
$machine->addTransition(new Transition($state_regex_all, $state_regex_all));