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

AProceduralRevolver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A current() 0 3 1
A next() 0 3 1
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