MultiSelect   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
c 0
b 0
f 0
dl 0
loc 32
rs 10
ccs 11
cts 11
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilterAction() 0 3 1
A setValue() 0 4 1
A add() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace kalanis\kw_table\form_kw\Fields;
4
5
6
use kalanis\kw_connect\core\Interfaces\IFilterFactory;
7
8
9
/**
10
 * Class MultiSelect
11
 * @package kalanis\kw_table\form_kw\Fields
12
 * Field for selecting more than one entry, usually everything
13
 */
14
class MultiSelect extends AField
15
{
16
    protected string $value = '0';
17
18
    /**
19
     * @param string $value
20
     * @param array<string, string> $attributes
21
     */
22 1
    public function __construct($value = '0', array $attributes = [])
23
    {
24 1
        $this->setValue($value);
25 1
        parent::__construct($attributes);
26 1
    }
27
28 1
    public function getFilterAction(): string
29
    {
30 1
        return IFilterFactory::ACTION_EXACT;
31
    }
32
33
    /**
34
     * @param string $value
35
     * @return $this
36
     */
37 1
    public function setValue($value): self
38
    {
39 1
        $this->value = $value;
40 1
        return $this;
41
    }
42
43 1
    public function add(): void
44
    {
45 1
        $this->getFormInstance()->addCheckbox($this->alias, '', null, $this->value, $this->attributes);
46 1
    }
47
}
48