Code Duplication    Length = 15-16 lines in 2 locations

src/Type/MutationType.php 1 location

@@ 23-38 (lines=16) @@
20
     *
21
     * @param array $config
22
     */
23
    public function __construct(array $config = [])
24
    {
25
        $defaults = [
26
            'name' => 'Mutation',
27
            'fields' => function () {
28
                $mutations = [];
29
                foreach ($this->endpoint->allMutations() as $query) {
30
                    $mutations[$query->getName()] = $this->getQueryConfig($query);
31
                }
32
33
                return $mutations;
34
            },
35
        ];
36
37
        parent::__construct(array_merge($defaults, $config));
38
    }
39
}
40

src/Type/QueryType.php 1 location

@@ 36-50 (lines=15) @@
33
     *
34
     * @param array $config
35
     */
36
    public function __construct(array $config = [])
37
    {
38
        $defaults = [
39
            'name' => 'Query',
40
            'fields' => function () {
41
                $queries = [];
42
                foreach ($this->endpoint->allQueries() as $query) {
43
                    $queries[$query->getName()] = $this->getQueryConfig($query);
44
                }
45
46
                return $queries;
47
            },
48
        ];
49
        parent::__construct(array_merge($defaults, $config));
50
    }
51
52
    /**
53
     * @param QueryDefinition $query