ThirdPartyUser   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 96
rs 10
ccs 23
cts 23
cp 1
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A avatar() 0 3 1
A id() 0 3 1
A gender() 0 3 1
A name() 0 3 1
A toArray() 0 8 1
A email() 0 3 1
A __construct() 0 7 1
1
<?php
2
/**
3
 * @author Tharanga Kothalawala <[email protected]>
4
 * @date 30-12-2018
5
 */
6
7
namespace TSK\SSO\ThirdParty;
8
9
/**
10
 * @internal
11
 * @package TSK\SSO\ThirdParty
12
 *
13
 * This value object represents a third party user with their basic user data.
14
 * This object is only created within the library and is readonly.
15
 */
16
class ThirdPartyUser
17
{
18
    const ID = 'id';
19
20
    /**
21
     * @var string
22
     */
23
    private $id;
24
25
    /**
26
     * @var string
27
     */
28
    private $name;
29
30
    /**
31
     * @var string
32
     */
33
    private $email;
34
35
    /**
36
     * @var string
37
     */
38
    private $avatar;
39
40
    /**
41
     * @var string
42
     */
43
    private $gender;
44
45
    /**
46
     * @param string $id vendor unique identifier
47
     * @param string $name user's name within the vendor platform
48
     * @param string $email user's email within the vendor platform
49
     * @param string $avatar [optional] user's profile picture within the vendor platform if any provided
50
     * @param string $gender [optional] user's gender within the vendor platform if any provided
51
     */
52 9
    public function __construct($id, $name, $email, $avatar = '', $gender = '')
53
    {
54 9
        $this->id = $id;
55 9
        $this->name = $name;
56 9
        $this->email = $email;
57 9
        $this->avatar = $avatar;
58 9
        $this->gender = $gender;
59 9
    }
60
61
    /**
62
     * @return string
63
     */
64 2
    public function id()
65
    {
66 2
        return $this->id;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 2
    public function name()
73
    {
74 2
        return $this->name;
75
    }
76
77
    /**
78
     * @return string
79
     */
80 9
    public function email()
81
    {
82 9
        return $this->email;
83
    }
84
85
    /**
86
     * @return string
87
     */
88 2
    public function avatar()
89
    {
90 2
        return $this->avatar;
91
    }
92
93
    /**
94
     * @return string
95
     */
96 2
    public function gender()
97
    {
98 2
        return $this->gender;
99
    }
100
101
    /**
102
     * @return array
103
     */
104 1
    public function toArray()
105
    {
106
        return array(
107 1
            self::ID => $this->id(),
108 1
            'name' => $this->name(),
109 1
            'email' => $this->email(),
110 1
            'avatar' => $this->avatar(),
111 1
            'gender' => $this->gender(),
112 1
        );
113
    }
114
}
115