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