ConfigurationTrait::getDefaultConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
namespace DoL\LdapBundle\Tests\DependencyInjection;
4
5
/**
6
 * Provides default configuration options for the bundle and each section.
7
 *
8
 * @author DarwinOnLine
9
 * @author Maks3w
10
 *
11
 * @see https://github.com/DarwinOnLine/DoLLdapBundle
12
 */
13
trait ConfigurationTrait
14
{
15
    /**
16
     * Returns default configuration bundle configuration.
17
     *
18
     * @return array
19
     */
20
    protected function getDefaultConfig()
21
    {
22
        return [
23
            'domains' => [
24
                'server1' => [
25
                    'driver' => $this->getDefaultDriverConfig(),
26
                    'user' => $this->getDefaultUserConfig(),
27
                ],
28
            ],
29
            'service' => $this->getDefaultServiceConfig(),
30
        ];
31
    }
32
33
    /**
34
     * Returns default configuration for Driver subtree.
35
     *
36
     * Same as service parameter `dol_ldap.ldap_driver.parameters`
37
     *
38
     * @return array
39
     */
40
    protected function getDefaultDriverConfig()
41
    {
42
        return [
43
            'host' => 'ldap.hostname.local',
44
            'port' => 389,
45
            'useSsl' => false,
46
            'useStartTls' => false,
47
            'baseDn' => 'ou=Persons,dc=example,dc=com',
48
            'accountFilterFormat' => '',
49
            'bindRequiresDn' => false,
50
        ];
51
    }
52
53
    /**
54
     * Returns default configuration for User subtree.
55
     *
56
     * Same as service parameter `dol_ldap.ldap_manager.parameters`
57
     *
58
     * @return array
59
     */
60
    protected function getDefaultUserConfig()
61
    {
62
        return [
63
            'baseDn' => 'ou=Persons,dc=example,dc=com',
64
            'filter' => '',
65
            'usernameAttribute' => 'uid',
66
            'attributes' => [
67
                [
68
                    'ldap_attr' => 'uid',
69
                    'user_method' => 'setUsername',
70
                ],
71
            ],
72
        ];
73
    }
74
75
    /**
76
     * Returns default configuration for Service subtree.
77
     *
78
     * @return array
79
     */
80
    protected function getDefaultServiceConfig()
81
    {
82
        return [
83
            'user_hydrator' => 'dol_ldap.user_hydrator.default',
84
            'ldap_manager' => 'dol_ldap.ldap_manager.default',
85
            'ldap_driver' => 'dol_ldap.ldap_driver.zend',
86
        ];
87
    }
88
}
89