Completed
Push — master ( 1b8af2...ebc2d6 )
by Nate
02:16
created

HubSpotResourceOwner::getAppId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace Flipbox\OAuth2\Client\Provider;
2
3
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
4
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
5
6
class HubSpotResourceOwner implements ResourceOwnerInterface
7
{
8
    use ArrayAccessorTrait;
9
10
    /**
11
     * Raw response
12
     *
13
     * @var array
14
     */
15
    protected $response;
16
17
    /**
18
     * Creates new resource owner.
19
     *
20
     * @param array  $response
21
     */
22
    public function __construct(array $response = array())
23
    {
24
        $this->response = $response;
25
    }
26
27
    /**
28
     * Get resource owner id
29
     *
30
     * @return string|null
31
     */
32
    public function getHubId()
33
    {
34
        return $this->getValueByKey($this->response, 'hub_id');
35
    }
36
37
    /**
38
     * Get resource expires
39
     *
40
     * @return int|null
41
     */
42
    public function getExpires()
43
    {
44
        return $this->getValueByKey($this->response, 'expires_in');
45
    }
46
47
    /**
48
     * Get resource owner app id
49
     *
50
     * @return int|null
51
     */
52
    public function getAppId()
53
    {
54
        return $this->getValueByKey($this->response, 'app_id');
55
    }
56
57
    /**
58
     * Get resource owner email
59
     *
60
     * @return string|null
61
     */
62
    public function getEmail()
63
    {
64
        return $this->getValueByKey($this->response, 'user');
65
    }
66
67
    /**
68
     * Get resource owner id
69
     *
70
     * @return int|null
71
     */
72
    public function getId()
73
    {
74
        return $this->getValueByKey($this->response, 'user_id');
75
    }
76
77
    /**
78
     * Get resource owner domain
79
     *
80
     * @return int|null
81
     */
82
    public function getDomain()
83
    {
84
        return $this->getValueByKey($this->response, 'hub_domain');
85
    }
86
87
    /**
88
     * Get resource owner scopes
89
     *
90
     * @return array|null
91
     */
92
    public function getScopes()
93
    {
94
        return $this->getValueByKey($this->response, 'scopes');
95
    }
96
97
    /**
98
     * Return all of the owner details available as an array.
99
     *
100
     * @return array
101
     */
102
    public function toArray()
103
    {
104
        return $this->response;
105
    }
106
107
}
108