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

DoSUserExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 0
loc 7
rs 9.4286
cc 1
eloc 4
nc 1
nop 2
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