Test Failed
Push — develop ( 1707fa...c6b569 )
by Paul
07:52
created

WidgetField   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 12
c 1
b 0
f 0
dl 0
loc 31
ccs 0
cts 4
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A builder() 0 3 1
A buildField() 0 13 3
A location() 0 3 1
A namePrefix() 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
        if ($this->is_raw) { // only build the field element
17
            return $this->builder()->build($this->tag(), $this->toArray());
18
        }
19
        if ('number' === $this->original_type) {
20
            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

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