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

AFrameFactory::createEmpty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
// 10.03.23
5
6
namespace AlecRabbit\Spinner\Core\Factory\A;
7
8
use AlecRabbit\Spinner\Contract\IFrame;
9
use AlecRabbit\Spinner\Core\Factory\Contract\IFrameFactory;
10
use AlecRabbit\Spinner\Core\Frame;
11
use AlecRabbit\Spinner\Core\WidthDeterminer;
12
13
abstract class AFrameFactory implements IFrameFactory
14
{
15
    public static function create(string $sequence, ?int $width = null): IFrame
16
    {
17
        return
18
            new Frame(
19
                $sequence,
20
                $width ?? WidthDeterminer::determine($sequence)
21
            );
22
    }
23
24
    public static function createEmpty(): IFrame
25
    {
26
        return new Frame('', 0);
27
    }
28
29
    public static function createSpace(): IFrame
30
    {
31
        return new Frame(' ', 1);
32
    }
33
}
34