Passed
Push — master ( 7b0af7...e2bdc6 )
by Alec
03:09
created

AbstractJuggler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 25
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFrameErasingLength() 0 3 1
A getStyledFrame() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Spinner\Core\Jugglers;
4
5
use AlecRabbit\Accessories\Circular;
6
use AlecRabbit\Spinner\Core\Jugglers\Contracts\JugglerInterface;
7
use AlecRabbit\Spinner\Settings\Contracts\Defaults;
8
9
abstract class AbstractJuggler implements JugglerInterface
10
{
11
    /** @var int */
12
    protected $currentFrameErasingLength;
13
    /** @var Circular */
14
    protected $style;
15
    /** @var string */
16
    protected $prefix = Defaults::EMPTY_STRING;
17
    /** @var string */
18
    protected $suffix = Defaults::EMPTY_STRING;
19
20
    /** {@inheritDoc} */
21 23
    public function getFrameErasingLength(): int
22
    {
23 23
        return $this->currentFrameErasingLength;
24
    }
25
26
    /** {@inheritDoc} */
27 23
    public function getStyledFrame(): string
28
    {
29
        return
30 23
            sprintf((string)$this->style->value(), $this->getCurrentFrame());
31
    }
32
33
    abstract protected function getCurrentFrame():string;
34
}
35