User::isExternalCollaborator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace CloudPlayDev\ConfluenceClient\Entity;
4
5
use Webmozart\Assert\Assert;
6
7
class User implements Hydratable
8
{
9
10
    private string $type = 'unknown';
11
    private string $accountId;
12
    private string $accountType;
13
    private string $email;
14
    private string $publicName;
15
    private UserPicture $profilePicture;
16
    private string $displayName;
17
    private bool $isExternalCollaborator;
18
19
    public static function load(array $data): User
20
    {
21
        $user = new self;
22
        Assert::string($data['type']);
23
        Assert::string($data['accountId']);
24
        Assert::string($data['accountType']);
25
        Assert::string($data['email']);
26
        Assert::string($data['publicName']);
27
        Assert::string($data['displayName']);
28
        Assert::boolean($data['isExternalCollaborator']);
29
        Assert::isArray($data['profilePicture']);
30
31
        $user->setType($data['type']);
32
        $user->setAccountId($data['accountId']);
33
        $user->setAccountType($data['accountType']);
34
        $user->setEmail($data['email']);
35
        $user->setPublicName($data['publicName']);
36
        $user->setDisplayName($data['displayName']);
37
        $user->setIsExternalCollaborator($data['isExternalCollaborator']);
38
39
        $user->setProfilePicture(UserPicture::load($data['profilePicture']));
40
41
        return $user;
42
    }
43
44
    public function getType(): string
45
    {
46
        return $this->type;
47
    }
48
49
    public function setType(string $type): User
50
    {
51
        $this->type = $type;
52
        return $this;
53
    }
54
55
    public function getAccountId(): string
56
    {
57
        return $this->accountId;
58
    }
59
60
    public function setAccountId(string $accountId): User
61
    {
62
        $this->accountId = $accountId;
63
        return $this;
64
    }
65
66
    public function getAccountType(): string
67
    {
68
        return $this->accountType;
69
    }
70
71
    public function setAccountType(string $accountType): User
72
    {
73
        $this->accountType = $accountType;
74
        return $this;
75
    }
76
77
    public function getEmail(): string
78
    {
79
        return $this->email;
80
    }
81
82
    public function setEmail(string $email): User
83
    {
84
        $this->email = $email;
85
        return $this;
86
    }
87
88
    public function getPublicName(): string
89
    {
90
        return $this->publicName;
91
    }
92
93
    public function setPublicName(string $publicName): User
94
    {
95
        $this->publicName = $publicName;
96
        return $this;
97
    }
98
99
    public function getProfilePicture(): UserPicture
100
    {
101
        return $this->profilePicture;
102
    }
103
104
    public function setProfilePicture(UserPicture $profilePicture): User
105
    {
106
        $this->profilePicture = $profilePicture;
107
        return $this;
108
    }
109
110
    public function getDisplayName(): string
111
    {
112
        return $this->displayName;
113
    }
114
115
    public function setDisplayName(string $displayName): User
116
    {
117
        $this->displayName = $displayName;
118
        return $this;
119
    }
120
121
    public function isExternalCollaborator(): bool
122
    {
123
        return $this->isExternalCollaborator;
124
    }
125
126
    public function setIsExternalCollaborator(bool $isExternalCollaborator): User
127
    {
128
        $this->isExternalCollaborator = $isExternalCollaborator;
129
        return $this;
130
    }
131
132
133
134
135
136
}
137