Code Duplication    Length = 9-9 lines in 2 locations

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

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