Code Duplication    Length = 20-21 lines in 4 locations

src/Frontend/Builder/Definition/ArgumentBuilder.php 1 location

@@ 22-42 (lines=21) @@
19
/**
20
 * Class ArgumentBuilder
21
 */
22
class ArgumentBuilder extends DefinitionBuilder
23
{
24
    /**
25
     * @param Readable $file
26
     * @param RuleInterface|ArgumentDefinitionNode $ast
27
     * @return \Generator|mixed
28
     */
29
    public function build(Readable $file, RuleInterface $ast)
30
    {
31
        $argument = new TypeDefinition($ast->getFullName());
32
        $argument->in($file, $ast->getOffset());
33
34
        $argument->type = Type::ARGUMENT;
35
        $argument->description = $ast->getDescription();
36
37
        $argument->modifiers = $ast->getHintModifiers();
38
        $argument->hint = $ast->getHintTypeName();
39
40
        return $argument;
41
    }
42
}
43

src/Frontend/Builder/Definition/InputFieldBuilder.php 1 location

@@ 23-43 (lines=21) @@
20
/**
21
 * Class InputFieldBuilder
22
 */
23
class InputFieldBuilder extends DefinitionBuilder
24
{
25
    /**
26
     * @param Readable $file
27
     * @param RuleInterface|InputFieldDefinitionNode $ast
28
     * @return \Generator|mixed
29
     */
30
    public function build(Readable $file, RuleInterface $ast)
31
    {
32
        $field = new TypeDefinition($ast->getFullName());
33
        $field->in($file, $ast->getOffset());
34
        
35
        $field->type = Type::INPUT_FIELD_DEFINITION;
36
        $field->description = $ast->getDescription();
37
38
        $field->modifiers = $ast->getHintModifiers();
39
        $field->hint = $ast->getHintTypeName();
40
41
        return $field;
42
    }
43
}
44

src/Frontend/Builder/Definition/ScalarBuilder.php 1 location

@@ 22-41 (lines=20) @@
19
/**
20
 * Class ScalarBuilder
21
 */
22
class ScalarBuilder extends DefinitionBuilder
23
{
24
    /**
25
     * @param Readable $file
26
     * @param RuleInterface|ScalarDefinitionNode $ast
27
     * @return \Generator|mixed
28
     */
29
    public function build(Readable $file, RuleInterface $ast)
30
    {
31
        $scalar = new TypeDefinition($ast->getFullName());
32
        $scalar->in($file, $ast->getOffset());
33
34
        $scalar->type = Type::SCALAR;
35
        $scalar->description = $ast->getDescription();
36
37
        $scalar->extends = $ast->getExtends();
38
39
        return $scalar;
40
    }
41
}
42

src/Frontend/Builder/Definition/SchemaFieldBuilder.php 1 location

@@ 23-43 (lines=21) @@
20
/**
21
 * Class SchemaFieldBuilder
22
 */
23
class SchemaFieldBuilder extends DefinitionBuilder
24
{
25
    /**
26
     * @param Readable $file
27
     * @param RuleInterface|SchemaFieldDefinitionNode $ast
28
     * @return \Generator|mixed
29
     */
30
    public function build(Readable $file, RuleInterface $ast)
31
    {
32
        $field = new TypeDefinition($ast->getFullName());
33
        $field->in($file, $ast->getOffset());
34
35
        $field->type = Type::SCHEMA_FIELD;
36
        $field->description = $ast->getDescription();
37
38
        $field->modifiers = $ast->getHintModifiers();
39
        $field->hint = $ast->getHintTypeName();
40
41
        return $field;
42
    }
43
}
44