Code Duplication    Length = 9-9 lines in 2 locations

src/IPub/Forms/Forms/TEntityContainer.php 2 locations

@@ 105-113 (lines=9) @@
102
		foreach (self::iterate($formElement) as $name => $component) {
103
			if ($component instanceof Forms\IControl) {
104
				if (($classMetadata->hasField($name) || $classMetadata->hasAssociation($name)) && $value = $classMetadata->getFieldValue($entity, $name)) {
105
					if (is_object($value) && $this->isEntity($value)) {
106
						$UoW = $this->entityManager->getUnitOfWork();
107
						$value = $UoW->getSingleIdentifierValue($value);
108
109
						$component->setValue($value);
110
111
					} else {
112
						$component->setValue($value);
113
					}
114
115
				} else {
116
					$methodName = 'get' . ucfirst($name);
@@ 119-127 (lines=9) @@
116
					$methodName = 'get' . ucfirst($name);
117
118
					if (method_exists($entity, $methodName) && $value = call_user_func([$entity, $methodName])) {
119
						if (is_object($value) && $this->isEntity($value)) {
120
							$UoW = $this->entityManager->getUnitOfWork();
121
							$value = $UoW->getSingleIdentifierValue($value);
122
123
							$component->setValue($value);
124
125
						} else {
126
							$component->setValue($value);
127
						}
128
129
					} else {
130
						if ($erase) {