WidgetField::builder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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