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 | 29 | public function __construct($debug, $cacheDir = null) |
|
| 37 | |||
| 38 | 29 | public function getConfigTreeBuilder() |
|
| 39 | { |
||
| 40 | 29 | $treeBuilder = new TreeBuilder(); |
|
| 41 | 29 | $rootNode = $treeBuilder->root(self::NAME); |
|
| 42 | |||
| 43 | $rootNode |
||
| 44 | 29 | ->children() |
|
| 45 | 29 | ->append($this->batchingMethodSection()) |
|
| 46 | 29 | ->append($this->definitionsSection()) |
|
| 47 | 29 | ->append($this->errorsHandlerSection()) |
|
| 48 | 29 | ->append($this->servicesSection()) |
|
| 49 | 29 | ->append($this->securitySection()) |
|
| 50 | 29 | ->end(); |
|
| 51 | |||
| 52 | 29 | return $treeBuilder; |
|
| 53 | } |
||
| 54 | |||
| 55 | 29 | private function batchingMethodSection() |
|
| 68 | |||
| 69 | 29 | private function errorsHandlerSection() |
|
| 103 | |||
| 104 | 29 | private function definitionsSection() |
|
| 105 | { |
||
| 106 | 29 | $builder = new TreeBuilder(); |
|
| 107 | /** @var ArrayNodeDefinition $node */ |
||
| 108 | 29 | $node = $builder->root('definitions'); |
|
| 109 | $node |
||
| 110 | 29 | ->addDefaultsIfNotSet() |
|
| 111 | 29 | ->children() |
|
| 112 | 29 | ->variableNode('default_resolver')->defaultValue([Resolver::class, 'defaultResolveFn'])->end() |
|
| 113 | 29 | ->scalarNode('class_namespace')->defaultValue('Overblog\\GraphQLBundle\\__DEFINITIONS__')->end() |
|
| 114 | 29 | ->scalarNode('cache_dir')->defaultValue($this->cacheDir.'/overblog/graphql-bundle/__definitions__')->end() |
|
| 115 | 29 | ->booleanNode('use_classloader_listener')->defaultTrue()->end() |
|
| 116 | 29 | ->booleanNode('auto_compile')->defaultTrue()->end() |
|
| 117 | 29 | ->booleanNode('show_debug_info')->info('Show some performance stats in extensions')->defaultFalse()->end() |
|
| 118 | 29 | ->booleanNode('config_validation')->defaultValue($this->debug)->end() |
|
| 119 | 29 | ->append($this->definitionsSchemaSection()) |
|
| 120 | 29 | ->append($this->definitionsMappingsSection()) |
|
| 121 | 29 | ->arrayNode('builders') |
|
| 122 | 29 | ->children() |
|
| 123 | 29 | ->append($this->builderSection('field')) |
|
| 124 | 29 | ->append($this->builderSection('args')) |
|
| 125 | 29 | ->end() |
|
| 126 | 29 | ->end() |
|
| 127 | |||
| 128 | 29 | ->end() |
|
| 129 | 29 | ->end(); |
|
| 130 | |||
| 131 | 29 | return $node; |
|
| 132 | } |
||
| 133 | |||
| 134 | 29 | private function servicesSection() |
|
| 159 | |||
| 160 | 29 | private function securitySection() |
|
| 176 | |||
| 177 | 29 | private function definitionsSchemaSection() |
|
| 212 | |||
| 213 | 29 | private function definitionsMappingsSection() |
|
| 214 | { |
||
| 215 | 29 | $builder = new TreeBuilder(); |
|
| 216 | 29 | $node = $builder->root('mappings'); |
|
| 217 | $node |
||
| 218 | 29 | ->children() |
|
| 219 | 29 | ->arrayNode('auto_discover') |
|
| 220 | 29 | ->treatFalseLike(['bundles' => false, 'root_dir' => false]) |
|
| 221 | 29 | ->treatTrueLike(['bundles' => true, 'root_dir' => true]) |
|
| 222 | 29 | ->treatNullLike(['bundles' => true, 'root_dir' => true]) |
|
| 223 | 29 | ->addDefaultsIfNotSet() |
|
| 224 | 29 | ->children() |
|
| 225 | 29 | ->booleanNode('bundles')->defaultTrue()->end() |
|
| 226 | 29 | ->booleanNode('root_dir')->defaultTrue()->end() |
|
| 227 | 29 | ->end() |
|
| 228 | 29 | ->end() |
|
| 229 | 29 | ->arrayNode('types') |
|
| 230 | 29 | ->prototype('array') |
|
| 231 | 29 | ->addDefaultsIfNotSet() |
|
| 232 | 29 | ->beforeNormalization() |
|
| 233 | 29 | ->ifTrue(function ($v) { |
|
| 234 | 25 | return isset($v['type']) && is_string($v['type']); |
|
| 235 | 29 | }) |
|
| 236 | 29 | ->then(function ($v) { |
|
| 237 | 24 | if ('yml' === $v['type']) { |
|
| 238 | 7 | $v['types'] = ['yaml']; |
|
| 239 | } else { |
||
| 240 | 17 | $v['types'] = [$v['type']]; |
|
| 241 | } |
||
| 242 | 24 | unset($v['type']); |
|
| 243 | |||
| 244 | 24 | return $v; |
|
| 245 | 29 | }) |
|
| 246 | 29 | ->end() |
|
| 247 | 29 | ->children() |
|
| 248 | 29 | ->arrayNode('types') |
|
| 249 | 29 | ->prototype('enum')->values(array_keys(OverblogGraphQLTypesExtension::SUPPORTED_TYPES_EXTENSIONS))->isRequired()->end() |
|
| 250 | 29 | ->end() |
|
| 251 | 29 | ->scalarNode('dir')->defaultNull()->end() |
|
| 252 | 29 | ->scalarNode('suffix')->defaultValue(OverblogGraphQLTypesExtension::DEFAULT_TYPES_SUFFIX)->end() |
|
| 253 | 29 | ->end() |
|
| 254 | 29 | ->end() |
|
| 255 | 29 | ->end() |
|
| 256 | 29 | ->end() |
|
| 257 | ; |
||
| 258 | |||
| 259 | 29 | return $node; |
|
| 260 | } |
||
| 261 | |||
| 262 | /** |
||
| 263 | * @param string $name |
||
| 264 | * |
||
| 265 | * @return ArrayNodeDefinition |
||
| 266 | */ |
||
| 267 | 29 | private function builderSection($name) |
|
| 300 | |||
| 301 | /** |
||
| 302 | * @param string $name |
||
| 303 | * @param bool $disabledValue |
||
| 304 | * |
||
| 305 | * @return ScalarNodeDefinition |
||
| 306 | */ |
||
| 307 | 29 | private function securityQuerySection($name, $disabledValue) |
|
| 342 | } |
||
| 343 |
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: