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

MultidomainConfigurationPass::process()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 12
loc 12
rs 9.8666
c 1
b 0
f 0
cc 3
nc 2
nop 1
1
<?php
2
3
namespace Kunstmaan\MultiDomainBundle\DependencyInjection\CompilerPass;
4
5
use Kunstmaan\MultiDomainBundle\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 MultidomainConfigurationPass 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_multi_domain.domain_configuration.class') && $container->getParameter('kunstmaan_multi_domain.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_multi_domain.domain_configuration.class" parameter is deprecated since KunstmaanMultiDomainBundle 5.1 and will be removed in KunstmaanMultiDomainBundle 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_multi_domain.domain_configuration.class" parameter.
21
            $container->getDefinition('kunstmaan_multi_domain.domain_configuration')->setArguments([new Reference('service_container')]);
22
        }
23
    }
24
}
25