1 | <?php |
||
17 | class StateCollectionMerger implements MergeableInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var StateCollectionInterface |
||
21 | */ |
||
22 | private $targetCollection; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $stateNamePrefix; |
||
28 | |||
29 | /** |
||
30 | * @param StateCollectionInterface $targetCollection |
||
31 | */ |
||
32 | 4 | public function __construct(StateCollectionInterface $targetCollection) |
|
36 | |||
37 | /** |
||
38 | * @return string |
||
39 | */ |
||
40 | public function getStateNamePrefix() |
||
44 | |||
45 | /** |
||
46 | * @param string $stateNamePrefix |
||
47 | */ |
||
48 | public function setStateNamePrefix($stateNamePrefix) |
||
52 | |||
53 | /** |
||
54 | * @return \MetaborStd\Statemachine\StateCollectionInterface |
||
55 | */ |
||
56 | public function getTargetCollection() |
||
60 | |||
61 | /** |
||
62 | * @param string $name |
||
63 | * |
||
64 | * @return \MetaborStd\Statemachine\StateInterface |
||
65 | */ |
||
66 | protected function createState($name) |
||
70 | |||
71 | /** |
||
72 | * @param StateInterface $sourceState |
||
73 | * @param TransitionInterface $sourceTransition |
||
74 | * |
||
75 | * @throws \InvalidArgumentException |
||
76 | */ |
||
77 | protected function addTransition(StateInterface $sourceState, TransitionInterface $sourceTransition) |
||
85 | |||
86 | /** |
||
87 | * @param TransitionInterface $sourceTransition |
||
88 | * |
||
89 | * @throws \InvalidArgumentException |
||
90 | * |
||
91 | * @return \Metabor\Statemachine\Transition |
||
92 | */ |
||
93 | 3 | protected function createTransition(TransitionInterface $sourceTransition) |
|
112 | |||
113 | /** |
||
114 | * @param object $source |
||
115 | * @param object $target |
||
116 | * |
||
117 | * @throws \RuntimeException |
||
118 | */ |
||
119 | protected function mergeMetadata($source, $target) |
||
136 | |||
137 | /** |
||
138 | * @param StateInterface $state |
||
139 | * |
||
140 | * @throws \InvalidArgumentException |
||
141 | */ |
||
142 | protected function addState(StateInterface $state) |
||
150 | |||
151 | /** |
||
152 | * @param string $name |
||
153 | * |
||
154 | * @return \MetaborStd\Statemachine\StateInterface |
||
155 | */ |
||
156 | protected function findOrCreateState($name) |
||
168 | |||
169 | /** |
||
170 | * @param StateInterface $sourceState |
||
171 | * |
||
172 | * @throws \InvalidArgumentException |
||
173 | */ |
||
174 | 3 | protected function mergeState(StateInterface $sourceState) |
|
197 | |||
198 | /** |
||
199 | */ |
||
200 | 4 | protected function mergeStateCollection(StateCollectionInterface $source) |
|
207 | |||
208 | /** |
||
209 | * @see \MetaborStd\MergeableInterface::merge() |
||
210 | */ |
||
211 | 4 | public function merge($source) |
|
225 | } |
||
226 |