Example #1
0
 /**
  * @param \SplSubject|StatemachineInterface|Statemachine $stateMachine
  * @return \ArrayAccess|null
  */
 private function getStateMachineContext($stateMachine)
 {
     $context = null;
     if ($stateMachine instanceof Statemachine) {
         $context = $stateMachine->getCurrentContext();
     }
     return $context;
 }
 /**
  * @param StatemachineInterface $stateMachine
  *
  * @return array
  */
 protected function createLoggerContext(StatemachineInterface $stateMachine)
 {
     $context = array();
     $context[self::CONTEXT_SUBJECT] = $stateMachine->getSubject();
     $context[self::CONTEXT_CURRENT_STATE] = $stateMachine->getCurrentState();
     if ($stateMachine instanceof Statemachine) {
         $context[self::CONTEXT_LAST_STATE] = $stateMachine->getLastState();
         $context[self::CONTEXT_TRANSITION] = $stateMachine->getSelectedTransition();
     }
     return $context;
 }
Example #3
0
 /**
  * @return string
  */
 public function getCurrentStateName()
 {
     return $this->statemachine->getCurrentState()->getName();
 }