Completed
Pull Request — master (#23)
by
unknown
13:03
created

LinkedInResourceOwner::getEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php namespace League\OAuth2\Client\Provider;
2
3
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
4
5
/**
6
 * @property array $response
7
 * @property string $uid
8
 */
9
class LinkedInResourceOwner extends GenericResourceOwner
10
{
11
12
    use ArrayAccessorTrait;
13
14
    /**
15
     * Raw response
16
     *
17
     * @var array
18
     */
19
    protected $response;
20
21
    /**
22
     * Creates new resource owner.
23
     *
24
     * @param array  $response
25
     */
26 6
    public function __construct(array $response = array())
27
    {
28 6
        $this->response = $response;
29 6
    }
30
31
    /**
32
     * Gets resource owner attribute by key. The key supports dot notation.
33
     *
34
     * @return mixed
35
     */
36 6
    public function getAttribute($key)
37
    {
38 6
        return $this->getValueByKey($this->response, (string) $key);
39
    }
40
41
42
    /**
43
     * Get user firstname
44
     *
45
     * @return string|null
46 6
     */
47
    public function getFirstName()
48 6
    {
49
        return $this->getAttribute('firstName');
50
    }
51
52
    /**
53
     * Get user imageurl
54
     *
55
     * @return string|null
56 6
     */
57
    public function getImageurl()
58 6
    {
59
        return $this->getAttribute('profilePicture');
60
    }
61
62
    /**
63
     * Get user lastname
64
     *
65
     * @return string|null
66 6
     */
67
    public function getLastName()
68 6
    {
69
        return $this->getAttribute('lastName');
70
    }
71
72
    /**
73
     * Get user userId
74
     *
75
     * @return string|null
76 6
     */
77
    public function getId()
78 6
    {
79
        return $this->getAttribute('id');
80
    }
81
82
83
    /**
84
     * Return all of the owner details available as an array.
85
     *
86 6
     * @return array
87
     */
88 6
    public function toArray()
89
    {
90
        return $this->response;
91
    }
92
}
93