Passed
Branch master (1b2295)
by Antony
01:45
created

CommonComposite::getLabelClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace AntonyThorpe\Knockout;
3
4
trait CommonComposite
5
{
6
    /**
7
     * Place the label on the left or right hand side of the switch
8
     *
9
     * @var string left or other
10
     */
11
    protected $labelClass = "left";
12
13
    /**
14
     * setObservables
15
     *
16
     * @param array $names The names of the knockout observables.
17
     * @return $this
18
     */
19
    public function setObservables($names)
20
    {
21
        foreach ($this->children as $key => $field) {
22
            $field->setObservable($names[$key]);
23
        }
24
        return $this;
25
    }
26
27
    /**
28
     * getObservables
29
     *
30
     * @return array The observables used by the children
31
     */
32
    public function getObservables()
33
    {
34
        return $this->children->column('observable');
35
    }
36
37
    /**
38
     * set the Label class
39
     *
40
     * @param string $name The name of the label class
41
     * @return $this
42
     */
43
    public function setLabelClass($name)
44
    {
45
        $this->labelClass = trim($name);
46
        return $this;
47
    }
48
49
    /**
50
     * getLabelClass
51
     *
52
     * @return string The label class
53
     */
54
    public function getLabelClass()
55
    {
56
        return $this->labelClass;
57
    }
58
}
59