| @@ 232-246 (lines=15) @@ | ||
| 229 | ||
| 230 | // merge states |
|
| 231 | $clean = false; |
|
| 232 | while (!$clean) { |
|
| 233 | $clean = true; |
|
| 234 | foreach ($states as $i => $state) { |
|
| 235 | if (array_key_exists($i+1, $states)) { |
|
| 236 | $next = $states[$i+1]; |
|
| 237 | if (json_encode($state->data) == json_encode($next->data)) { |
|
| 238 | $states[$i]->end = $next->end; |
|
| 239 | unset($states[$i+1]); |
|
| 240 | $states = array_values($states); |
|
| 241 | $clean = false; |
|
| 242 | break; |
|
| 243 | } |
|
| 244 | } |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||
| 248 | foreach ($this->temporal->getMapper()->find('_temporal_link_aggregate', $params) as $state) { |
|
| 249 | $this->temporal->getMapper()->remove($state); |
|
| @@ 344-358 (lines=15) @@ | ||
| 341 | ||
| 342 | // merge states |
|
| 343 | $clean = false; |
|
| 344 | while (!$clean) { |
|
| 345 | $clean = true; |
|
| 346 | foreach ($states as $i => $state) { |
|
| 347 | if (array_key_exists($i+1, $states)) { |
|
| 348 | $next = $states[$i+1]; |
|
| 349 | if (json_encode($state->data) == json_encode($next->data)) { |
|
| 350 | $state->end = $next->end; |
|
| 351 | unset($states[$i+1]); |
|
| 352 | $states = array_values($states); |
|
| 353 | $clean = false; |
|
| 354 | break; |
|
| 355 | } |
|
| 356 | } |
|
| 357 | } |
|
| 358 | } |
|
| 359 | ||
| 360 | return $states; |
|
| 361 | } |
|