Total Complexity | 3 |
Total Lines | 126 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class SchemaExporter |
||
17 | { |
||
18 | /** |
||
19 | * @var SchemaCompiler |
||
20 | */ |
||
21 | protected $compiler; |
||
22 | |||
23 | private const INTROSPECTION_QUERY = <<<GraphQL |
||
24 | query IntrospectionQuery { |
||
25 | __schema { |
||
26 | queryType { name } |
||
27 | mutationType { name } |
||
28 | subscriptionType { name } |
||
29 | types { |
||
30 | ...FullType |
||
31 | } |
||
32 | directives { |
||
33 | name |
||
34 | description |
||
35 | locations |
||
36 | args { |
||
37 | ...InputValue |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | |||
43 | fragment FullType on __Type { |
||
44 | kind |
||
45 | name |
||
46 | description |
||
47 | fields(includeDeprecated: true) { |
||
48 | name |
||
49 | description |
||
50 | args { |
||
51 | ...InputValue |
||
52 | } |
||
53 | type { |
||
54 | ...TypeRef |
||
55 | } |
||
56 | isDeprecated |
||
57 | deprecationReason |
||
58 | } |
||
59 | inputFields { |
||
60 | ...InputValue |
||
61 | } |
||
62 | interfaces { |
||
63 | ...TypeRef |
||
64 | } |
||
65 | enumValues(includeDeprecated: true) { |
||
66 | name |
||
67 | description |
||
68 | isDeprecated |
||
69 | deprecationReason |
||
70 | } |
||
71 | possibleTypes { |
||
72 | ...TypeRef |
||
73 | } |
||
74 | } |
||
75 | |||
76 | fragment InputValue on __InputValue { |
||
77 | name |
||
78 | description |
||
79 | type { ...TypeRef } |
||
80 | defaultValue |
||
81 | } |
||
82 | |||
83 | fragment TypeRef on __Type { |
||
84 | kind |
||
85 | name |
||
86 | ofType { |
||
87 | kind |
||
88 | name |
||
89 | ofType { |
||
90 | kind |
||
91 | name |
||
92 | ofType { |
||
93 | kind |
||
94 | name |
||
95 | ofType { |
||
96 | kind |
||
97 | name |
||
98 | ofType { |
||
99 | kind |
||
100 | name |
||
101 | ofType { |
||
102 | kind |
||
103 | name |
||
104 | ofType { |
||
105 | kind |
||
106 | name |
||
107 | } |
||
108 | } |
||
109 | } |
||
110 | } |
||
111 | } |
||
112 | } |
||
113 | } |
||
114 | } |
||
115 | GraphQL; |
||
116 | |||
117 | /** |
||
118 | * @param SchemaCompiler $compiler |
||
119 | */ |
||
120 | public function __construct(SchemaCompiler $compiler) |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @param string $endpoint |
||
127 | * @param bool $json |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function export(string $endpoint, bool $json = false): string |
||
144 |