File   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 61
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 5

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A accept() 0 4 1
A acceptAudio() 0 4 1
A acceptVideo() 0 4 1
A acceptImage() 0 4 1
A multiple() 0 4 1
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