public function getInitialState($allow_null = false)
{
$states = $this->getStates();
foreach ($states as $state) {
if ($state->isInitial()) {
return $state;
}
}
if ($allow_null) {
return null;
}
throw new Exception(sprintf("%s no initial state found, bad configuration. %s", $this->toString(), 'are the transitions/states loaded and configured correctly?'), Exception::SM_NO_INITIAL_STATE_FOUND);
}