AbstractInput::getType()   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
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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