Completed
Pull Request — master (#2737)
by
unknown
11:30
created

UseFosUserOptionCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
3
namespace Kunstmaan\AdminBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
class UseFosUserOptionCompilerPass implements CompilerPassInterface
9
{
10
    public function process(ContainerBuilder $container)
11
    {
12
        $enableCustomLogin = $container->getParameter('kunstmaan_admin.enable_new_cms_authentication');
13
        if (!$enableCustomLogin) {
14
            @trigger_error('Using FosUserBundle routing and services is deprecated since KunstmaanAdminBundle 5.8 and will be removed in KunstmaanAdminBundle 6.0. Use our custom implementation instead', E_USER_DEPRECATED);
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...
15
            $container->setParameter('kunstmaan_admin.user_class', $container->getParameter('fos_user.model.user.class'));
16
            $container->setParameter('kunstmaan_admin.group_class', $container->getParameter('fos_user.model.group.class'));
17
            $container->setDefinition('kunstmaan_admin.user_manager', $container->getDefinition('fos_user.user_manager.default'));
18
            $container->setDefinition('kunstmaan_admin.group_manager', $container->getDefinition('fos_user.group_manager.default'));
19
        }
20
    }
21
}
22