Completed
Pull Request — master (#158)
by
unknown
01:17
created

Input::value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Html\Elements;
4
5
use Spatie\Html\BaseElement;
6
use Spatie\Html\Elements\Attributes\Autofocus;
7
use Spatie\Html\Elements\Attributes\Disabled;
8
use Spatie\Html\Elements\Attributes\Value;
9
use Spatie\Html\Elements\Attributes\MinMaxLength;
10
use Spatie\Html\Elements\Attributes\Name;
11
use Spatie\Html\Elements\Attributes\Placeholder;
12
use Spatie\Html\Elements\Attributes\Readonly;
13
use Spatie\Html\Elements\Attributes\Required;
14
use Spatie\Html\Elements\Attributes\Type;
15
16
class Input extends BaseElement
17
{
18
    use Autofocus;
19
    use Disabled;
20
    use MinMaxLength;
21
    use Name;
22
    use Placeholder;
23
    use Readonly;
24
    use Required;
25
    use Type;
26
    use Value;
27
28
    protected $tag = 'input';
29
30
    /**
31
     * @return static
32
     */
33
    public function unchecked()
34
    {
35
        return $this->checked(false);
36
    }
37
38
    /**
39
     * @param bool $checked
40
     *
41
     * @return static
42
     */
43
    public function checked($checked = true)
44
    {
45
        return $checked
46
            ? $this->attribute('checked', 'checked')
47
            : $this->forgetAttribute('checked');
48
    }
49
50
    /**
51
     * @param string|null $size
52
     *
53
     * @return static
54
     */
55
    public function size($size)
56
    {
57
        return $this->attribute('size', $size);
58
    }
59
}
60