src/StateMachine/StateMachineExtension.php
public function jumpToState($state)
    {
        if (!$state instanceof StateInterface) {
            $state = $this->getState($state);
        }

        if (!$this->canJumpToState($state)) {
            throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->getName()));
        }

        $this->object->setFiniteState($state->getName());
        $this->currentState = $state;
    }
public function jumpToState($state)
    {
        if (!$state instanceof StateInterface) {
            $state = $this->getState($state);
        }

        if (!$this->canJumpToState($state)) {
            throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->getName()));
        }

        $this->object->setFiniteState($state->getName());
        $this->currentState = $state;
    }
public function jumpToState ( $ state ) { if ( ! $ state instanceof StateInterface ) { $ state = $ this -> getState ( $ state ) ; } if ( ! $ this -> canJumpToState ( $ state ) ) { throw new StateException ( sprintf ( 'Can not jump from state "%s" to "%s".' , $ this -> currentState -> getName ( ) , $ state -> getName ( ) ) ) ; } $ this -> object -> setFiniteState ( $ state -> getName ( ) ) ; $ this -> currentState = $ state ; }
Moves to the given state if allowed.

@param string|StateInterface $state

@return bool
Moves to the given state if allowed .