Code Duplication    Length = 18-18 lines in 2 locations

src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php 2 locations

@@ 154-171 (lines=18) @@
151
                );
152
            }
153
        }
154
        foreach ($this->getDoctrineEmbedOneFields($doctrineMapping) as $doctrineField) {
155
            $serializerField = isset($serializerFields[$doctrineField['name']]) ?
156
                $serializerFields[$doctrineField['name']] :
157
                null;
158
            $schemaField = isset($schemaFields[$doctrineField['name']]) ?
159
                $schemaFields[$doctrineField['name']] :
160
                null;
161
162
            $fields[] = new EmbedOne(
163
                $this->getDocument($doctrineField['type']),
164
                $doctrineField['name'],
165
                $serializerField === null ? $doctrineField['name'] : $serializerField['exposedName'],
166
                !isset($schemaField['readOnly']) ? false : $schemaField['readOnly'],
167
                ($schemaField === null || !isset($schemaField['required'])) ? false : $schemaField['required'],
168
                !isset($schemaField['recordOriginException']) ? false : $schemaField['recordOriginException'],
169
                !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
170
            );
171
        }
172
        foreach ($this->getDoctrineEmbedManyFields($doctrineMapping) as $doctrineField) {
173
            $serializerField = isset($serializerFields[$doctrineField['name']]) ?
174
                $serializerFields[$doctrineField['name']] :
@@ 172-189 (lines=18) @@
169
                !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
170
            );
171
        }
172
        foreach ($this->getDoctrineEmbedManyFields($doctrineMapping) as $doctrineField) {
173
            $serializerField = isset($serializerFields[$doctrineField['name']]) ?
174
                $serializerFields[$doctrineField['name']] :
175
                null;
176
            $schemaField = isset($schemaFields[$doctrineField['name']]) ?
177
                $schemaFields[$doctrineField['name']] :
178
                null;
179
180
            $fields[] = new EmbedMany(
181
                $this->getDocument($doctrineField['type']),
182
                $doctrineField['name'],
183
                $serializerField === null ? $doctrineField['name'] : $serializerField['exposedName'],
184
                !isset($schemaField['readOnly']) ? false : $schemaField['readOnly'],
185
                ($schemaField === null || !isset($schemaField['required'])) ? false : $schemaField['required'],
186
                !isset($schemaField['recordOriginException']) ? false : $schemaField['recordOriginException'],
187
                !isset($schemaField['restrictions']) ? [] : $schemaField['restrictions']
188
            );
189
        }
190
191
        $doc = new Document($className, $fields);
192