These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminBundle\DependencyInjection\Compiler; |
||
4 | |||
5 | use Kunstmaan\AdminBundle\Helper\DomainConfiguration; |
||
6 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
||
7 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
8 | use Symfony\Component\DependencyInjection\Reference; |
||
9 | |||
10 | View Code Duplication | class DomainConfigurationPass implements CompilerPassInterface |
|
0 ignored issues
–
show
|
|||
11 | { |
||
12 | 3 | public function process(ContainerBuilder $container) |
|
13 | { |
||
14 | 3 | if ($container->hasParameter('kunstmaan_admin.domain_configuration.class') && $container->getParameter('kunstmaan_admin.domain_configuration.class') !== DomainConfiguration::class) { |
|
15 | @trigger_error( |
||
16 | 'Overriding the domain configuration class by setting the "kunstmaan_admin.domain_configuration.class" parameter is deprecated since KunstmaanAdminDomainBundle 5.1 and will be removed in KunstmaanAdminDomainBundle 6.0. Register your custom configuration class as a service and override the "kunstmaan_admin.domain_configuration" service alias.', |
||
17 | E_USER_DEPRECATED |
||
18 | ); |
||
19 | |||
20 | // Inject the container back, to keep BC, if the user override the domain configuration with the "kunstmaan_admin.domain_configuration.class" parameter. |
||
21 | if ($container->hasDefinition('kunstmaan_admin.domain_configuration')) { |
||
22 | $container->getDefinition('kunstmaan_admin.domain_configuration')->setArguments([new Reference('service_container')]); |
||
23 | } |
||
24 | } |
||
25 | 3 | } |
|
26 | } |
||
27 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.