Completed
Push — master ( 01dc8d...fb21bc )
by Emily
02:05
created

Reflector::__set()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 5
cp 0.8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 2.032
1
<?php namespace Spaark\CompositeUtils\Model\Reflection;
2
/**
3
 *
4
 */
5
6
use Spaark\CompositeUtils\Traits\AllReadableTrait;
7
8
class Reflector
9
{
10
    use AllReadableTrait;
11
12
    public static function blankInstance()
13
    {
14
        return new self();
15
    }
16
17
    private $locked = false;
18
19 9
    public function __set($var, $val)
20
    {
21 9
        if ($this->locked)
22
        {
23
            return parent::__set($var, $val);
24
        }
25
        else
26
        {
27 9
            $this->$var = $val;
28
        }
29 9
    }
30
31
    public function addTo($name, $args)
32
    {
33
        $var = lcfirst($name);
34
35
        $this->$var->add($args[0]);
36
    }
37
}
38