AWidgetBuilder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlecRabbit\Spinner\Core\Widget\Builder\A;
6
7
use AlecRabbit\Spinner\Contract\IFrame;
8
use AlecRabbit\Spinner\Core\Widget\Contract\IWidgetRevolver;
9
use AlecRabbit\Spinner\Exception\LogicException;
10
11
abstract class AWidgetBuilder
12
{
13
    protected ?IFrame $leadingSpacer = null;
14
    protected ?IFrame $trailingSpacer = null;
15
    protected ?IWidgetRevolver $revolver = null;
16
17
    protected function validate(): void
18
    {
19
        match (true) {
20
            $this->revolver === null => throw new LogicException('Revolver is not set.'),
21
            $this->leadingSpacer === null => throw new LogicException('Leading spacer is not set.'),
22
            $this->trailingSpacer === null => throw new LogicException('Trailing spacer is not set.'),
23
            default => null,
24
        };
25
    }
26
}
27