Completed
Push — master ( 906bc8...a9653c )
by Sebastian
15s queued 13s
created

File::required()   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 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
use Spatie\Html\Elements\Attributes\Autofocus;
7
use Spatie\Html\Elements\Attributes\Name;
8
use Spatie\Html\Elements\Attributes\Required;
9
10
class File extends BaseElement
11
{
12
    use Autofocus;
13
    use Name;
14
    use Required;
15
16
    protected $tag = 'input';
17
18
    const ACCEPT_AUDIO = 'audio/*';
19
    const ACCEPT_VIDEO = 'video/*';
20
    const ACCEPT_IMAGE = 'image/*';
21
22
    public function __construct()
23
    {
24
        parent::__construct();
25
26
        $this->attributes->setAttribute('type', 'file');
27
    }
28
29
    /**
30
     * @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...
31
     *
32
     * @return static
33
     */
34
    public function accept($type)
35
    {
36
        return $this->attribute('accept', $type);
37
    }
38
39
    /**
40
     * @return static
41
     */
42
    public function acceptAudio()
43
    {
44
        return $this->attribute('accept', self::ACCEPT_AUDIO);
45
    }
46
47
    /**
48
     * @return static
49
     */
50
    public function acceptVideo()
51
    {
52
        return $this->attribute('accept', self::ACCEPT_VIDEO);
53
    }
54
55
    /**
56
     * @return static
57
     */
58
    public function acceptImage()
59
    {
60
        return $this->attribute('accept', self::ACCEPT_IMAGE);
61
    }
62
63
    /**
64
     * @return static
65
     */
66
    public function multiple()
67
    {
68
        return $this->attribute('multiple');
69
    }
70
}
71