LdapRecord::getStatus()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
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