GlyphInline   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
c 2
b 0
f 0
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setAlign() 0 8 2
A __construct() 0 9 1
1
<?php
2
3
namespace VPA\Console\Glyphs;
4
5
use VPA\Console\Color;
6
use VPA\Console\FrameConfigInterface;
7
use VPA\Console\SymbolMode;
8
9
abstract class GlyphInline extends Glyph
10
{
11 34
    public function __construct(protected FrameConfigInterface $globalConfig)
12
    {
13 34
        parent::__construct($globalConfig);
14 34
        $this->setConfig([
15
                'textAlign' => 'left',
16
                'maxWidth' => 80,
17
                'color' => Color::WHITE,
18
                'backgroundColor' => Color::BLACK,
19
                'mode' => SymbolMode::DEFAULT,
20
            ]);
21
    }
22
23 4
    public function setAlign(string $align): GlyphInline
24
    {
25 4
        $aligns = ['left', 'center', 'right'];
26 4
        if (!in_array($align, $aligns)) {
27 1
            throw new \Exception('Incorrect align value for inline element');
28
        }
29 3
        $this->__set('textAlign', $align);
30 3
        return $this;
31
    }
32
}
33