/**
  * Returns the key to use to store the action involving application of an
  * input to a given state internally.
  *
  * @param State $currentState
  * @param Input $input
  *
  * @return string
  */
 private function getActionKey(State $currentState, Input $input) : string
 {
     return sprintf('%s | %s', $currentState->getName(), $input->getName());
 }
 /**
  * Prepares exception message that includes the invalid input and state
  *
  * @param Input $input
  * @param State $state
  */
 public function __construct(Input $input, State $state)
 {
     $this->input = $input;
     $this->state = $state;
     parent::__construct(sprintf('Cannot %s a %s object', $input->getName(), $state->getName()));
 }
示例#3
0
 /**
  * {@inheritdoc}
  *
  */
 public function getCurrentStateName() : string
 {
     $this->assertHasCurrentState();
     return $this->currentState->getName();
 }
示例#4
0
 /**
  * Creates an event name based on an input, current state, and when that event should be emitted
  *
  * @param string $executedWhen
  * @param Input $input
  * @param State $currentState
  *
  * @return string
  */
 private function getEventName(string $executedWhen, Input $input, State $currentState) : string
 {
     return sprintf('%s %s %s', $executedWhen, $input->getName(), $currentState->getName());
 }