Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | 2 | public function setValue($instance, $value) |
|
33 | { |
||
34 | 2 | $property = $this->property; |
|
35 | 2 | $className = get_class($instance); |
|
36 | |||
37 | 2 | if ($className === 'stdClass') { |
|
38 | 1 | $instance->$property = $value; |
|
39 | 1 | } else { |
|
40 | 1 | (new \ReflectionProperty($className, $property))->setValue($instance, $value); |
|
41 | } |
||
42 | |||
43 | 2 | return $instance; |
|
44 | } |
||
45 | } |
||
46 |