xRELResourceOwner   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 8
c 2
b 1
f 0
lcom 1
cbo 0
dl 0
loc 59
ccs 11
cts 11
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 2
A toArray() 0 4 1
A getName() 0 4 2
A getAvatarUrl() 0 4 2
1
<?php
2
3
namespace xREL\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
7
class xRELResourceOwner implements ResourceOwnerInterface
8
{
9
    /**
10
     * Raw response.
11
     *
12
     * @var
13
     */
14
    protected $response;
15
16
    /**
17
     * Creates new resource owner.
18
     *
19
     * @param $response
20
     */
21 3
    public function __construct($response)
22
    {
23 3
        $this->response = $response;
24 3
    }
25
26
    /**
27
     * Get resource owner id.
28
     *
29
     * @return string|null
30
     */
31 3
    public function getId()
32
    {
33 3
        return $this->response['id'] ?: null;
34
    }
35
36
    /**
37
     * Return all of the owner details available as an array.
38
     *
39
     * @return array
40
     */
41 3
    public function toArray()
42
    {
43 3
        return $this->response;
44
    }
45
46
    /**
47
     * Get resource owner name.
48
     *
49
     * @return string|null
50
     */
51 3
    public function getName()
52
    {
53 3
        return $this->response['name'] ?: null;
54
    }
55
56
    /**
57
     * Get resource owner avatar url.
58
     *
59
     * @return string|null
60
     */
61 3
    public function getAvatarUrl()
62
    {
63 3
        return $this->response['avatar_url'] ?: null;
64
    }
65
}
66