/**
* Add a state. without a transition.
* Normally, you would not use this method directly but instead use
* addTransition to add the transitions with the states in one go.
*
* This method makes sense if you would want to load the statemachine with states
* and not transitions, and then add the transitions with regex states.
* This saves you the hassle of adding transitions before you add the
* regex transitions (just so the states are already known on the machine).
*
* in case a State is not used in a Transition, it will be orphaned and not
* reachable via other states.
*
* @param State $state
* @return boolean true if the state was not know to the machine or wasn't added, false otherwise.
*/
public function addState(State $state)
{
//no regex states
if ($state->isRegex()) {
return false;
}
//check for duplicates
if (isset($this->states[$state->getName()])) {
return false;
}
$this->states[$state->getName()] = $state;
return true;
}