/** * Constructor * * @param Input $input * @param Stateful $object * @param Context $context * @param State $nextState * @param \Exception $previous (Optional) */ public function __construct(Input $input, Stateful $object, Context $context, State $nextState, \Exception $previous = null) { $message = sprintf('Failed attempting to %s a %s with current state %s', $input->getName(), get_class($object), $object->getCurrentStateName()); parent::__construct($message, 0, $previous); $this->object = $object; $this->context = $context; $this->input = $input; $this->nextState = $nextState; }
/** * Prepares exception message that includes the invalid pattern * * @param string $pattern */ public function __construct(string $pattern) { parent::__construct(sprintf('The supplied pattern "%s" does not appear to be a valid regular expression', $pattern)); }
/** * 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())); }
/** * Prepares exception message that includes the mismatched pattern and transition string * * @param string $transition * @param string $pattern */ public function __construct(string $transition, string $pattern) { parent::__construct(sprintf('The provided transition string "%s" does not match the configured pattern: "%s"', $transition, $pattern)); }