Code Duplication    Length = 19-19 lines in 2 locations

src/Definition/Extension/NamespaceDefinitionExtension.php 2 locations

@@ 203-221 (lines=19) @@
200
     *
201
     * @return ObjectDefinition
202
     */
203
    private function createChildNamespace(ObjectDefinitionInterface $parent, $name, $typeName, Endpoint $endpoint): ObjectDefinition
204
    {
205
        $child = new FieldDefinition();
206
        $child->setName($name);
207
        $child->setResolver(EmptyObjectResolver::class);
208
209
        $type = new ObjectDefinition();
210
        $type->setName($typeName);
211
        if ($endpoint->hasType($type->getName())) {
212
            $type = $endpoint->getType($type->getName());
213
        } else {
214
            $endpoint->add($type);
215
        }
216
217
        $child->setType($type->getName());
218
        $parent->addField($child);
219
220
        return $type;
221
    }
222
223
    /**
224
     * @param string   $rootType Class of the root type to create QueryDefinition or MutationDefinition
@@ 231-249 (lines=19) @@
228
     *
229
     * @return ExecutableDefinitionInterface
230
     */
231
    private function createRootNamespace($rootType, $name, $typeName, Endpoint $endpoint): ExecutableDefinitionInterface
232
    {
233
        /** @var ExecutableDefinitionInterface $rootDefinition */
234
        $rootDefinition = new $rootType();
235
        $rootDefinition->setName($name);
236
        $rootDefinition->setResolver(EmptyObjectResolver::class);
237
238
        $type = new ObjectDefinition();
239
        $type->setName($typeName);
240
        if ($endpoint->hasType($type->getName())) {
241
            $type = $endpoint->getType($type->getName());
242
        } else {
243
            $endpoint->add($type);
244
        }
245
246
        $rootDefinition->setType($type->getName());
247
248
        return $rootDefinition;
249
    }
250
}
251