TradeGeckoResourceOwner::getEmail()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 0
1
<?php namespace AlexOsborn\OAuth2\Client\Provider;
2
3
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
4
5
class TradeGeckoResourceOwner implements ResourceOwnerInterface
6
{
7
    /**
8
     * Raw response
9
     *
10
     * @var array
11
     */
12
    protected $response;
13
14
    /**
15
     * Creates new resource owner.
16
     *
17
     * @param array  $response
18
     */
19
    public function __construct(array $response = array())
20
    {
21
        $this->response = $response;
22
    }
23
24
    /**
25
     * Get resource owner id
26
     *
27
     * @return string|null
28
     */
29
    public function getId()
30
    {
31
        return $this->response['user']['id'] ?: null;
32
    }
33
34
    /**
35
     * Get resource owner email
36
     *
37
     * @return string|null
38
     */
39
    public function getEmail()
40
    {
41
        return $this->response['user']['email'] ?: null;
42
    }
43
44
    /**
45
     * Get resource owner first name
46
     *
47
     * @return string|null
48
     */
49
    public function getFirstName()
50
    {
51
        return $this->response['user']['first_name'] ?: null;
52
    }
53
54
    /**
55
     * Get resource owner last name
56
     *
57
     * @return string|null
58
     */
59
    public function getLastName()
60
    {
61
        return $this->response['user']['last_name'] ?: null;
62
    }
63
64
    /**
65
     * Get resource owner location
66
     *
67
     * @return string|null
68
     */
69
    public function getLocation()
70
    {
71
        return $this->response['user']['location'] ?: null;
72
    }
73
74
    /**
75
     * Get resource owner account id
76
     *
77
     * @return string|null
78
     */
79
    public function getAccountId()
80
    {
81
        return $this->response['user']['account_id'] ?: null;
82
    }
83
84
    /**
85
     * Return all of the owner details available as an array.
86
     *
87
     * @return array
88
     */
89
    public function toArray()
90
    {
91
        return $this->response['user'];
92
    }
93
}
94