We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
20 | class OverblogGraphQLExtension extends Extension implements PrependExtensionInterface |
||
21 | { |
||
22 | 45 | public function load(array $configs, ContainerBuilder $container) |
|
40 | |||
41 | 45 | public function prepend(ContainerBuilder $container) |
|
52 | |||
53 | 45 | private function setSecurity(array $config, ContainerBuilder $container) |
|
54 | { |
||
55 | 45 | View Code Duplication | if (isset($config['security']['query_max_depth'])) { |
56 | $container |
||
57 | 45 | ->getDefinition($this->getAlias().'.request_validator_rule_query_depth') |
|
58 | 45 | ->addMethodCall('setMaxQueryDepth', [$config['security']['query_max_depth']]) |
|
59 | 45 | ->setPublic(true) |
|
60 | ; |
||
61 | 45 | } |
|
62 | |||
63 | 45 | View Code Duplication | if (isset($config['security']['query_max_complexity'])) { |
64 | $container |
||
65 | 45 | ->getDefinition($this->getAlias().'.request_validator_rule_query_complexity') |
|
66 | 45 | ->addMethodCall('setMaxQueryComplexity', [$config['security']['query_max_complexity']]) |
|
67 | 45 | ->setPublic(true) |
|
68 | ; |
||
69 | 45 | } |
|
70 | 45 | } |
|
71 | |||
72 | 45 | private function setGraphiQLTemplate(array $config, ContainerBuilder $container) |
|
73 | { |
||
74 | 45 | if (isset($config['templates']['graphiql'])) { |
|
75 | 45 | $container->setParameter('overblog_graphql.graphiql_template', $config['templates']['graphiql']); |
|
76 | 45 | } |
|
77 | 45 | } |
|
78 | |||
79 | 45 | private function setErrorHandlerArguments(array $config, ContainerBuilder $container) |
|
80 | { |
||
81 | 45 | View Code Duplication | if (isset($config['definitions']['internal_error_message'])) { |
82 | $container |
||
83 | ->getDefinition($this->getAlias().'.error_handler') |
||
84 | ->replaceArgument(0, $config['definitions']['internal_error_message']) |
||
85 | ->setPublic(true) |
||
86 | ; |
||
87 | } |
||
88 | 45 | } |
|
89 | |||
90 | 45 | private function setSchemaBuilderArguments(array $config, ContainerBuilder $container) |
|
95 | |||
96 | 45 | private function setSchemaArguments(array $config, ContainerBuilder $container) |
|
108 | |||
109 | 45 | private function setServicesAliases(array $config, ContainerBuilder $container) |
|
110 | { |
||
118 | |||
119 | 45 | public function getAlias() |
|
123 | |||
124 | 45 | public function getConfiguration(array $config, ContainerBuilder $container) |
|
128 | } |
||
129 |