| Conditions | 5 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public function transform(VirtualBusinessPage &$sourceObject) |
||
| 11 | { |
||
| 12 | $bp = new BusinessPage(); |
||
| 13 | |||
| 14 | $sourceReflection = new \ReflectionObject($sourceObject); |
||
| 15 | $sourceProperties = $sourceReflection->getProperties(); |
||
| 16 | foreach ($sourceProperties as $sourceProperty) { |
||
| 17 | $sourceProperty->setAccessible(true); |
||
| 18 | $name = $sourceProperty->getName(); |
||
| 19 | |||
| 20 | $value = $sourceProperty->getValue($sourceObject); |
||
| 21 | $method = 'set'.ucfirst($name); |
||
| 22 | if (method_exists($bp, $method) && $value !== null) { |
||
| 23 | $bp->$method($value); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | foreach ($sourceObject->getTranslations() as $translation) { |
||
| 28 | $bp->addTranslation($translation); |
||
| 29 | } |
||
| 30 | |||
| 31 | $sourceObject = $bp; |
||
| 32 | } |
||
| 33 | } |
||
| 34 |