Passed
Push — master ( 749b16...167cfa )
by Gabor
04:47
created

HtmlMultipleFormElement::setMultiple()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2017 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link      http://www.gixx-web.com
11
 */
12
declare(strict_types=1);
13
14
namespace WebHemi\Form\Html;
15
16
use WebHemi\Form\MultipleFormElementInterface;
17
18
/**
19
 * Class Html5FormElement
20
 */
21
class HtmlMultipleFormElement extends HtmlFormElement implements MultipleFormElementInterface
22
{
23
    public const HTML_ELEMENT_INPUT_FILE = 'file';
24
    public const HTML_ELEMENT_SELECT = 'select';
25
26
    /** @var bool */
27
    private $isMultiple = false;
28
    /** @var array */
29
    protected $validTypes = [
30
        self::HTML_ELEMENT_INPUT_FILE,
31
        self::HTML_ELEMENT_SELECT,
32
    ];
33
34
    /**
35
     * Sets element to be multiple
36
     *
37
     * @param bool $isMultiple
38
     * @return MultipleFormElementInterface
39
     */
40
    public function setMultiple(bool $isMultiple) : MultipleFormElementInterface
41
    {
42
        $this->isMultiple = $isMultiple;
43
44
        return $this;
45
    }
46
47
    /**
48
     * Gets element multiple flag.
49
     *
50
     * @return bool
51
     */
52
    public function getMultiple() : bool
53
    {
54
        return $this->isMultiple;
55
    }
56
}
57