Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | public function shouldCreateSnapshot(AggregateRoot $root) |
||
37 | { |
||
38 | if ($root->hasChanges()) { |
||
39 | $lastSnapshot = $this->store->get($root->getIdentity()); |
||
40 | $threshold = new \DateTime(date('c', strtotime('-' . $this->threshold))); |
||
41 | |||
42 | if ($lastSnapshot->getCreationDate() > $threshold) { |
||
43 | return true; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | return false; |
||
48 | } |
||
49 | } |
||
50 |