Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function shouldCreateSnapshot(AggregateRoot $root) |
||
21 | { |
||
22 | if ($root->hasChanges()) { |
||
23 | $lastEvent = $root->getChanges()[count($root->getChanges()) -1]; |
||
24 | $lastVersion = $lastEvent->getVersion(); |
||
25 | |||
26 | for ($i = $root->getVersion(); $i <= $lastVersion; $i++) { |
||
27 | if ($i % $this->interval == 0) { |
||
28 | return true; |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return false; |
||
34 | } |
||
35 | } |
||
36 |