LDAPFakeGateway::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
class LDAPFakeGateway extends LDAPGateway implements TestOnly
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
3
{
4
    public function __construct()
5
    {
6
        // do nothing
7
    }
8
9
    private static $data = [
10
        'groups' => [
11
            'CN=Users,DC=playpen,DC=local' => [
12
                ['dn' => 'CN=Group1,CN=Users,DC=playpen,DC=local'],
13
                ['dn' => 'CN=Group2,CN=Users,DC=playpen,DC=local'],
14
                ['dn' => 'CN=Group3,CN=Users,DC=playpen,DC=local'],
15
                ['dn' => 'CN=Group4,CN=Users,DC=playpen,DC=local'],
16
                ['dn' => 'CN=Group5,CN=Users,DC=playpen,DC=local']
17
            ],
18
            'CN=Others,DC=playpen,DC=local' => [
19
                ['dn' => 'CN=Group6,CN=Others,DC=playpen,DC=local'],
20
                ['dn' => 'CN=Group7,CN=Others,DC=playpen,DC=local'],
21
                ['dn' => 'CN=Group8,CN=Others,DC=playpen,DC=local']
22
            ]
23
        ],
24
        'users' => [
25
            '123' => [
26
                'distinguishedname' => 'CN=Joe,DC=playpen,DC=local',
27
                'objectguid' => '123',
28
                'cn' => 'jbloggs',
29
                'useraccountcontrol' => '1',
30
                'givenname' => 'Joe',
31
                'sn' => 'Bloggs',
32
                'mail' => '[email protected]'
33
            ]
34
        ]
35
    ];
36
37
    public function authenticate($username, $password)
38
    {
39
    }
40
41
    public function getNodes($baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [], $sort = '')
42
    {
43
    }
44
45
    public function getGroups($baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [], $sort = '')
46
    {
47
        if (isset($baseDn)) {
48
            return !empty(self::$data['groups'][$baseDn]) ? self::$data['groups'][$baseDn] : null;
49
        }
50
    }
51
52
    public function getNestedGroups($dn, $baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [])
53
    {
54
    }
55
56
    public function getGroupByGUID($guid, $baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [])
57
    {
58
    }
59
60
    public function getUsers($baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [], $sort = '')
61
    {
62
    }
63
64
    public function getUserByGUID($guid, $baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [])
65
    {
66
        return [self::$data['users'][$guid]];
67
    }
68
69
    public function update($dn, array $attributes) {
70
    }
71
72
    public function delete($dn, $recursively = false) {
73
    }
74
75
    public function move($fromDn, $toDn, $recursively = false) {
76
    }
77
78
    public function add($dn, array $attributes) {
79
    }
80
81
}
82