KeycloakResourceOwner   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 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 59
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

5 Methods

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