1 | <?php |
||
5 | class WrongEventForStateException extends \RuntimeException |
||
6 | { |
||
7 | /** |
||
8 | * The event that was triggered. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $eventName; |
||
13 | |||
14 | /** |
||
15 | * The subject's current state. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $stateName; |
||
20 | |||
21 | /** |
||
22 | * @param string $stateName |
||
23 | * @param string $eventName |
||
24 | * @param int $code |
||
25 | * @param \Exception $previous |
||
26 | */ |
||
27 | 3 | public function __construct($stateName, $eventName, $code = 0, \Exception $previous = null) |
|
28 | { |
||
29 | 3 | $this->stateName = $stateName; |
|
30 | 3 | $this->eventName = $eventName; |
|
31 | |||
32 | 3 | $message = 'Current state "' . $stateName . '" doesn\'t have event "' . $eventName . '"'; |
|
33 | parent::__construct($message, $code, $previous); |
||
34 | } |
||
35 | |||
36 | 1 | public function getEventName() |
|
40 | |||
41 | 1 | public function getStateName() |
|
45 | } |
||
46 |