Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
7 / 7
CRAP
100.00% covered (success)
100.00%
1 / 1
Input
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
7 / 7
8
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 type
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 name
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 value
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 placeholder
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 required
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 disabled
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Epic64\Elem\Elements;
6
7use Epic64\Elem\Element;
8
9class Input extends Element
10{
11    public function __construct(string $type = 'text', ?string $name = null)
12    {
13        parent::__construct('input');
14        $this->element->setAttribute('type', $type);
15        if ($name !== null) {
16            $this->element->setAttribute('name', $name);
17        }
18    }
19
20    public function type(string $type): static
21    {
22        return $this->attr('type', $type);
23    }
24
25    public function name(string $name): static
26    {
27        return $this->attr('name', $name);
28    }
29
30    public function value(string $value): static
31    {
32        return $this->attr('value', $value);
33    }
34
35    public function placeholder(string $placeholder): static
36    {
37        return $this->attr('placeholder', $placeholder);
38    }
39
40    public function required(): static
41    {
42        return $this->attr('required', 'required');
43    }
44
45    public function disabled(): static
46    {
47        return $this->attr('disabled', 'disabled');
48    }
49}