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

CommonComposite   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setObservables() 0 6 2
A getObservables() 0 3 1
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