/** * @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; }
/** * @return string */ public function getCurrentStateName() { return $this->statemachine->getCurrentState()->getName(); }