We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 16 | class Configuration implements ConfigurationInterface |
||
| 17 | { |
||
| 18 | const NAME = 'overblog_graphql'; |
||
| 19 | |||
| 20 | /** bool */ |
||
| 21 | private $debug; |
||
| 22 | |||
| 23 | /** null|string */ |
||
| 24 | private $cacheDir; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Constructor. |
||
| 28 | * |
||
| 29 | * @param bool $debug Whether to use the debug mode |
||
| 30 | * @param null|string $cacheDir |
||
| 31 | */ |
||
| 32 | public function __construct($debug, $cacheDir = null) |
||
| 33 | { |
||
| 34 | 33 | $this->debug = (bool) $debug; |
|
| 35 | $this->cacheDir = $cacheDir; |
||
| 36 | 33 | } |
|
| 37 | 33 | ||
| 38 | 33 | public function getConfigTreeBuilder() |
|
| 54 | 33 | ||
| 55 | private function batchingMethodSection() |
||
| 56 | { |
||
| 57 | 33 | $builder = new TreeBuilder(); |
|
| 58 | /** @var EnumNodeDefinition $node */ |
||
| 59 | 33 | $node = $builder->root('batching_method', 'enum'); |
|
| 60 | |||
| 61 | 33 | $node |
|
|
|
|||
| 62 | ->values(['relay', 'apollo']) |
||
| 63 | ->defaultValue('relay') |
||
| 64 | 33 | ->end(); |
|
| 65 | 33 | ||
| 66 | 33 | return $node; |
|
| 67 | } |
||
| 68 | 33 | ||
| 69 | private function errorsHandlerSection() |
||
| 70 | { |
||
| 71 | 33 | $builder = new TreeBuilder(); |
|
| 72 | /** @var ArrayNodeDefinition $node */ |
||
| 73 | 33 | $node = $builder->root('errors_handler'); |
|
| 74 | $node |
||
| 75 | 33 | ->treatFalseLike(['enabled' => false]) |
|
| 76 | ->treatTrueLike(['enabled' => true]) |
||
| 77 | 33 | ->treatNullLike(['enabled' => true]) |
|
| 78 | 33 | ->addDefaultsIfNotSet() |
|
| 79 | 33 | ->children() |
|
| 80 | 33 | ->booleanNode('enabled')->defaultTrue()->end() |
|
| 81 | 33 | ->scalarNode('internal_error_message')->defaultValue(ErrorHandler::DEFAULT_ERROR_MESSAGE)->end() |
|
| 82 | 33 | ->booleanNode('rethrow_internal_exceptions')->defaultFalse()->end() |
|
| 83 | 33 | ->booleanNode('debug')->defaultValue($this->debug)->end() |
|
| 84 | 33 | ->booleanNode('log')->defaultTrue()->end() |
|
| 85 | 33 | ->scalarNode('logger_service')->defaultValue(ErrorLoggerListener::DEFAULT_LOGGER_SERVICE)->end() |
|
| 86 | 33 | ->booleanNode('map_exceptions_to_parent')->defaultFalse()->end() |
|
| 87 | 33 | ->arrayNode('exceptions') |
|
| 88 | 33 | ->addDefaultsIfNotSet() |
|
| 89 | 33 | ->children() |
|
| 90 | 33 | ->arrayNode('warnings') |
|
| 91 | 33 | ->treatNullLike([]) |
|
| 92 | 33 | ->prototype('scalar')->end() |
|
| 93 | 33 | ->end() |
|
| 94 | 33 | ->arrayNode('errors') |
|
| 95 | 33 | ->treatNullLike([]) |
|
| 96 | 33 | ->prototype('scalar')->end() |
|
| 97 | 33 | ->end() |
|
| 98 | 33 | ->end() |
|
| 99 | 33 | ->end(); |
|
| 100 | 33 | ||
| 101 | 33 | return $node; |
|
| 102 | } |
||
| 103 | 33 | ||
| 104 | private function definitionsSection() |
||
| 105 | { |
||
| 106 | 33 | $builder = new TreeBuilder(); |
|
| 107 | /** @var ArrayNodeDefinition $node */ |
||
| 108 | 33 | $node = $builder->root('definitions'); |
|
| 109 | $node |
||
| 110 | 33 | ->addDefaultsIfNotSet() |
|
| 111 | ->children() |
||
| 112 | 33 | ->variableNode('default_resolver')->defaultValue([Resolver::class, 'defaultResolveFn'])->end() |
|
| 113 | 33 | ->scalarNode('class_namespace')->defaultValue('Overblog\\GraphQLBundle\\__DEFINITIONS__')->end() |
|
| 114 | 33 | ->scalarNode('cache_dir')->defaultNull()->end() |
|
| 115 | 33 | ->booleanNode('use_classloader_listener')->defaultTrue()->end() |
|
| 116 | 33 | ->booleanNode('auto_compile')->defaultTrue()->end() |
|
| 117 | 33 | ->booleanNode('show_debug_info')->info('Show some performance stats in extensions')->defaultFalse()->end() |
|
| 118 | 33 | ->booleanNode('config_validation')->defaultValue($this->debug)->end() |
|
| 119 | 33 | ->append($this->definitionsSchemaSection()) |
|
| 120 | 33 | ->append($this->definitionsAutoMappingSection()) |
|
| 121 | 33 | ->append($this->definitionsMappingsSection()) |
|
| 122 | 33 | ->arrayNode('builders') |
|
| 123 | 33 | ->children() |
|
| 124 | 33 | ->append($this->builderSection('field')) |
|
| 125 | 33 | ->append($this->builderSection('args')) |
|
| 126 | 33 | ->end() |
|
| 127 | 33 | ->end() |
|
| 128 | 33 | ||
| 129 | ->end() |
||
| 130 | 33 | ->end(); |
|
| 131 | 33 | ||
| 132 | return $node; |
||
| 133 | 33 | } |
|
| 134 | |||
| 135 | private function servicesSection() |
||
| 158 | |||
| 159 | private function securitySection() |
||
| 176 | |||
| 177 | private function definitionsSchemaSection() |
||
| 212 | |||
| 213 | private function definitionsAutoMappingSection() |
||
| 214 | 33 | { |
|
| 215 | $builder = new TreeBuilder(); |
||
| 216 | 33 | /** @var ArrayNodeDefinition $node */ |
|
| 234 | |||
| 235 | 29 | private function definitionsMappingsSection() |
|
| 283 | |||
| 284 | /** |
||
| 285 | * @param string $name |
||
| 286 | * |
||
| 287 | 1 | * @return ArrayNodeDefinition |
|
| 288 | 33 | */ |
|
| 289 | 33 | private function builderSection($name) |
|
| 322 | |||
| 323 | 33 | /** |
|
| 324 | 33 | * @param string $name |
|
| 325 | * @param bool $disabledValue |
||
| 326 | 31 | * |
|
| 327 | 33 | * @return ScalarNodeDefinition |
|
| 328 | */ |
||
| 329 | 31 | private function securityQuerySection($name, $disabledValue) |
|
| 364 | } |
||
| 365 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: