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

GroupsRecord   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 31
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupDesc() 0 3 1
A getGroupName() 0 3 1
A addEntries() 0 9 1
A getGroupAuthorId() 0 3 1
A getGroupId() 0 3 1
1
<?php
2
3
namespace kalanis\kw_auth\Sources\Mapper\Database;
4
5
6
use kalanis\kw_auth\Interfaces\IGroup;
7
use kalanis\kw_mapper\Interfaces\IEntryType;
8
use kalanis\kw_mapper\Records\ASimpleRecord;
9
10
11
/**
12
 * Class GroupsRecord
13
 * @package kalanis\kw_auth\Sources\Mapper\Database
14
 * @property int $id
15
 * @property string $name
16
 * @property string $desc
17
 * @property int $authorId
18
 * @property UsersRecord[] $authors
19
 * @property UsersRecord[] $members
20
 * @codeCoverageIgnore remote source
21
 */
22
class GroupsRecord extends ASimpleRecord implements IGroup
23
{
24
    public function addEntries(): void
25
    {
26
        $this->addEntry('id', IEntryType::TYPE_INTEGER, 2048);
27
        $this->addEntry('name', IEntryType::TYPE_STRING, 512);
28
        $this->addEntry('desc', IEntryType::TYPE_STRING, 512);
29
        $this->addEntry('authorId', IEntryType::TYPE_INTEGER, 128);
30
        $this->addEntry('authors', IEntryType::TYPE_ARRAY, []);
31
        $this->addEntry('members', IEntryType::TYPE_ARRAY, []);
32
        $this->setMapper('\kalanis\kw_auth\Sources\Mapper\Database\UsersMapper');
33
    }
34
35
    public function getGroupId(): int
36
    {
37
        return intval($this->id);
38
    }
39
40
    public function getGroupName(): string
41
    {
42
        return strval($this->name);
43
    }
44
45
    public function getGroupDesc(): string
46
    {
47
        return strval($this->desc);
48
    }
49
50
    public function getGroupAuthorId(): int
51
    {
52
        return intval($this->authorId);
53
    }
54
}
55