File   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 83
rs 10
c 1
b 0
f 0
wmc 9
lcom 1
cbo 2

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A name() 0 4 1
A required() 0 4 1
A autofocus() 0 4 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
7
class File extends BaseElement
8
{
9
    protected $tag = 'input';
10
11
    const ACCEPT_AUDIO = 'audio/*';
12
    const ACCEPT_VIDEO = 'video/*';
13
    const ACCEPT_IMAGE = 'image/*';
14
15
    public function __construct()
16
    {
17
        parent::__construct();
18
19
        $this->attributes->setAttribute('type', 'file');
20
    }
21
22
    /**
23
     * @param string|null $name
24
     *
25
     * @return static
26
     */
27
    public function name($name)
28
    {
29
        return $this->attribute('name', $name);
30
    }
31
32
    /**
33
     * @return static
34
     */
35
    public function required()
36
    {
37
        return $this->attribute('required');
38
    }
39
40
    /**
41
     * @return static
42
     */
43
    public function autofocus()
44
    {
45
        return $this->attribute('autofocus');
46
    }
47
48
    /**
49
     * @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...
50
     *
51
     * @return static
52
     */
53
    public function accept($type)
54
    {
55
        return $this->attribute('accept', $type);
56
    }
57
58
    /**
59
     * @return static
60
     */
61
    public function acceptAudio()
62
    {
63
        return $this->attribute('accept', self::ACCEPT_AUDIO);
64
    }
65
66
    /**
67
     * @return static
68
     */
69
    public function acceptVideo()
70
    {
71
        return $this->attribute('accept', self::ACCEPT_VIDEO);
72
    }
73
74
    /**
75
     * @return static
76
     */
77
    public function acceptImage()
78
    {
79
        return $this->attribute('accept', self::ACCEPT_IMAGE);
80
    }
81
82
    /**
83
     * @return static
84
     */
85
    public function multiple()
86
    {
87
        return $this->attribute('multiple');
88
    }
89
}
90