Passed
Push — master ( a90def...5de986 )
by Chris
04:49
created

AbstractCompositeSelectionField   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 40
ccs 0
cts 12
cp 0
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabelOptions() 0 3 1
A createSelectionLabel() 0 3 1
A setLabelOptions() 0 5 1
1
<?php
2
3
namespace WebTheory\Saveyour\Fields;
4
5
use WebTheory\Saveyour\Concerns\IsCompositeSelectionFieldTrait;
6
use WebTheory\Saveyour\Concerns\LabelMaker;
7
use WebTheory\Saveyour\Contracts\FormFieldInterface;
8
use WebTheory\Saveyour\Elements\Label;
9
10
abstract class AbstractCompositeSelectionField extends AbstractFormField implements FormFieldInterface
11
{
12
    use LabelMaker;
13
    use IsCompositeSelectionFieldTrait;
14
15
    /**
16
     * @var array
17
     */
18
    protected $labelOptions = [];
19
20
    /**
21
     * Get the value of labelOptions
22
     *
23
     * @return array
24
     */
25
    public function getLabelOptions(): array
26
    {
27
        return $this->labelOptions;
28
    }
29
30
    /**
31
     * Set the value of labelOptions
32
     *
33
     * @param array $labelOptions
34
     *
35
     * @return self
36
     */
37
    public function setLabelOptions(array $labelOptions)
38
    {
39
        $this->labelOptions = $labelOptions;
40
41
        return $this;
42
    }
43
44
    /**
45
     *
46
     */
47
    protected function createSelectionLabel($selection): Label
48
    {
49
        return $this->createLabel($this->defineSelectionLabel($selection), $this->labelOptions);
50
    }
51
}
52