Issue90Schema   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 51
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 46 3
1
<?php
2
namespace Youshido\Tests\Issues\Issue90;
3
4
use Youshido\GraphQL\Config\Schema\SchemaConfig;
5
use Youshido\GraphQL\Schema\AbstractSchema;
6
use Youshido\GraphQL\Type\Object\ObjectType;
7
use Youshido\GraphQL\Type\Scalar\DateTimeType;
8
9
class Issue90Schema extends AbstractSchema
10
{
11
12
    public function build(SchemaConfig $config)
13
    {
14
        $config->setQuery(
15
            new ObjectType([
16
                'name'   => 'QueryType',
17
                'fields' => [
18
                    'echo' => [
19
                        'type'    => new DateTimeType('Y-m-d H:ia'),
20
                        'args'    => [
21
                            'date' => new DateTimeType('Y-m-d H:ia')
22
                        ],
23
                        'resolve' => function ($value, $args, $info) {
0 ignored issues
show
Unused Code introduced by
The parameter $info is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
25
                            if (isset($args['date'])) {
26
                                return $args['date'];
27
                            }
28
29
                            return null;
30
                        }
31
                    ]
32
                ]
33
            ])
34
        );
35
36
        $config->setMutation(
37
            new ObjectType([
38
                'name'   => 'MutationType',
39
                'fields' => [
40
                    'echo' => [
41
                        'type'    => new DateTimeType('Y-m-d H:ia'),
42
                        'args'    => [
43
                            'date' => new DateTimeType('Y-m-d H:ia')
44
                        ],
45
                        'resolve' => function ($value, $args, $info) {
0 ignored issues
show
Unused Code introduced by
The parameter $info is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
47
                            if (isset($args['date'])) {
48
                                return $args['date'];
49
                            }
50
51
                            return null;
52
                        }
53
                    ]
54
                ]
55
            ])
56
        );
57
    }
58
59
}