MutationType::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 15
c 0
b 0
f 0
ccs 0
cts 13
cp 0
rs 10
cc 2
nc 1
nop 1
crap 6
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Type;
12
13
/**
14
 * Class MutationType
15
 */
16
class MutationType extends QueryType
17
{
18
    /**
19
     * MutationType constructor.
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