Code Duplication    Length = 19-19 lines in 2 locations

src/Definition/Extension/NamespaceDefinitionExtension.php 2 locations

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