MemberResponse::__construct()   A
last analyzed

Complexity

Conditions 6
Paths 24

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 15
c 1
b 0
f 0
nc 24
nop 1
dl 0
loc 22
rs 9.2222
1
<?php
2
3
namespace AcquiaCloudApi\Response;
4
5
class MemberResponse
6
{
7
    public string $uuid;
8
9
    /**
10
     * @var TeamsResponse<TeamResponse>|null $teams
11
     */
12
    public ?TeamsResponse $teams;
13
14
    public string $first_name;
15
16
    public string $last_name;
17
18
    public ?string $mail;
19
20
    public string $picture_url;
21
22
    public string $username;
23
24
    public ?object $flags;
25
26
    public ?object $links;
27
28
    public function __construct(object $member)
29
    {
30
        $this->uuid = $member->uuid;
31
        $this->first_name = $member->first_name;
32
        $this->last_name = $member->last_name;
33
34
        if (property_exists($member, 'mail')) {
35
            $this->mail = $member->mail;
36
        } elseif (property_exists($member, 'email')) {
37
            $this->mail = $member->email;
38
        }
39
        $this->picture_url = $member->picture_url;
40
        $this->username = $member->username;
41
42
        if (property_exists($member, 'teams')) {
43
            $this->teams = new TeamsResponse($member->teams);
44
        }
45
        if (property_exists($member, 'flags')) {
46
            $this->links = $member->flags;
47
        }
48
        if (property_exists($member, '_links')) {
49
            $this->links = $member->_links;
50
        }
51
    }
52
}
53