Conditions | 3 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
53 | public function fastForward(DateInterval $interval): RewindableClock |
||
54 | { |
||
55 | // @todo |
||
56 | // use expiry dates instead, and apply expiration actions when handling |
||
57 | // the next command |
||
58 | // ..can we do that? How to update read models after auto-combat, then? |
||
59 | $before = $this->clock->now(); |
||
60 | $this->clock = $this->clock->fastForward($interval); |
||
61 | |||
62 | $since = $this->clock->now()->getTimestamp() - $before->getTimestamp(); |
||
63 | if ($this->method !== null) { |
||
64 | for ($i = 0; $i < $since; $i++) { |
||
65 | ($this->method)($i); |
||
66 | } |
||
67 | } |
||
68 | return $this; |
||
69 | } |
||
71 |