Passed
Push — master ( 80875d...eb7214 )
by Alec
02:41
created

PercentSpinner::defaultSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Spinner;
4
5
use AlecRabbit\Spinner\Core\Contracts\Juggler;
6
use AlecRabbit\Spinner\Core\Contracts\Styles;
7
use AlecRabbit\Spinner\Core\Spinner;
8
use AlecRabbit\Spinner\Settings\Contracts\Defaults;
9
use AlecRabbit\Spinner\Settings\Settings;
10
use function AlecRabbit\typeOf;
11
12
class PercentSpinner extends Spinner
13
{
14
    protected const INTERVAL = 0.1;
15
    protected const FRAMES = [];
16
    protected const
17
        STYLES =
18
        [
19
            Juggler::FRAMES_STYLES =>
20
                [
21
                    Juggler::COLOR256 => Styles::DISABLED,
22
                    Juggler::COLOR => Styles::DISABLED,
23
                ],
24
        ];
25
26
    /** {@inheritDoc} */
27 2
    public function spin(?float $percent = null): string
28
    {
29 2
        $percent and $this->progress($percent);
30 2
        return parent::spin();
31
    }
32
33
    /** {@inheritDoc} */
34 2
    public function begin(?float $percent = null): string
35
    {
36 2
        return parent::begin(0.0);
37
    }
38
39
    /** {@inheritDoc} */
40 1
    public function message(?string $message = null, ?int $erasingLength = null): Spinner
41
    {
42 1
        return $this;
43
    }
44
45
//    /** {@inheritDoc} */
46
//    public function progress(?float $percent): Spinner
47
//    {
48
//        return $this;
49
//    }
50
51
//    /** {@inheritDoc} */
52
//    protected function defaultSettings(): Settings
53
//    {
54
//        return
55
//            parent::defaultSettings()
56
//                ->setMessagePrefix(Defaults::EMPTY_STRING);
57
//    }
58
}
59