AbstractInput   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 32
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A resolveAttributes() 0 8 1
A renderHtmlMarkup() 0 3 1
1
<?php
2
3
namespace WebTheory\Saveyour\Field\Type\Abstracts;
4
5
use WebTheory\Saveyour\Contracts\Field\FormFieldInterface;
6
7
abstract class AbstractInput extends AbstractStandardFormControl implements FormFieldInterface
8
{
9
    protected string $type = 'text';
10
11
    protected ?string $dataList = null;
12
13
    /**
14
     * Get the value of type
15
     *
16
     * @return string
17
     */
18
    public function getType(): string
19
    {
20
        return $this->type;
21
    }
22
23
    /**
24
     * @return $this
25
     */
26
    protected function resolveAttributes(): AbstractInput
27
    {
28
        parent::resolveAttributes()
29
            ->addAttribute('type', $this->type)
30
            ->addAttribute('value', $this->value)
31
            ->addAttribute('datalist', $this->dataList);
32
33
        return $this;
34
    }
35
36
    protected function renderHtmlMarkup(): string
37
    {
38
        return $this->open('input', $this->attributes);
39
    }
40
}
41