Code Duplication    Length = 19-19 lines in 2 locations

src/Definition/Extension/NamespaceDefinitionExtension.php 2 locations

@@ 220-238 (lines=19) @@
217
     *
218
     * @return ObjectDefinition
219
     */
220
    private function createChildNamespace(ObjectDefinitionInterface $parent, $name, $typeName, Endpoint $endpoint): ObjectDefinition
221
    {
222
        $child = new FieldDefinition();
223
        $child->setName($name);
224
        $child->setResolver(EmptyObjectResolver::class);
225
226
        $type = new ObjectDefinition();
227
        $type->setName($typeName);
228
        if ($endpoint->hasType($type->getName())) {
229
            $type = $endpoint->getType($type->getName());
230
        } else {
231
            $endpoint->add($type);
232
        }
233
234
        $child->setType($type->getName());
235
        $parent->addField($child);
236
237
        return $type;
238
    }
239
240
    /**
241
     * @param string   $rootType Class of the root type to create QueryDefinition or MutationDefinition
@@ 248-266 (lines=19) @@
245
     *
246
     * @return ExecutableDefinitionInterface
247
     */
248
    private function createRootNamespace($rootType, $name, $typeName, Endpoint $endpoint): ExecutableDefinitionInterface
249
    {
250
        /** @var ExecutableDefinitionInterface $rootDefinition */
251
        $rootDefinition = new $rootType();
252
        $rootDefinition->setName($name);
253
        $rootDefinition->setResolver(EmptyObjectResolver::class);
254
255
        $type = new ObjectDefinition();
256
        $type->setName($typeName);
257
        if ($endpoint->hasType($type->getName())) {
258
            $type = $endpoint->getType($type->getName());
259
        } else {
260
            $endpoint->add($type);
261
        }
262
263
        $rootDefinition->setType($type->getName());
264
265
        return $rootDefinition;
266
    }
267
}
268