Test Failed
Push — main ( 9ff78e...4dc0dd )
by Paul
08:02
created

UnknownElement::required()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Modules\Html\FieldElements;
4
5
use GeminiLabs\SiteReviews\Modules\Html\Attributes;
6
7
class UnknownElement extends AbstractFieldElement
8
{
9
    public function build(array $overrideArgs = []): string
10
    {
11
        if (empty($this->tag())) {
12
            return '';
13
        }
14
        return parent::build($overrideArgs);
15
    }
16
17
    public function merge(): void
18
    {
19
        if (empty($this->tag())) {
20
            $this->field->is_valid = false;
21
            return;
22
        }
23
        parent::merge();
24
    }
25
26
    public function tag(): string
27
    {
28
        if (in_array($this->field->type, Attributes::INPUT_TYPES)) {
29
            return 'input';
30
        }
31
        return '';
32
    }
33
}
34