LdapRecord   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 21.74%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 52
ccs 5
cts 23
cp 0.2174
rs 10
c 1
b 0
f 0
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtra() 0 3 1
A addEntries() 0 5 1
A getDir() 0 3 1
A getStatus() 0 3 1
A getAuthId() 0 3 1
A setUserData() 0 2 1
A getClass() 0 3 1
A getDisplayName() 0 3 1
A getGroup() 0 3 1
A getAuthName() 0 3 1
1
<?php
2
3
namespace kalanis\kw_auth_sources\Sources\Mapper\Ldap;
4
5
6
use kalanis\kw_accounts\Interfaces\IProcessClasses;
7
use kalanis\kw_accounts\Interfaces\IUser;
8
use kalanis\kw_mapper\Interfaces\IEntryType;
9
use kalanis\kw_mapper\Records\ASimpleRecord;
10
11
12
/**
13
 * Class LdapRecord
14
 * @package kalanis\kw_auth_sources\Sources\Mapper\Ldap
15
 * @property int $id
16
 * @property string $name
17
 * @codeCoverageIgnore remote source
18
 * Mainly seen as example, not working thing due necessity of knowing LDAP data structure
19
 */
20
class LdapRecord extends ASimpleRecord implements IUser
21
{
22 1
    public function addEntries(): void
23
    {
24 1
        $this->addEntry('id', IEntryType::TYPE_INTEGER, 2048);
25 1
        $this->addEntry('name', IEntryType::TYPE_STRING, 128);
26 1
        $this->setMapper(LdapMapper::class);
27 1
    }
28
29
    public function setUserData(?string $authId, ?string $authName, ?string $authGroup, ?int $authClass, ?int $authStatus, ?string $displayName, ?string $dir, ?array $extra = []): void
30
    {
31
        // load data only from ldap!
32
    }
33
34
    public function getAuthId(): string
35
    {
36
        return strval($this->id);
37
    }
38
39
    public function getAuthName(): string
40
    {
41
        return strval($this->name);
42
    }
43
44
    public function getGroup(): string
45
    {
46
        return IUser::LOWEST_USER_ID;
47
    }
48
49
    public function getClass(): int
50
    {
51
        return IProcessClasses::CLASS_USER;
52
    }
53
54
    public function getStatus(): int
55
    {
56
        return static::USER_STATUS_ONLY_LOGIN;
57
    }
58
59
    public function getDisplayName(): string
60
    {
61
        return strval($this->name);
62
    }
63
64
    public function getDir(): string
65
    {
66
        return '/';
67
    }
68
69
    public function getExtra(): array
70
    {
71
        return [];
72
    }
73
}
74