Code Duplication    Length = 15-17 lines in 3 locations

src/Type/Definition/Types/InputObjectType.php 1 location

@@ 44-58 (lines=15) @@
41
    /**
42
     * @return \Fubhy\GraphQL\Type\Definition\InputObjectField[]
43
     */
44
    public function getFields()
45
    {
46
        if (!isset($this->fieldMap)) {
47
            $this->fieldMap = [];
48
            foreach ($this->fields as $name => $field) {
49
                if (!isset($field['name'])) {
50
                    $field['name'] = $name;
51
                }
52
53
                $this->fieldMap[$name] = new InputObjectField($field);
54
            }
55
        }
56
57
        return $this->fieldMap;
58
    }
59
}
60

src/Type/Definition/Types/InterfaceType.php 1 location

@@ 72-88 (lines=17) @@
69
    /**
70
     * @return \Fubhy\GraphQL\Type\Definition\FieldDefinition[]
71
     */
72
    public function getFields()
73
    {
74
        if (!isset($this->fieldMap)) {
75
            $this->fieldMap = [];
76
            foreach ($this->fields as $name => $field) {
77
                if (!isset($field['name'])) {
78
                    $field['name'] = $name;
79
                }
80
81
                $this->fieldMap[$name] = new FieldDefinition($field);
82
            }
83
84
            unset($this->fields);
85
        }
86
87
        return $this->fieldMap;
88
    }
89
90
    /**
91
     * @param array $fields

src/Type/Definition/Types/ObjectType.php 1 location

@@ 64-80 (lines=17) @@
61
    /**
62
     * @return \Fubhy\GraphQL\Type\Definition\FieldDefinition[]
63
     */
64
    public function getFields()
65
    {
66
        if (!isset($this->fieldMap)) {
67
            $this->fieldMap = [];
68
            foreach ($this->fields as $name => $field) {
69
                if (!isset($field['name'])) {
70
                    $field['name'] = $name;
71
                }
72
73
                $this->fieldMap[$name] = new FieldDefinition($field);
74
            }
75
76
            unset($this->fields);
77
        }
78
79
        return $this->fieldMap;
80
    }
81
82
    /**
83
     * @param array $fields