Completed
Push — master ( 7a69a3...3ac73a )
by Irsad
27:18 queued 12:21
created

KeycloakResourceOwner::getUsername()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace IrsadArief\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
    public function __construct(array $response = array())
17
    {
18
        $this->response = $response;
19
    }
20
21
    public function getId()
22
    {
23
        return $this->response['sub'] ?: null;
24
    }
25
26
    public function getEmail()
27
    {
28
        return $this->response['preferred_username']."@bps.go.id" ?: null;
29
    }
30
31
    public function getName()
32
    {
33
        return $this->response['name'] ?: null;
34
    }
35
36
    public function getNip()
37
    {
38
        return $this->response['nip'] ?: null;
39
    }
40
41
    public function getUsername()
42
    {
43
        return $this->response['preferred_username'] ?: null;
44
    }
45
46
    public function getnamaDepan()
47
    {
48
        return $this->response['given_name'] ?: null;
49
    }
50
51
    public function getNamaBelakang()
52
    {
53
        return $this->response['family_name'] ?: null;
54
    }
55
    public function toArray()
56
    {
57
        return $this->response;
58
    }
59
}
60