izzum\statemachine\State::getName PHP Method

getName() public method

gets the name of this state
public getName ( )
    public function getName()
    {
        return $this->name;
    }

Usage Example

 /**
  * sets the state as the current state and on the backend.
  * This should only be done:
  * - initially, right after a machine has been created, to set it in a
  * certain state if the state has not been persisted before.
  * - when changing context (since this resets the current state) via
  * $machine->setState($machine->getCurrentState())
  *
  * This method allows you to bypass the transition guards and the transition
  * logic. no exit/entry/transition logic will be performed
  *
  * @param State $state 
  * @param string $message optional message. this can be used by the persistence adapter
  *          to be part of the transition history to provide extra information about the transition.  
  * @throws Exception in case the state is not valid/known for this machine          
  */
 public function setState(State $state, $message = null)
 {
     if ($this->getState($state->getName()) === null) {
         throw new Exception(sprintf("%s state '%s' not known to this machine", $this->toString(), $state->getName()), Exception::SM_UNKNOWN_STATE);
     }
     //get the state known to this machine so we are sure we have the correct reference
     //even if the client provides another instance of State with the same name
     $state = $this->getState($state->getName());
     $this->getContext()->setState($state->getName(), $message);
     $this->state = $state;
 }
All Usage Examples Of izzum\statemachine\State::getName