Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | final class FrameCollectionRevolver extends ARevolver implements IFrameCollectionRevolver |
||
16 | { |
||
17 | protected int $count = 0; |
||
18 | protected int $offset = 0; |
||
19 | |||
20 | /** |
||
21 | * @throws InvalidArgument |
||
22 | */ |
||
23 | public function __construct( |
||
24 | protected IFrameCollection $frameCollection, |
||
25 | IInterval $interval, |
||
26 | ITolerance $tolerance, |
||
27 | ) { |
||
28 | parent::__construct($interval, $tolerance); |
||
29 | $this->count = $this->frameCollection->count(); |
||
30 | $this->assertIsNotEmpty(); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @throws InvalidArgument |
||
35 | */ |
||
36 | protected function assertIsNotEmpty(): void |
||
37 | { |
||
38 | if ($this->count === 0) { |
||
39 | throw new InvalidArgument('Frame collection is empty.'); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | protected function next(?float $dt = null): void |
||
47 | } |
||
48 | } |
||
49 | |||
50 | protected function current(): IFrame |
||
53 | } |
||
54 | } |
||
55 |