1 | <?php |
||
25 | class Statemachine extends Subject implements StatemachineInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var object |
||
29 | */ |
||
30 | private $subject; |
||
31 | |||
32 | /** |
||
33 | * @var StateInterface |
||
34 | */ |
||
35 | private $currentState; |
||
36 | |||
37 | /** |
||
38 | * @var StateInterface |
||
39 | */ |
||
40 | private $lastState; |
||
41 | |||
42 | /** |
||
43 | * @var DispatcherInterface |
||
44 | */ |
||
45 | private $dispatcher; |
||
46 | |||
47 | /** |
||
48 | * @var EventInterface |
||
49 | */ |
||
50 | private $currentEvent; |
||
51 | |||
52 | /** |
||
53 | * @var \ArrayAccess |
||
54 | */ |
||
55 | private $currentContext; |
||
56 | |||
57 | /** |
||
58 | * @var TransitionSelectorInterface |
||
59 | */ |
||
60 | private $transitonSelector; |
||
61 | |||
62 | /** |
||
63 | * @var TransitionInterface |
||
64 | */ |
||
65 | private $selectedTransition; |
||
66 | |||
67 | /** |
||
68 | * @var ProcessInterface |
||
69 | */ |
||
70 | private $process; |
||
71 | |||
72 | /** |
||
73 | * @var MutexInterface |
||
74 | */ |
||
75 | private $mutex; |
||
76 | |||
77 | /** |
||
78 | * @param object $subject |
||
79 | * @param ProcessInterface $process |
||
80 | * @param string $stateName |
||
81 | * @param TransitionSelectorInterface $transitonSelector |
||
82 | * @param MutexInterface $mutex |
||
83 | */ |
||
84 | 9 | public function __construct( |
|
110 | |||
111 | /** |
||
112 | * @return ProcessInterface |
||
113 | */ |
||
114 | public function getProcess() |
||
118 | |||
119 | /** |
||
120 | * @see MetaborStd\Statemachine.StatemachineInterface::getCurrentState() |
||
121 | */ |
||
122 | 6 | public function getCurrentState() |
|
126 | |||
127 | /** |
||
128 | * @return StateInterface |
||
129 | */ |
||
130 | 1 | public function getLastState() |
|
134 | |||
135 | /** |
||
136 | * @param \ArrayAccess $context |
||
137 | * @param EventInterface $event |
||
138 | */ |
||
139 | 3 | protected function doCheckTransitions(\ArrayAccess $context, EventInterface $event = null) |
|
168 | |||
169 | /** |
||
170 | * @return \MetaborStd\Statemachine\TransitionInterface |
||
171 | */ |
||
172 | 1 | public function getSelectedTransition() |
|
176 | |||
177 | /** |
||
178 | * is called after dispatcher was executed. |
||
179 | */ |
||
180 | 3 | public function onDispatcherReady() |
|
191 | |||
192 | /** |
||
193 | * @param DispatcherInterface $dispatcher |
||
194 | * @param string $name |
||
195 | * @param \ArrayAccess $context |
||
196 | * |
||
197 | * @throws \RuntimeException |
||
198 | */ |
||
199 | 4 | public function dispatchEvent(DispatcherInterface $dispatcher, $name, \ArrayAccess $context = null) |
|
220 | |||
221 | /** |
||
222 | * @see MetaborStd\Statemachine.StatemachineInterface::triggerEvent() |
||
223 | */ |
||
224 | 4 | public function triggerEvent($name, \ArrayAccess $context = null) |
|
230 | |||
231 | /** |
||
232 | * @see MetaborStd\Statemachine.StatemachineInterface::checkTransitions() |
||
233 | */ |
||
234 | 3 | public function checkTransitions() |
|
239 | |||
240 | /** |
||
241 | * @see \MetaborStd\Statemachine\StatemachineInterface::getSubject() |
||
242 | */ |
||
243 | 6 | public function getSubject() |
|
247 | |||
248 | /** |
||
249 | * @return \ArrayAccess |
||
250 | */ |
||
251 | public function getCurrentContext() |
||
255 | } |
||
256 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: