Passed
Push — master ( d309df...7ec489 )
by Petr
02:37
created

LdapRecord::getAuthId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace kalanis\kw_auth\Sources\Mapper\Ldap;
4
5
6
use kalanis\kw_auth\Interfaces\IAccessClasses;
7
use kalanis\kw_auth\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\Mapper\Ldap
15
 * @property int $id
16
 * @property string $name
17
 * @codeCoverageIgnore remote source
18
 */
19
class LdapRecord extends ASimpleRecord implements IUser
20
{
21
    public function addEntries(): void
22
    {
23
        $this->addEntry('id', IEntryType::TYPE_INTEGER, 2048);
24
        $this->addEntry('name', IEntryType::TYPE_STRING, 128);
25
        $this->setMapper('\kalanis\kw_auth\Sources\Mapper\Ldap\LdapMapper');
26
    }
27
28
    public function setData(int $authId, string $authName, int $authGroup, int $authClass, string $displayName, string $dir): void
29
    {
30
        // load data only from ldap!
31
    }
32
33
    public function getAuthId(): int
34
    {
35
        return (int) $this->id;
36
    }
37
38
    public function getAuthName(): string
39
    {
40
        return (string) $this->name;
41
    }
42
43
    public function getGroup(): int
44
    {
45
        return IUser::LOWEST_USER_ID;
46
    }
47
48
    public function getClass(): int
49
    {
50
        return IAccessClasses::CLASS_USER;
51
    }
52
53
    public function getDisplayName(): string
54
    {
55
        return (string) $this->name;
56
    }
57
58
    public function getDir(): string
59
    {
60
        return '/';
61
    }
62
}
63