public function onSetInitialState(StateMachineEvent $event) { $object = $event->getStateMachine()->getObject(); $result = $this->callCallback($object, 'can', 'initialize'); if ($result === false) { throw new \Finite\Exception\StateException('State initialization has been rejected.'); } $this->callCallback($object, 'post', 'initialize'); }
/** * @param StateInterface $initialState * @param TransitionInterface $transition * @param StateMachine $stateMachine * @param array $properties */ public function __construct(StateInterface $initialState, TransitionInterface $transition, StateMachine $stateMachine, array $properties = array()) { $this->transition = $transition; $this->initialState = $initialState; $this->properties = $properties; if ($transition instanceof PropertiesAwareTransitionInterface) { $this->properties = $transition->resolveProperties($properties); } parent::__construct($stateMachine); }
/** * @param StateInterface $initialState * @param TransitionInterface $transition * @param StateMachine $stateMachine */ public function __construct(StateInterface $initialState, TransitionInterface $transition, StateMachine $stateMachine) { $this->transition = $transition; $this->initialState = $initialState; parent::__construct($stateMachine); }