AbstractCompositeSelectionField   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 25
ccs 0
cts 7
cp 0
rs 10
c 0
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\Field\Type\Abstracts;
4
5
use WebTheory\Saveyour\Contracts\Field\FormFieldInterface;
6
use WebTheory\Saveyour\Field\Abstracts\CompositeSelectionFieldTrait;
7
use WebTheory\Saveyour\Field\Abstracts\LabelMakerTrait;
8
use WebTheory\Saveyour\Field\Element\Label;
9
10
abstract class AbstractCompositeSelectionField extends AbstractFormField implements FormFieldInterface
11
{
12
    use LabelMakerTrait;
13
    use CompositeSelectionFieldTrait;
14
15
    protected array $labelOptions = [];
16
17
    public function getLabelOptions(): array
18
    {
19
        return $this->labelOptions;
20
    }
21
22
    /**
23
     * @return $this
24
     */
25
    public function setLabelOptions(array $labelOptions): AbstractCompositeSelectionField
26
    {
27
        $this->labelOptions = $labelOptions;
28
29
        return $this;
30
    }
31
32
    protected function createSelectionLabel($selection): Label
33
    {
34
        return $this->createLabel($this->defineSelectionLabel($selection), $this->labelOptions);
35
    }
36
}
37