Passed
Push — master ( 141183...2b56eb )
by Petr
08:03
created

GroupsRecord   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 37
ccs 0
cts 30
cp 0
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupStatus() 0 3 1
A getGroupDesc() 0 3 1
A getGroupName() 0 3 1
A addEntries() 0 10 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 $status
18
 * @property int $authorId
19
 * @property UsersRecord[] $authors
20
 * @property UsersRecord[] $members
21
 * @codeCoverageIgnore remote source
22
 */
23
class GroupsRecord extends ASimpleRecord implements IGroup
24
{
25
    public function addEntries(): void
26
    {
27
        $this->addEntry('id', IEntryType::TYPE_INTEGER, 2048);
28
        $this->addEntry('name', IEntryType::TYPE_STRING, 512);
29
        $this->addEntry('desc', IEntryType::TYPE_STRING, 512);
30
        $this->addEntry('authorId', IEntryType::TYPE_INTEGER, 128);
31
        $this->addEntry('status', IEntryType::TYPE_INTEGER, 4);
32
        $this->addEntry('authors', IEntryType::TYPE_ARRAY, []);
33
        $this->addEntry('members', IEntryType::TYPE_ARRAY, []);
34
        $this->setMapper(GroupsMapper::class);
35
    }
36
37
    public function getGroupId(): int
38
    {
39
        return intval($this->id);
40
    }
41
42
    public function getGroupName(): string
43
    {
44
        return strval($this->name);
45
    }
46
47
    public function getGroupDesc(): string
48
    {
49
        return strval($this->desc);
50
    }
51
52
    public function getGroupAuthorId(): int
53
    {
54
        return intval($this->authorId);
55
    }
56
57
    public function getGroupStatus(): int
58
    {
59
        return intval($this->status);
60
    }
61
}
62