Completed
Push — master ( d3182c...dc7b02 )
by
06:29
created

DoSUserExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBundleConfiguration() 0 4 1
A load() 0 7 1
B prepend() 0 46 1
1
<?php
2
3
namespace DoS\UserBundle\DependencyInjection;
4
5
use DoS\ResourceBundle\DependencyInjection\AbstractResourceExtension;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
9
10
class DoSUserExtension extends AbstractResourceExtension implements PrependExtensionInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected function getBundleConfiguration()
16
    {
17
        return new Configuration();
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function load(array $config, ContainerBuilder $container)
24
    {
25
        $config = parent::load($config, $container);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $config is correct as parent::load($config, $container) (which targets Sylius\Bundle\ResourceBu...sourceExtension::load()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
26
27
        $container->setParameter('dos.user.confirmation', $config['confirmation']);
28
        $container->setParameter('dos.user.confirmation.actived', $config['confirmation']['actived']);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function prepend(ContainerBuilder $container)
35
    {
36
        $this->processConfiguration(new Configuration(), $container->getExtensionConfig($this->getAlias()));
37
38
        $container->prependExtensionConfig('sylius_user', array(
39
            'resources' => array(
40
                'customer' => array(
41
                    'classes' => array(
42
                        'model' => 'DoS\UserBundle\Model\Customer',
43
                        'form' => array(
44
                            'default' => 'DoS\UserBundle\Form\Type\CustomerType',
45
                            'profile' => 'DoS\UserBundle\Form\Type\CustomerProfileType',
46
                        )
47
                    ),
48
                    'validation_groups' => array(
49
                        'default' => array('dos', 'sylius', 'sylius_customer_profile'),
50
                        'profile' => array('dos', 'sylius', 'sylius_customer_profile'),
51
                    )
52
                ),
53
                'user' => array(
54
                    'classes' => array(
55
                        'model' => 'DoS\UserBundle\Model\User',
56
                        'controller' => 'DoS\UserBundle\Controller\UserController',
57
                        'repository' => 'DoS\UserBundle\Doctrine\ORM\UserRepository',
58
                        'form' => array(
59
                            'default' => '\DoS\UserBundle\Form\Type\UserType',
60
                        )
61
                    ),
62
                    'validation_groups' => array(
63
                        'default' => array('dos', 'sylius'),
64
                        'registration' => array('dos', 'dos_registration', 'sylius', 'sylius_user_registration'),
65
                    )
66
                ),
67
                'user_oauth' => array(
68
                    'classes' => array(
69
                        'model' => 'DoS\UserBundle\Model\UserOAuth',
70
                    ),
71
                ),
72
            ),
73
            'validation_groups' => array(
74
                'customer_profile' => array('dos', 'sylius', 'sylius_customer_profile'),
75
                'customer_registration' => array('dos_registration', 'sylius', 'sylius_customer_profile', 'sylius_user_registration'),
76
                'user_registration' => array('dos', 'dos_registration', 'sylius', 'sylius_user_registration'),
77
            )
78
        ));
79
    }
80
}
81