Completed
Pull Request — master (#43)
by Jose Manuel
02:54
created

GetIntrospection::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Softonic\GraphQL\Console\Mutation;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class GetIntrospection extends Command
10
{
11
    protected static $defaultName = 'mutation:introspection';
12
13
    protected function configure()
14
    {
15
        $this->setDescription('Returns a instrospection query.')
16
            ->setHelp('Returns the introspection query needed to execute in your GraphQL server in order ' .
17
                'to generate the needed file to generate the config.');
18
    }
19
20
    protected function execute(InputInterface $input, OutputInterface $output)
21
    {
22
        $output->writeln(
23
            <<<'GQL'
24
query IntrospectionQuery {
25
  __schema {
26
    mutationType { name }
27
    types {
28
      ...FullType
29
    }
30
  }
31
}
32
33
fragment FullType on __Type {
34
  kind
35
  name
36
  description
37
  fields(includeDeprecated: true) {
38
    name
39
    description
40
    args {
41
      ...InputValue
42
    }
43
  }
44
  inputFields {
45
    ...InputValue
46
  }
47
}
48
49
fragment InputValue on __InputValue {
50
  name
51
  description
52
  type { ...TypeRef }
53
  defaultValue
54
}
55
56
fragment TypeRef on __Type {
57
  kind
58
  name
59
  ofType {
60
    kind
61
    name
62
    ofType {
63
      kind
64
      name
65
      ofType {
66
        kind
67
        name
68
        ofType {
69
          kind
70
          name
71
          ofType {
72
            kind
73
            name
74
            ofType {
75
              kind
76
              name
77
              ofType {
78
                kind
79
                name
80
              }
81
            }
82
          }
83
        }
84
      }
85
    }
86
  }
87
}
88
GQL
89
        );
90
    }
91
}
92