Completed
Push — master ( a51be7...c74983 )
by Antony
02:19
created

CommonComposite::getObservables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace 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) {
0 ignored issues
show
Bug introduced by
The property children does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
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
31