Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
KeycloakResourceOwner | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEmail | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
toArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Oauth2Provider\Keycloak; |
4 | |
5 | use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
6 | |
7 | class KeycloakResourceOwner implements ResourceOwnerInterface |
8 | { |
9 | /** |
10 | * Raw response. |
11 | */ |
12 | protected array $response; |
13 | |
14 | /** |
15 | * Creates new resource owner. |
16 | */ |
17 | public function __construct(array $response = []) |
18 | { |
19 | $this->response = $response; |
20 | } |
21 | |
22 | /** |
23 | * Get resource owner id. |
24 | */ |
25 | public function getId(): ?string |
26 | { |
27 | return $this->response['sub'] ?? null; |
28 | } |
29 | |
30 | /** |
31 | * Get resource owner email. |
32 | */ |
33 | public function getEmail(): ?string |
34 | { |
35 | return $this->response['email'] ?? null; |
36 | } |
37 | |
38 | /** |
39 | * Get resource owner name. |
40 | */ |
41 | public function getName(): ?string |
42 | { |
43 | return $this->response['name'] ?? null; |
44 | } |
45 | |
46 | /** |
47 | * Return all the owner details available as an array. |
48 | */ |
49 | public function toArray(): array |
50 | { |
51 | return $this->response; |
52 | } |
53 | } |