MicrosoftResourceOwner   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 14
lcom 1
cbo 0
dl 0
loc 89
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 2
A getEmail() 0 4 2
A getFirstname() 0 4 2
A getLastname() 0 4 2
A getName() 0 4 2
A getUrls() 0 4 2
A toArray() 0 4 1
1
<?php namespace Stevenmaguire\OAuth2\Client\Provider;
2
3
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
4
5
class MicrosoftResourceOwner 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 6
    public function __construct(array $response = array())
20
    {
21 6
        $this->response = $response;
22 6
    }
23
24
    /**
25
     * Get user id
26
     *
27
     * @return string|null
28
     */
29
    public function getId()
30
    {
31
        return $this->response['id'] ?: null;
32
    }
33
34
    /**
35
     * Get user email
36 6
     *
37
     * @return string|null
38 6
     */
39
    public function getEmail()
40
    {
41
        return $this->response['emails']['preferred'] ?: null;
42
    }
43
44
    /**
45
     * Get user firstname
46 6
     *
47
     * @return string|null
48 6
     */
49
    public function getFirstname()
50
    {
51
        return $this->response['first_name'] ?: null;
52
    }
53
54
    /**
55
     * Get user lastname
56 6
     *
57
     * @return string|null
58 6
     */
59
    public function getLastname()
60
    {
61
        return $this->response['last_name'] ?: null;
62
    }
63
64
    /**
65
     * Get user name
66 6
     *
67
     * @return string|null
68 6
     */
69
    public function getName()
70
    {
71
        return $this->response['name'] ?: null;
72
    }
73
74
    /**
75
     * Get user urls
76 6
     *
77
     * @return string|null
78 6
     */
79
    public function getUrls()
80 6
    {
81
        return isset($this->response['link']) ? $this->response['link'].'/cid-'.$this->getId() : null;
82
    }
83
84
    /**
85
     * Return all of the owner details available as an array.
86
     *
87
     * @return array
88 6
     */
89
    public function toArray()
90 6
    {
91
        return $this->response;
92
    }
93
}
94