Result.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Finite state machine skeleton
  4. *
  5. * @copyright (c) 2007-2012 Ouest Systèmes Informatiques
  6. * @author Frédéric G. MARAND
  7. * @license Licensed under the CeCILL 2.0
  8. * @link http://wiki.audean.com/fsm/fsm
  9. *
  10. * @todo replace setAttribute('id',...) by setIdAttribute when PHP5.2 becomes mandatory
  11. */
  12. namespace Osinet\FiniteStateMachine;
  13. /**
  14. * needed notably for func_name()
  15. */
  16. require_once('misc.php'); // for func_name()
  17. $erFiniteStateMachine = error_reporting(-1);
  18. /**
  19. * This class defines a possible outcome for a given FSM transition.
  20. */
  21. class Result {
  22. /**
  23. * The return value of the event handler.
  24. *
  25. * @var mixed
  26. */
  27. public $fsmReturn;
  28. /**
  29. * The name of the state to which the FSM must change.
  30. *
  31. * If NULL, do not change the current state.
  32. *
  33. * @var string
  34. */
  35. public $fsmState;
  36. /**
  37. * The name of an event to be fired after the state change has been applied.
  38. *
  39. * @var string
  40. */
  41. public $fsmAction;
  42. /**
  43. * @param string $state
  44. * @param string $action
  45. */
  46. public function __construct($return = NULL, $state = NULL, $action = NULL) {
  47. $this->fsmReturn = $return;
  48. $this->fsmState = $state;
  49. $this->fsmAction = $action;
  50. }
  51. }
  52. error_reporting($erFiniteStateMachine);
  53. unset($erFiniteStateMachine);