Code Duplication    Length = 11-11 lines in 2 locations

src/FinderAggregateRepository.php 2 locations

@@ 130-140 (lines=11) @@
127
            'data' => $this->mapper->fromTableRow($row)
128
        ];
129
130
        foreach ($this->relationsConfig as $entityName => $joinRule) {
131
            if (isset($relatedEntities[$entityName])) {
132
                if (isset($relatedEntities[$entityName][$row[$relatedField]])) {
133
                    $entityArgs['aggregateItems'][] = $relatedEntities[$entityName][$row[$relatedField]];
134
                } else {
135
                    $entityArgs['aggregateItems'][] = null;
136
                }
137
            } else {
138
                $entityArgs['aggregateItems'][] = null;
139
            }
140
        }
141
142
        $entity = $this->entityFactory->create($entityArgs);
143
@@ 192-202 (lines=11) @@
189
                'data' => $this->mapper->fromTableRow($row)
190
            ];
191
192
            foreach ($this->relationsConfig as $entityName => $joinRule) {
193
                if (isset($relatedEntities[$entityName])) {
194
                    if (isset($relatedEntities[$entityName][$row[$relatedField]])) {
195
                        $entityArgs['aggregateItems'][] = $relatedEntities[$entityName][$row[$relatedField]];
196
                    } else {
197
                        $entityArgs['aggregateItems'][] = null;
198
                    }
199
                } else {
200
                    $entityArgs['aggregateItems'][] = null;
201
                }
202
            }
203
204
            $entitiesArgs[] = $entityArgs;
205
        }