HubSpotResourceOwner   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 101
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getHubId() 0 4 1
A getExpires() 0 4 1
A getAppId() 0 4 1
A getEmail() 0 4 1
A getId() 0 4 1
A getDomain() 0 4 1
A getScopes() 0 4 1
A toArray() 0 4 1
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 21
    public function __construct(array $response = array())
23
    {
24 21
        $this->response = $response;
25 21
    }
26
27
    /**
28
     * Get resource owner id
29
     *
30
     * @return string|null
31
     */
32 9
    public function getHubId()
33
    {
34 9
        return $this->getValueByKey($this->response, 'hub_id');
35
    }
36
37
    /**
38
     * Get resource expires
39
     *
40
     * @return int|null
41
     */
42 3
    public function getExpires()
43
    {
44 3
        return $this->getValueByKey($this->response, 'expires_in');
45
    }
46
47
    /**
48
     * Get resource owner app id
49
     *
50
     * @return int|null
51
     */
52 9
    public function getAppId()
53
    {
54 9
        return $this->getValueByKey($this->response, 'app_id');
55
    }
56
57
    /**
58
     * Get resource owner email
59
     *
60
     * @return string|null
61
     */
62 9
    public function getEmail()
63
    {
64 9
        return $this->getValueByKey($this->response, 'user');
65
    }
66
67
    /**
68
     * Get resource owner id
69
     *
70
     * @return int|null
71
     */
72 9
    public function getId()
73
    {
74 9
        return $this->getValueByKey($this->response, 'user_id');
75
    }
76
77
    /**
78
     * Get resource owner domain
79
     *
80
     * @return int|null
81
     */
82 9
    public function getDomain()
83
    {
84 9
        return $this->getValueByKey($this->response, 'hub_domain');
85
    }
86
87
    /**
88
     * Get resource owner scopes
89
     *
90
     * @return array|null
91
     */
92 3
    public function getScopes()
93
    {
94 3
        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 3
    public function toArray()
103
    {
104 3
        return $this->response;
105
    }
106
}
107