Passed
Pull Request — master (#192)
by Alexander
02:53
created

MultipleTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 14
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A multiple() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Form\Field\Base;
6
7
/**
8
 * @psalm-require-extends AbstractField
9
 */
10
trait MultipleTrait
11
{
12
    /**
13
     * Allow to specify more than one value.
14
     *
15
     * @param bool $value Whether the user is to be allowed to specify more than one value.
16
     *
17
     * @link https://html.spec.whatwg.org/multipage/input.html#attr-input-multiple
18
     */
19
    public function multiple(bool $value = true): self
20
    {
21
        $new = clone $this;
22
        $new->inputTagAttributes['multiple'] = $value;
0 ignored issues
show
Bug Best Practice introduced by
The property inputTagAttributes does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
23
        return $new;
24
    }
25
}
26