Completed
Push — master ( f77d78...75a242 )
by Sebastian
07:07
created

Input::unchecked()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
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
7
class Input extends BaseElement
8
{
9
    protected $tag = 'input';
10
11
    /**
12
     * @return static
13
     */
14
    public function autofocus()
15
    {
16
        return $this->attribute('autofocus');
17
    }
18
19
    /**
20
     * @param  bool $checked
21
     *
22
     * @return static
23
     */
24
    public function checked($checked = true)
25
    {
26
        return $checked
27
            ? $this->attribute('checked', 'checked')
28
            : $this->forgetAttribute('checked');
29
    }
30
31
    /**
32
     * @param string|null $name
33
     *
34
     * @return static
35
     */
36
    public function name($name)
37
    {
38
        return $this->attribute('name', $name);
39
    }
40
41
    /**
42
     * @param string|null $placeholder
43
     *
44
     * @return static
45
     */
46
    public function placeholder($placeholder)
47
    {
48
        return $this->attribute('placeholder', $placeholder);
49
    }
50
51
    /**
52
     * @return static
53
     */
54
    public function required()
55
    {
56
        return $this->attribute('required');
57
    }
58
59
    /**
60
     * @param string|null $type
61
     *
62
     * @return static
63
     */
64
    public function type($type)
65
    {
66
        return $this->attribute('type', $type);
67
    }
68
69
    /**
70
     * @return static
71
     */
72
    public function unchecked()
73
    {
74
        return $this->checked(false);
75
    }
76
77
    /**
78
     * @param string|null $value
79
     *
80
     * @return static
81
     */
82
    public function value($value)
83
    {
84
        return $this->attribute('value', $value);
85
    }
86
87
    /**
88
     * @return static
89
     */
90
    public function readonly()
91
    {
92
        return $this->attribute('readonly');
93
    }
94
}
95