Passed
Push — master ( 7ba2cb...1d30f9 )
by Peter
02:20
created

UserApiKey::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Domain\Entities;
6
7
use AbterPhp\Framework\Domain\Entities\IStringerEntity;
8
9
class UserApiKey implements IStringerEntity
10
{
11
    /** @var string */
12
    protected $id;
13
14
    /** @var string */
15
    protected $userId;
16
17
    /** @var string */
18
    protected $description;
19
20
    /** @var AdminResource[] */
21
    protected $adminResources;
22
23
    /**
24
     * ApiKey constructor.
25
     *
26
     * @param string          $id
27
     * @param string          $userId
28
     * @param string          $description
29
     * @param AdminResource[] $adminResources
30
     */
31
    public function __construct(string $id, string $userId, string $description, array $adminResources = [])
32
    {
33
        $this->id             = $id;
34
        $this->userId         = $userId;
35
        $this->description    = $description;
36
        $this->adminResources = $adminResources;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getId()
43
    {
44
        return $this->id;
45
    }
46
47
    /**
48
     * @param string $id
49
     */
50
    public function setId($id)
51
    {
52
        $this->id = $id;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getUserId(): string
59
    {
60
        return $this->userId;
61
    }
62
63
    /**
64
     * @param string $userId
65
     *
66
     * @return $this
67
     */
68
    public function setUserId(string $userId): UserApiKey
69
    {
70
        $this->userId = $userId;
71
72
        return $this;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function getDescription(): string
79
    {
80
        return $this->description;
81
    }
82
83
    /**
84
     * @param string $description
85
     *
86
     * @return $this
87
     */
88
    public function setDescription(string $description): UserApiKey
89
    {
90
        $this->description = $description;
91
92
        return $this;
93
    }
94
95
    /**
96
     * @return AdminResource[]
97
     */
98
    public function getAdminResources(): array
99
    {
100
        return $this->adminResources;
101
    }
102
103
    /**
104
     * @param AdminResource[] $adminResources
105
     *
106
     * @return $this
107
     */
108
    public function setAdminResources(array $adminResources): UserApiKey
109
    {
110
        $this->adminResources = $adminResources;
111
112
        return $this;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function __toString(): string
119
    {
120
        return $this->getDescription();
121
    }
122
}
123