Passed
Branch master (e5ff15)
by Antony
01:18
created

CommonComposite::setObservables()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
namespace AntonyThorpe\Knockout;
3
4
trait CommonComposite
5
{
6
    /**
7
     * setObservables
8
     *
9
     * @param array $names The names of the knockout observables.
10
     * @return $this
11
     */
12
    public function setObservables($names)
13
    {
14
        foreach ($this->children as $key => $field) {
15
            $field->setObservable($names[$key]);
16
        }
17
        return $this;
18
    }
19
20
    /**
21
     * getObservables
22
     *
23
     * @return array The observables used by the children
24
     */
25
    public function getObservables()
26
    {
27
        return $this->children->column('observable');
28
    }
29
}
30