Passed
Push — master ( 823aee...b9b37f )
by Alec
13:15 queued 12s
created

AProceduralRevolver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlecRabbit\Spinner\Extras\Revolver\A;
6
7
use AlecRabbit\Spinner\Contract\IFrame;
8
use AlecRabbit\Spinner\Contract\IInterval;
9
use AlecRabbit\Spinner\Contract\IProcedure;
10
use AlecRabbit\Spinner\Core\Factory\FrameFactory;
11
use AlecRabbit\Spinner\Core\Revolver\A\ARevolver;
12
use AlecRabbit\Spinner\Core\Revolver\Contract\IFrameRevolver;
13
14
abstract class AProceduralRevolver extends ARevolver implements IFrameRevolver
15
{
16
    protected IFrame $currentFrame;
17
18
    public function __construct(
19
        protected IProcedure $procedure,
20
        IInterval $interval,
21
    ) {
22
        parent::__construct($interval);
23
        $this->currentFrame = FrameFactory::createEmpty();
24
    }
25
26
    protected function next(float $dt = null): void
27
    {
28
        $this->currentFrame = $this->procedure->update($dt);
29
    }
30
31
    protected function current(): IFrame
32
    {
33
        return $this->currentFrame;
34
    }
35
}
36