@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function __construct(ServiceProcessor $processor = null) |
40 | 40 | { |
41 | - $this->processor = $processor ? : new ServiceProcessor(); |
|
41 | + $this->processor = $processor ?: new ServiceProcessor(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function getConfigKey() |
@@ -103,9 +103,9 @@ |
||
103 | 103 | |
104 | 104 | /** @var iterable $files */ |
105 | 105 | $files = Finder::create() |
106 | - ->in($dirs) |
|
107 | - ->date(sprintf('>= %s', date('Y-m-d H:i:s', $controlTime))) |
|
108 | - ->files(); |
|
106 | + ->in($dirs) |
|
107 | + ->date(sprintf('>= %s', date('Y-m-d H:i:s', $controlTime))) |
|
108 | + ->files(); |
|
109 | 109 | |
110 | 110 | //exist at least one modified file |
111 | 111 | foreach ($files as $file) { |
@@ -37,13 +37,13 @@ |
||
37 | 37 | [ |
38 | 38 | 'name' => $definition->getName(), |
39 | 39 | 'description' => $definition->getDescription(), |
40 | - 'fields' => function () use ($definition) { |
|
40 | + 'fields' => function() use ($definition) { |
|
41 | 41 | return GraphQLBuilder::resolveFields($definition); |
42 | 42 | }, |
43 | - 'interfaces' => function () { |
|
43 | + 'interfaces' => function() { |
|
44 | 44 | return $this->resolveInterfaces(); |
45 | 45 | }, |
46 | - 'resolveField' => function ($root, array $args, $context, ResolveInfo $resolveInfo) { |
|
46 | + 'resolveField' => function($root, array $args, $context, ResolveInfo $resolveInfo) { |
|
47 | 47 | $resolver = new ObjectFieldResolver( |
48 | 48 | $this->container, |
49 | 49 | $this->endpoint, |
@@ -43,10 +43,10 @@ |
||
43 | 43 | [ |
44 | 44 | 'name' => $definition->getName(), |
45 | 45 | 'description' => $definition->getDescription(), |
46 | - 'fields' => function () use ($definition) { |
|
46 | + 'fields' => function() use ($definition) { |
|
47 | 47 | return GraphQLBuilder::resolveFields($definition); |
48 | 48 | }, |
49 | - 'resolveType' => function ($value) { |
|
49 | + 'resolveType' => function($value) { |
|
50 | 50 | return TypeUtil::resolveObjectType($this->endpoint, $value); |
51 | 51 | }, |
52 | 52 | ] |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return null|string |
84 | 84 | */ |
85 | - public function getClassForType(string $type):?string |
|
85 | + public function getClassForType(string $type): ?string |
|
86 | 86 | { |
87 | 87 | if (isset($this->typeMap[$type])) { |
88 | 88 | return $this->typeMap[$type]; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $types = array_filter( |
112 | 112 | $this->typeMap, |
113 | - function ($val) use ($class) { |
|
113 | + function($val) use ($class) { |
|
114 | 114 | return $val === $class; |
115 | 115 | } |
116 | 116 | ); |
@@ -42,10 +42,10 @@ |
||
42 | 42 | protected function configure() |
43 | 43 | { |
44 | 44 | $this->setName('graphql:schema:export') |
45 | - ->setDescription('Export your schema.') |
|
46 | - ->addOption('endpoint', null, InputOption::VALUE_REQUIRED, 'Name of the endpoint to export', DefinitionRegistry::DEFAULT_ENDPOINT) |
|
47 | - ->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'Name of the file to save the schema, e.i. schema.graphql or schema.json') |
|
48 | - ->addOption('json', null, InputOption::VALUE_NONE, 'Create json output, automatically used if the output contains json extension'); |
|
45 | + ->setDescription('Export your schema.') |
|
46 | + ->addOption('endpoint', null, InputOption::VALUE_REQUIRED, 'Name of the endpoint to export', DefinitionRegistry::DEFAULT_ENDPOINT) |
|
47 | + ->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'Name of the file to save the schema, e.i. schema.graphql or schema.json') |
|
48 | + ->addOption('json', null, InputOption::VALUE_NONE, 'Create json output, automatically used if the output contains json extension'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -57,11 +57,11 @@ |
||
57 | 57 | protected function configure() |
58 | 58 | { |
59 | 59 | $this->setName('graphql:schema:snapshot') |
60 | - ->setDescription('Create a snapshot of your schema to compare using behat tests.') |
|
61 | - ->addOption('endpoint', null, InputOption::VALUE_REQUIRED, 'Name of the endpoint to export', DefinitionRegistry::DEFAULT_ENDPOINT) |
|
62 | - ->addOption('all', 'a', InputOption::VALUE_NONE, 'Create snapshot for all registered endpoints') |
|
63 | - ->addOption('strict', null, InputOption::VALUE_NONE, 'When use strict mode the snapshot must be updated every time your schema change') |
|
64 | - ->addOption('features', null, InputOption::VALUE_REQUIRED, 'Path where should be located the generated features and fixtures'); |
|
60 | + ->setDescription('Create a snapshot of your schema to compare using behat tests.') |
|
61 | + ->addOption('endpoint', null, InputOption::VALUE_REQUIRED, 'Name of the endpoint to export', DefinitionRegistry::DEFAULT_ENDPOINT) |
|
62 | + ->addOption('all', 'a', InputOption::VALUE_NONE, 'Create snapshot for all registered endpoints') |
|
63 | + ->addOption('strict', null, InputOption::VALUE_NONE, 'When use strict mode the snapshot must be updated every time your schema change') |
|
64 | + ->addOption('features', null, InputOption::VALUE_REQUIRED, 'Path where should be located the generated features and fixtures'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -44,44 +44,44 @@ discard block |
||
44 | 44 | protected function configureEndpoints(NodeBuilder $root) |
45 | 45 | { |
46 | 46 | $endpoints = $root->arrayNode('endpoints') |
47 | - ->useAttributeAsKey('name') |
|
48 | - ->validate() |
|
49 | - ->ifTrue( |
|
50 | - function ($v) { |
|
51 | - return array_key_exists('default', $v); |
|
52 | - } |
|
53 | - )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
54 | - ->end() |
|
55 | - ->arrayPrototype() |
|
56 | - ->children(); |
|
47 | + ->useAttributeAsKey('name') |
|
48 | + ->validate() |
|
49 | + ->ifTrue( |
|
50 | + function ($v) { |
|
51 | + return array_key_exists('default', $v); |
|
52 | + } |
|
53 | + )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
54 | + ->end() |
|
55 | + ->arrayPrototype() |
|
56 | + ->children(); |
|
57 | 57 | |
58 | 58 | $endpoints->arrayNode('roles') |
59 | - ->beforeNormalization() |
|
60 | - ->ifString() |
|
61 | - ->then( |
|
62 | - function ($v) { |
|
63 | - return preg_split('/\s*,\s*/', $v); |
|
64 | - } |
|
65 | - ) |
|
66 | - ->end() |
|
67 | - ->prototype('scalar') |
|
68 | - ->end(); |
|
59 | + ->beforeNormalization() |
|
60 | + ->ifString() |
|
61 | + ->then( |
|
62 | + function ($v) { |
|
63 | + return preg_split('/\s*,\s*/', $v); |
|
64 | + } |
|
65 | + ) |
|
66 | + ->end() |
|
67 | + ->prototype('scalar') |
|
68 | + ->end(); |
|
69 | 69 | |
70 | 70 | $endpoints->scalarNode('host')->example('^api\.backend\.'); |
71 | 71 | $endpoints->scalarNode('path')->example('/backend'); |
72 | 72 | |
73 | 73 | $root->arrayNode('endpoint_alias') |
74 | - ->info('Use alias to refer to multiple endpoints using only one name') |
|
75 | - ->useAttributeAsKey('name') |
|
76 | - ->beforeNormalization() |
|
77 | - ->ifString() |
|
78 | - ->then( |
|
79 | - function ($v) { |
|
80 | - return preg_split('/\s*,\s*/', $v); |
|
81 | - } |
|
82 | - ) |
|
83 | - ->end() |
|
84 | - ->variablePrototype(); |
|
74 | + ->info('Use alias to refer to multiple endpoints using only one name') |
|
75 | + ->useAttributeAsKey('name') |
|
76 | + ->beforeNormalization() |
|
77 | + ->ifString() |
|
78 | + ->then( |
|
79 | + function ($v) { |
|
80 | + return preg_split('/\s*,\s*/', $v); |
|
81 | + } |
|
82 | + ) |
|
83 | + ->end() |
|
84 | + ->variablePrototype(); |
|
85 | 85 | |
86 | 86 | $root->scalarNode('endpoint_default')->info('Endpoint to apply to all definitions without explicit endpoint.'); |
87 | 87 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $graphiql = $root->arrayNode('graphiql')->addDefaultsIfNotSet()->children(); |
93 | 93 | |
94 | 94 | $graphiql->scalarNode('title') |
95 | - ->defaultValue('GraphQL API Explorer'); |
|
95 | + ->defaultValue('GraphQL API Explorer'); |
|
96 | 96 | |
97 | 97 | $graphiql |
98 | 98 | ->scalarNode('data_warning_message') |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ->defaultFalse(); |
121 | 121 | |
122 | 122 | $authentication->scalarNode('login_message') |
123 | - ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
123 | + ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
124 | 124 | |
125 | 125 | $authenticationProvider = $authentication->arrayNode('provider')->children(); |
126 | 126 | |
@@ -129,29 +129,29 @@ discard block |
||
129 | 129 | $jwtLogin = $jwt->arrayNode('login')->children(); |
130 | 130 | |
131 | 131 | $jwtLogin->scalarNode('url') |
132 | - ->info('Route name or URI to make the login process to retrieve the token.') |
|
133 | - ->isRequired(); |
|
132 | + ->info('Route name or URI to make the login process to retrieve the token.') |
|
133 | + ->isRequired(); |
|
134 | 134 | |
135 | 135 | $jwtLogin->scalarNode('username_parameter') |
136 | - ->defaultValue('username'); |
|
136 | + ->defaultValue('username'); |
|
137 | 137 | |
138 | 138 | $jwtLogin->scalarNode('username_label') |
139 | - ->defaultValue('Username'); |
|
139 | + ->defaultValue('Username'); |
|
140 | 140 | |
141 | 141 | $jwtLogin->scalarNode('password_parameter') |
142 | - ->defaultValue('password'); |
|
142 | + ->defaultValue('password'); |
|
143 | 143 | |
144 | 144 | $jwtLogin->scalarNode('password_label') |
145 | - ->defaultValue('Password'); |
|
145 | + ->defaultValue('Password'); |
|
146 | 146 | |
147 | 147 | $jwtLogin->enumNode('parameters_in') |
148 | - ->values(['form', 'query', 'header']) |
|
149 | - ->info('How pass parameters to request the token') |
|
150 | - ->defaultValue('form'); |
|
148 | + ->values(['form', 'query', 'header']) |
|
149 | + ->info('How pass parameters to request the token') |
|
150 | + ->defaultValue('form'); |
|
151 | 151 | |
152 | 152 | $jwtLogin->scalarNode('response_token_path') |
153 | - ->defaultValue('token') |
|
154 | - ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
153 | + ->defaultValue('token') |
|
154 | + ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
155 | 155 | |
156 | 156 | $jwtRequests = $jwt->arrayNode('requests')->addDefaultsIfNotSet()->children(); |
157 | 157 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | ->info('Customize how the token should be send, use the place holder {token} to replace for current token'); |
170 | 170 | |
171 | 171 | $authenticationProvider->scalarNode('custom') |
172 | - ->defaultNull() |
|
173 | - ->info('Configure custom service to use as authentication provider'); |
|
172 | + ->defaultNull() |
|
173 | + ->info('Configure custom service to use as authentication provider'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | protected function configureCORS(NodeBuilder $root) |
@@ -193,25 +193,25 @@ discard block |
||
193 | 193 | { |
194 | 194 | $pagination = $root->arrayNode('pagination')->addDefaultsIfNotSet()->children(); |
195 | 195 | $pagination->integerNode('limit') |
196 | - ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
196 | + ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | protected function configurePluginNamespaceGlobalConfig(NodeBuilder $root) |
200 | 200 | { |
201 | 201 | $namespaces = $root->arrayNode('namespaces') |
202 | - ->info( |
|
203 | - 'Group GraphQL schema using namespaced schemas. |
|
202 | + ->info( |
|
203 | + 'Group GraphQL schema using namespaced schemas. |
|
204 | 204 | On large schemas is helpful to keep schemas grouped by bundle and node' |
205 | - ) |
|
206 | - ->canBeEnabled() |
|
207 | - ->addDefaultsIfNotSet() |
|
208 | - ->children(); |
|
205 | + ) |
|
206 | + ->canBeEnabled() |
|
207 | + ->addDefaultsIfNotSet() |
|
208 | + ->children(); |
|
209 | 209 | |
210 | 210 | $bundles = $namespaces->arrayNode('bundles') |
211 | - ->info('Group each bundle into a separate schema definition') |
|
212 | - ->canBeDisabled() |
|
213 | - ->addDefaultsIfNotSet() |
|
214 | - ->children(); |
|
211 | + ->info('Group each bundle into a separate schema definition') |
|
212 | + ->canBeDisabled() |
|
213 | + ->addDefaultsIfNotSet() |
|
214 | + ->children(); |
|
215 | 215 | |
216 | 216 | $bundles->scalarNode('query_suffix') |
217 | 217 | ->info('The following suffix will be used for bundle query groups') |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | ->children(); |
243 | 243 | |
244 | 244 | $nodes->scalarNode('query_suffix') |
245 | - ->info('The following suffix will be used to create the name for queries to the same node') |
|
246 | - ->defaultValue('Query'); |
|
245 | + ->info('The following suffix will be used to create the name for queries to the same node') |
|
246 | + ->defaultValue('Query'); |
|
247 | 247 | |
248 | 248 | $nodes->scalarNode('mutation_suffix') |
249 | - ->info('The following suffix will be used to create the name for mutations to the same node') |
|
250 | - ->defaultValue('Mutation'); |
|
249 | + ->info('The following suffix will be used to create the name for mutations to the same node') |
|
250 | + ->defaultValue('Mutation'); |
|
251 | 251 | |
252 | 252 | $nodes->variableNode('ignore') |
253 | - ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
254 | - ->defaultValue(['Node']); |
|
253 | + ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
254 | + ->defaultValue(['Node']); |
|
255 | 255 | |
256 | 256 | $nodes->arrayNode('aliases') |
257 | - ->info( |
|
258 | - 'Define aliases for nodes to set definitions inside other desired node name. |
|
257 | + ->info( |
|
258 | + 'Define aliases for nodes to set definitions inside other desired node name. |
|
259 | 259 | Can be used to group multiple nodes or publish a node with a different group name' |
260 | - ) |
|
261 | - ->example('InvoiceItem: Invoice') |
|
262 | - ->useAttributeAsKey('name') |
|
263 | - ->prototype('scalar'); |
|
260 | + ) |
|
261 | + ->example('InvoiceItem: Invoice') |
|
262 | + ->useAttributeAsKey('name') |
|
263 | + ->prototype('scalar'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | private function configureSecurity(NodeBuilder $rootNode) |
@@ -239,7 +239,7 @@ |
||
239 | 239 | public function sendRequest($method, $uri, array $parameters = [], array $files = [], array $server = [], $content = null, $changeHistory = true) |
240 | 240 | { |
241 | 241 | set_error_handler( |
242 | - function ($level, $message, $errFile, $errLine) { |
|
242 | + function($level, $message, $errFile, $errLine) { |
|
243 | 243 | if ($this->deprecationAdviser) { |
244 | 244 | $this->deprecationAdviser->addWarning($message, $errFile, $errLine); |
245 | 245 | } |