1 | <?php |
||
19 | class StateCollectionMerger implements MergeableInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var StateCollectionInterface |
||
23 | */ |
||
24 | private $targetCollection; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $stateNamePrefix; |
||
30 | |||
31 | /** |
||
32 | * @param StateCollectionInterface $targetCollection |
||
33 | */ |
||
34 | 4 | public function __construct(StateCollectionInterface $targetCollection) |
|
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getStateNamePrefix() |
||
46 | |||
47 | /** |
||
48 | * @param string $stateNamePrefix |
||
49 | */ |
||
50 | public function setStateNamePrefix($stateNamePrefix) |
||
54 | |||
55 | /** |
||
56 | * @return \MetaborStd\Statemachine\StateCollectionInterface |
||
57 | */ |
||
58 | public function getTargetCollection() |
||
62 | |||
63 | /** |
||
64 | * @param string $name |
||
65 | * |
||
66 | * @return \MetaborStd\Statemachine\StateInterface |
||
67 | */ |
||
68 | 4 | protected function createState($name) |
|
72 | |||
73 | /** |
||
74 | * @param StateInterface $sourceState |
||
75 | * @param TransitionInterface $sourceTransition |
||
76 | * |
||
77 | * @throws \InvalidArgumentException |
||
78 | */ |
||
79 | 4 | protected function addTransition(StateInterface $sourceState, TransitionInterface $sourceTransition) |
|
87 | |||
88 | /** |
||
89 | * @param TransitionInterface $sourceTransition |
||
90 | * @return ConditionInterface |
||
91 | */ |
||
92 | 4 | protected function createCondition(TransitionInterface $sourceTransition) |
|
106 | |||
107 | /** |
||
108 | * @param TransitionInterface $sourceTransition |
||
109 | * |
||
110 | * @throws \InvalidArgumentException |
||
111 | * |
||
112 | * @return \Metabor\Statemachine\Transition |
||
113 | */ |
||
114 | 4 | protected function createTransition(TransitionInterface $sourceTransition) |
|
130 | |||
131 | /** |
||
132 | * @param object $source |
||
133 | * @param object $target |
||
134 | * |
||
135 | * @throws \RuntimeException |
||
136 | */ |
||
137 | 4 | protected function mergeMetadata($source, $target) |
|
154 | |||
155 | /** |
||
156 | * @param StateInterface $state |
||
157 | * |
||
158 | * @throws \InvalidArgumentException |
||
159 | */ |
||
160 | 4 | protected function addState(StateInterface $state) |
|
168 | |||
169 | /** |
||
170 | * @param string $name |
||
171 | * |
||
172 | * @return \MetaborStd\Statemachine\StateInterface |
||
173 | */ |
||
174 | 4 | protected function findOrCreateState($name) |
|
186 | |||
187 | /** |
||
188 | * @param StateInterface $sourceState |
||
189 | * |
||
190 | * @throws \InvalidArgumentException |
||
191 | */ |
||
192 | 4 | protected function mergeState(StateInterface $sourceState) |
|
215 | |||
216 | /** |
||
217 | */ |
||
218 | 4 | protected function mergeStateCollection(StateCollectionInterface $source) |
|
225 | |||
226 | /** |
||
227 | * @see \MetaborStd\MergeableInterface::merge() |
||
228 | */ |
||
229 | 4 | public function merge($source) |
|
243 | } |
||
244 |