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