WidgetField   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
eloc 12
dl 0
loc 33
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A builder() 0 3 1
A buildField() 0 15 3
A namePrefix() 0 3 1
A location() 0 3 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Modules\Html;
4
5
use GeminiLabs\SiteReviews\Contracts\BuilderContract;
6
7
class WidgetField extends Field
8
{
9
    public function builder(): BuilderContract
10
    {
11
        return glsr(WidgetBuilder::class);
12
    }
13
14
    public function buildField(): string
15
    {
16
        // @phpstan-ignore-next-line
17
        if ($this->is_raw) { // only build the field element
18
            return $this->builder()->build($this->tag(), $this->toArray());
19
        }
20
        // @phpstan-ignore-next-line
21
        if ('number' === $this->original_type) {
22
            return $this->builder()->p([
0 ignored issues
show
Bug introduced by
The method p() does not exist on GeminiLabs\SiteReviews\Contracts\BuilderContract. Since it exists in all sub-types, consider adding an abstract or default implementation to GeminiLabs\SiteReviews\Contracts\BuilderContract. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
            return $this->builder()->/** @scrutinizer ignore-call */ p([
Loading history...
23
                'style' => 'display:flex;align-items:baseline;gap:5px;',
24
                'text' => $this->buildFieldElement().$this->buildFieldLabel(),
25
            ]);
26
        }
27
        return $this->builder()->p([
28
            'text' => $this->buildFieldLabel().$this->buildFieldElement(),
29
        ]);
30
    }
31
32
    public function location(): string
33
    {
34
        return 'widget';
35
    }
36
37
    public function namePrefix(): string
38
    {
39
        return '';
40
    }
41
}
42