@@ -47,19 +47,19 @@ discard block |
||
| 47 | 47 | protected function configureErrorHandling(NodeBuilder $root) |
| 48 | 48 | { |
| 49 | 49 | $errorHandling = $root->arrayNode('error_handling') |
| 50 | - ->info('It is important to handle errors and when possible, report these errors back to your users for information. ') |
|
| 51 | - ->addDefaultsIfNotSet() |
|
| 52 | - ->children(); |
|
| 50 | + ->info('It is important to handle errors and when possible, report these errors back to your users for information. ') |
|
| 51 | + ->addDefaultsIfNotSet() |
|
| 52 | + ->children(); |
|
| 53 | 53 | |
| 54 | 54 | $errorHandling->booleanNode('show_trace')->info('Show error trace in debug mode')->defaultTrue(); |
| 55 | 55 | |
| 56 | 56 | $errorHandling->scalarNode('formatter') |
| 57 | - ->info('Formatter is responsible for converting instances of Error to an array') |
|
| 58 | - ->defaultValue(DefaultErrorFormatter::class); |
|
| 57 | + ->info('Formatter is responsible for converting instances of Error to an array') |
|
| 58 | + ->defaultValue(DefaultErrorFormatter::class); |
|
| 59 | 59 | |
| 60 | 60 | $errorHandling->scalarNode('handler') |
| 61 | - ->info('Handler is useful for error filtering and logging.') |
|
| 62 | - ->defaultValue(DefaultErrorHandler::class); |
|
| 61 | + ->info('Handler is useful for error filtering and logging.') |
|
| 62 | + ->defaultValue(DefaultErrorHandler::class); |
|
| 63 | 63 | |
| 64 | 64 | $controlledErrors = $errorHandling |
| 65 | 65 | ->arrayNode('controlled_errors') |
@@ -133,44 +133,44 @@ discard block |
||
| 133 | 133 | protected function configureEndpoints(NodeBuilder $root) |
| 134 | 134 | { |
| 135 | 135 | $endpoints = $root->arrayNode('endpoints') |
| 136 | - ->useAttributeAsKey('name') |
|
| 137 | - ->validate() |
|
| 138 | - ->ifTrue( |
|
| 139 | - function ($v) { |
|
| 140 | - return array_key_exists('default', $v); |
|
| 141 | - } |
|
| 142 | - )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
| 143 | - ->end() |
|
| 144 | - ->arrayPrototype() |
|
| 145 | - ->children(); |
|
| 136 | + ->useAttributeAsKey('name') |
|
| 137 | + ->validate() |
|
| 138 | + ->ifTrue( |
|
| 139 | + function ($v) { |
|
| 140 | + return array_key_exists('default', $v); |
|
| 141 | + } |
|
| 142 | + )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
| 143 | + ->end() |
|
| 144 | + ->arrayPrototype() |
|
| 145 | + ->children(); |
|
| 146 | 146 | |
| 147 | 147 | $endpoints->arrayNode('roles') |
| 148 | - ->beforeNormalization() |
|
| 149 | - ->ifString() |
|
| 150 | - ->then( |
|
| 151 | - function ($v) { |
|
| 152 | - return preg_split('/\s*,\s*/', $v); |
|
| 153 | - } |
|
| 154 | - ) |
|
| 155 | - ->end() |
|
| 156 | - ->prototype('scalar') |
|
| 157 | - ->end(); |
|
| 148 | + ->beforeNormalization() |
|
| 149 | + ->ifString() |
|
| 150 | + ->then( |
|
| 151 | + function ($v) { |
|
| 152 | + return preg_split('/\s*,\s*/', $v); |
|
| 153 | + } |
|
| 154 | + ) |
|
| 155 | + ->end() |
|
| 156 | + ->prototype('scalar') |
|
| 157 | + ->end(); |
|
| 158 | 158 | |
| 159 | 159 | $endpoints->scalarNode('host')->example('^api\.backend\.'); |
| 160 | 160 | $endpoints->scalarNode('path')->example('/backend'); |
| 161 | 161 | |
| 162 | 162 | $root->arrayNode('endpoint_alias') |
| 163 | - ->info('Use alias to refer to multiple endpoints using only one name') |
|
| 164 | - ->useAttributeAsKey('name') |
|
| 165 | - ->beforeNormalization() |
|
| 166 | - ->ifString() |
|
| 167 | - ->then( |
|
| 168 | - function ($v) { |
|
| 169 | - return preg_split('/\s*,\s*/', $v); |
|
| 170 | - } |
|
| 171 | - ) |
|
| 172 | - ->end() |
|
| 173 | - ->variablePrototype(); |
|
| 163 | + ->info('Use alias to refer to multiple endpoints using only one name') |
|
| 164 | + ->useAttributeAsKey('name') |
|
| 165 | + ->beforeNormalization() |
|
| 166 | + ->ifString() |
|
| 167 | + ->then( |
|
| 168 | + function ($v) { |
|
| 169 | + return preg_split('/\s*,\s*/', $v); |
|
| 170 | + } |
|
| 171 | + ) |
|
| 172 | + ->end() |
|
| 173 | + ->variablePrototype(); |
|
| 174 | 174 | |
| 175 | 175 | $root->scalarNode('endpoint_default')->info('Endpoint to apply to all definitions without explicit endpoint.'); |
| 176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $graphiql = $root->arrayNode('graphiql')->addDefaultsIfNotSet()->children(); |
| 182 | 182 | |
| 183 | 183 | $graphiql->scalarNode('title') |
| 184 | - ->defaultValue('GraphQL API Explorer'); |
|
| 184 | + ->defaultValue('GraphQL API Explorer'); |
|
| 185 | 185 | |
| 186 | 186 | $graphiql |
| 187 | 187 | ->scalarNode('data_warning_message') |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | ->defaultFalse(); |
| 210 | 210 | |
| 211 | 211 | $authentication->scalarNode('login_message') |
| 212 | - ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
| 212 | + ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
| 213 | 213 | |
| 214 | 214 | $authenticationProvider = $authentication->arrayNode('provider')->children(); |
| 215 | 215 | |
@@ -218,29 +218,29 @@ discard block |
||
| 218 | 218 | $jwtLogin = $jwt->arrayNode('login')->children(); |
| 219 | 219 | |
| 220 | 220 | $jwtLogin->scalarNode('url') |
| 221 | - ->info('Route name or URI to make the login process to retrieve the token.') |
|
| 222 | - ->isRequired(); |
|
| 221 | + ->info('Route name or URI to make the login process to retrieve the token.') |
|
| 222 | + ->isRequired(); |
|
| 223 | 223 | |
| 224 | 224 | $jwtLogin->scalarNode('username_parameter') |
| 225 | - ->defaultValue('username'); |
|
| 225 | + ->defaultValue('username'); |
|
| 226 | 226 | |
| 227 | 227 | $jwtLogin->scalarNode('username_label') |
| 228 | - ->defaultValue('Username'); |
|
| 228 | + ->defaultValue('Username'); |
|
| 229 | 229 | |
| 230 | 230 | $jwtLogin->scalarNode('password_parameter') |
| 231 | - ->defaultValue('password'); |
|
| 231 | + ->defaultValue('password'); |
|
| 232 | 232 | |
| 233 | 233 | $jwtLogin->scalarNode('password_label') |
| 234 | - ->defaultValue('Password'); |
|
| 234 | + ->defaultValue('Password'); |
|
| 235 | 235 | |
| 236 | 236 | $jwtLogin->enumNode('parameters_in') |
| 237 | - ->values(['form', 'query', 'header']) |
|
| 238 | - ->info('How pass parameters to request the token') |
|
| 239 | - ->defaultValue('form'); |
|
| 237 | + ->values(['form', 'query', 'header']) |
|
| 238 | + ->info('How pass parameters to request the token') |
|
| 239 | + ->defaultValue('form'); |
|
| 240 | 240 | |
| 241 | 241 | $jwtLogin->scalarNode('response_token_path') |
| 242 | - ->defaultValue('token') |
|
| 243 | - ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
| 242 | + ->defaultValue('token') |
|
| 243 | + ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
| 244 | 244 | |
| 245 | 245 | $jwtRequests = $jwt->arrayNode('requests')->addDefaultsIfNotSet()->children(); |
| 246 | 246 | |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | ->info('Customize how the token should be send, use the place holder {token} to replace for current token'); |
| 259 | 259 | |
| 260 | 260 | $authenticationProvider->scalarNode('custom') |
| 261 | - ->defaultNull() |
|
| 262 | - ->info('Configure custom service to use as authentication provider'); |
|
| 261 | + ->defaultNull() |
|
| 262 | + ->info('Configure custom service to use as authentication provider'); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | protected function configureCORS(NodeBuilder $root) |
@@ -282,25 +282,25 @@ discard block |
||
| 282 | 282 | { |
| 283 | 283 | $pagination = $root->arrayNode('pagination')->addDefaultsIfNotSet()->children(); |
| 284 | 284 | $pagination->integerNode('limit') |
| 285 | - ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
| 285 | + ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | protected function configurePluginNamespaceGlobalConfig(NodeBuilder $root) |
| 289 | 289 | { |
| 290 | 290 | $namespaces = $root->arrayNode('namespaces') |
| 291 | - ->info( |
|
| 292 | - 'Group GraphQL schema using namespaced schemas. |
|
| 291 | + ->info( |
|
| 292 | + 'Group GraphQL schema using namespaced schemas. |
|
| 293 | 293 | On large schemas is helpful to keep schemas grouped by bundle and node' |
| 294 | - ) |
|
| 295 | - ->canBeEnabled() |
|
| 296 | - ->addDefaultsIfNotSet() |
|
| 297 | - ->children(); |
|
| 294 | + ) |
|
| 295 | + ->canBeEnabled() |
|
| 296 | + ->addDefaultsIfNotSet() |
|
| 297 | + ->children(); |
|
| 298 | 298 | |
| 299 | 299 | $bundles = $namespaces->arrayNode('bundles') |
| 300 | - ->info('Group each bundle into a separate schema definition') |
|
| 301 | - ->canBeDisabled() |
|
| 302 | - ->addDefaultsIfNotSet() |
|
| 303 | - ->children(); |
|
| 300 | + ->info('Group each bundle into a separate schema definition') |
|
| 301 | + ->canBeDisabled() |
|
| 302 | + ->addDefaultsIfNotSet() |
|
| 303 | + ->children(); |
|
| 304 | 304 | |
| 305 | 305 | $bundles->scalarNode('query_suffix') |
| 306 | 306 | ->info('The following suffix will be used for bundle query groups') |
@@ -331,25 +331,25 @@ discard block |
||
| 331 | 331 | ->children(); |
| 332 | 332 | |
| 333 | 333 | $nodes->scalarNode('query_suffix') |
| 334 | - ->info('The following suffix will be used to create the name for queries to the same node') |
|
| 335 | - ->defaultValue('Query'); |
|
| 334 | + ->info('The following suffix will be used to create the name for queries to the same node') |
|
| 335 | + ->defaultValue('Query'); |
|
| 336 | 336 | |
| 337 | 337 | $nodes->scalarNode('mutation_suffix') |
| 338 | - ->info('The following suffix will be used to create the name for mutations to the same node') |
|
| 339 | - ->defaultValue('Mutation'); |
|
| 338 | + ->info('The following suffix will be used to create the name for mutations to the same node') |
|
| 339 | + ->defaultValue('Mutation'); |
|
| 340 | 340 | |
| 341 | 341 | $nodes->variableNode('ignore') |
| 342 | - ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
| 343 | - ->defaultValue(['Node']); |
|
| 342 | + ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
| 343 | + ->defaultValue(['Node']); |
|
| 344 | 344 | |
| 345 | 345 | $nodes->arrayNode('aliases') |
| 346 | - ->info( |
|
| 347 | - 'Define aliases for nodes to set definitions inside other desired node name. |
|
| 346 | + ->info( |
|
| 347 | + 'Define aliases for nodes to set definitions inside other desired node name. |
|
| 348 | 348 | Can be used to group multiple nodes or publish a node with a different group name' |
| 349 | - ) |
|
| 350 | - ->example('InvoiceItem: Invoice') |
|
| 351 | - ->useAttributeAsKey('name') |
|
| 352 | - ->prototype('scalar'); |
|
| 349 | + ) |
|
| 350 | + ->example('InvoiceItem: Invoice') |
|
| 351 | + ->useAttributeAsKey('name') |
|
| 352 | + ->prototype('scalar'); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | private function configureSecurity(NodeBuilder $rootNode) |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ->beforeNormalization() |
| 75 | 75 | ->ifString() |
| 76 | 76 | ->then( |
| 77 | - function ($v) { |
|
| 77 | + function($v) { |
|
| 78 | 78 | return [$v]; |
| 79 | 79 | } |
| 80 | 80 | ) |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | ->beforeNormalization() |
| 88 | 88 | ->ifString() |
| 89 | 89 | ->then( |
| 90 | - function ($v) { |
|
| 90 | + function($v) { |
|
| 91 | 91 | return [$v]; |
| 92 | 92 | } |
| 93 | 93 | ) |
| 94 | 94 | ->end() |
| 95 | 95 | ->validate() |
| 96 | 96 | ->ifTrue( |
| 97 | - function (array $value) { |
|
| 97 | + function(array $value) { |
|
| 98 | 98 | foreach ($value as $val) { |
| 99 | 99 | try { |
| 100 | 100 | preg_match($val, null); |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | ->beforeNormalization() |
| 112 | 112 | ->ifString() |
| 113 | 113 | ->then( |
| 114 | - function ($v) { |
|
| 114 | + function($v) { |
|
| 115 | 115 | return [$v]; |
| 116 | 116 | } |
| 117 | 117 | ) |
| 118 | 118 | ->end() |
| 119 | 119 | ->validate() |
| 120 | 120 | ->ifTrue( |
| 121 | - function (array $value) { |
|
| 121 | + function(array $value) { |
|
| 122 | 122 | foreach ($value as $val) { |
| 123 | 123 | try { |
| 124 | 124 | preg_match($val, null); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ->useAttributeAsKey('name') |
| 137 | 137 | ->validate() |
| 138 | 138 | ->ifTrue( |
| 139 | - function ($v) { |
|
| 139 | + function($v) { |
|
| 140 | 140 | return array_key_exists('default', $v); |
| 141 | 141 | } |
| 142 | 142 | )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ->beforeNormalization() |
| 149 | 149 | ->ifString() |
| 150 | 150 | ->then( |
| 151 | - function ($v) { |
|
| 151 | + function($v) { |
|
| 152 | 152 | return preg_split('/\s*,\s*/', $v); |
| 153 | 153 | } |
| 154 | 154 | ) |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ->beforeNormalization() |
| 166 | 166 | ->ifString() |
| 167 | 167 | ->then( |
| 168 | - function ($v) { |
|
| 168 | + function($v) { |
|
| 169 | 169 | return preg_split('/\s*,\s*/', $v); |
| 170 | 170 | } |
| 171 | 171 | ) |
@@ -74,14 +74,14 @@ |
||
| 74 | 74 | |
| 75 | 75 | //build the ID encoder manager with configured encoder |
| 76 | 76 | $container->getDefinition(IDEncoderManager::class) |
| 77 | - ->setPublic(true) |
|
| 78 | - ->replaceArgument(0, $container->getDefinition($config['id_encoder'])); |
|
| 77 | + ->setPublic(true) |
|
| 78 | + ->replaceArgument(0, $container->getDefinition($config['id_encoder'])); |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | //endpoint definition |
| 82 | 82 | $container->getDefinition(GraphQLEndpointController::class) |
| 83 | - ->addMethodCall('setErrorFormatter', [$container->getDefinition($config['error_handling']['formatter'])]) |
|
| 84 | - ->addMethodCall('setErrorHandler', [$container->getDefinition($config['error_handling']['handler'])]); |
|
| 83 | + ->addMethodCall('setErrorFormatter', [$container->getDefinition($config['error_handling']['formatter'])]) |
|
| 84 | + ->addMethodCall('setErrorHandler', [$container->getDefinition($config['error_handling']['handler'])]); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -46,9 +46,9 @@ |
||
| 46 | 46 | |
| 47 | 47 | $styleGuide = new TableStyle(); |
| 48 | 48 | $styleGuide->setHorizontalBorderChar('') |
| 49 | - ->setVerticalBorderChar('|') |
|
| 50 | - ->setCrossingChar(' ') |
|
| 51 | - ->setCellHeaderFormat('%s'); |
|
| 49 | + ->setVerticalBorderChar('|') |
|
| 50 | + ->setCrossingChar(' ') |
|
| 51 | + ->setCellHeaderFormat('%s'); |
|
| 52 | 52 | |
| 53 | 53 | $table->setStyle($styleGuide); |
| 54 | 54 | $table->setRows($rows); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | $table = new Table($output); |
| 37 | 37 | $table->setHeaders(['Code', 'Text', 'Description']) |
| 38 | - ->setRows($rows); |
|
| 38 | + ->setRows($rows); |
|
| 39 | 39 | $table->render(); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | protected function configure() |
| 50 | 50 | { |
| 51 | 51 | $this->setName('graphql:error:list') |
| 52 | - ->setDescription('View, export and control your API errors.') |
|
| 53 | - ->addOption('exporter', 'x', InputOption::VALUE_REQUIRED, 'Exporter to user', 'console') |
|
| 54 | - ->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'Name of the file to save the error list, e.i. error_codes.md'); |
|
| 52 | + ->setDescription('View, export and control your API errors.') |
|
| 53 | + ->addOption('exporter', 'x', InputOption::VALUE_REQUIRED, 'Exporter to user', 'console') |
|
| 54 | + ->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'Name of the file to save the error list, e.i. error_codes.md'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | */ |
| 60 | 60 | protected function execute(InputInterface $input, OutputInterface $output) |
| 61 | 61 | { |
| 62 | - $this->errorManager->clear();//force reload |
|
| 62 | + $this->errorManager->clear(); //force reload |
|
| 63 | 63 | $errors = $this->errorManager->all(); |
| 64 | 64 | |
| 65 | 65 | $result = $output; |
@@ -206,7 +206,7 @@ |
||
| 206 | 206 | |
| 207 | 207 | $result->setErrorFormatter([$formatter, 'format']); |
| 208 | 208 | $result->setErrorsHandler( |
| 209 | - function ($errors) use ($handler, $formatter, $debugFlags) { |
|
| 209 | + function($errors) use ($handler, $formatter, $debugFlags) { |
|
| 210 | 210 | return $handler->handle($errors, $formatter, $debugFlags); |
| 211 | 211 | } |
| 212 | 212 | ); |