Completed
Push — 6.0 ( 92cb73...aa2689 )
by Ruud
51:41 queued 26:19
created

DomainConfigurationPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 15
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 12 12 3

How to fix   Duplicated Code   

Duplicated Code

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
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
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
11
{
12
    public function process(ContainerBuilder $container)
13
    {
14
        if ($container->hasParameter('kunstmaan_admin.domain_configuration.class') && $container->getParameter('kunstmaan_admin.domain_configuration.class') !== DomainConfiguration::class) {
15
            @trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
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
            $container->getDefinition('kunstmaan_admin.domain_configuration')->setArguments([new Reference('service_container')]);
22
        }
23
    }
24
}
25