Completed
Pull Request — master (#44)
by
unknown
03:29
created

File::name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Spatie\Html\Elements;
4
5
use Spatie\Html\BaseElement;
6
use Illuminate\Support\Traits\Macroable;
7
8
class File extends BaseElement
9
{
10
    use Macroable;
11
12
    protected $tag = 'input';
13
14
    const ACCEPT_AUDIO = 'audio/*';
15
    const ACCEPT_VIDEO = 'video/*';
16
    const ACCEPT_IMAGE = 'image/*';
17
18
    public function __construct()
19
    {
20
        parent::__construct();
21
22
        $this->attributes->setAttribute('type', 'file');
23
    }
24
25
    /**
26
     * @param string|null $name
27
     *
28
     * @return static
29
     */
30
    public function name($name)
31
    {
32
        return $this->attribute('name', $name);
33
    }
34
35
    /**
36
     * @return static
37
     */
38
    public function required()
39
    {
40
        return $this->attribute('required');
41
    }
42
43
    /**
44
     * @return static
45
     */
46
    public function autofocus()
47
    {
48
        return $this->attribute('autofocus');
49
    }
50
51
    /**
52
    * @param string|null $name
0 ignored issues
show
Bug introduced by
There is no parameter named $name. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
53
    *
54
    * @return static
55
    */
56
    public function accept($type)
57
    {
58
        return $this->attribute('accept', $type);
59
    }
60
61
    /**
62
    * @return static
63
    */
64
    public function acceptAudio()
65
    {
66
        return $this->attribute('accept', self::ACCEPT_AUDIO);
67
    }
68
69
    /**
70
    * @return static
71
    */
72
    public function acceptVideo()
73
    {
74
        return $this->attribute('accept', self::ACCEPT_VIDEO);
75
    }
76
77
    /**
78
    * @return static
79
    */
80
    public function acceptImage()
81
    {
82
        return $this->attribute('accept', self::ACCEPT_IMAGE);
83
    }
84
85
    /**
86
     * @return static
87
     */
88
    public function multiple()
89
    {
90
        return $this->attribute('multiple');
91
    }
92
}
93