| Conditions | 6 |
| Paths | 7 |
| Total Lines | 28 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 6 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 55 | 8 | private function run() |
|
| 56 | { |
||
| 57 | 8 | if (is_object($this->destination) === false) { |
|
| 58 | 2 | throw new \Exception('Destination is not an object'); |
|
| 59 | } |
||
| 60 | |||
| 61 | /** @var \ReflectionObject $reflection */ |
||
| 62 | 6 | $reflection = new \ReflectionObject($this->destination); |
|
| 63 | |||
| 64 | /** @var \ReflectionProperty[] $properties */ |
||
| 65 | 6 | $properties = $reflection->getProperties(); |
|
| 66 | |||
| 67 | 6 | foreach ($properties as $property) { |
|
| 68 | 6 | $name = $property->getName(); |
|
| 69 | |||
| 70 | 6 | if (isset($this->source[$name])) { |
|
| 71 | 6 | $value = $this->source[$name]; |
|
| 72 | 6 | $readonly = ($property->isPublic() === false && $property->isStatic() === false); |
|
| 73 | |||
| 74 | 6 | if ($readonly === true) { |
|
| 75 | 6 | $property->setAccessible(true); |
|
| 76 | 6 | } |
|
| 77 | |||
| 78 | 6 | $property->setValue($this->destination, $value); |
|
| 79 | 6 | } |
|
| 80 | 6 | } |
|
| 81 | 6 | return $this->destination; |
|
| 82 | } |
||
| 83 | } |