Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Provider/GenericResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

namespace League\OAuth2\Client\Provider;

use League\OAuth2\Client\Tool\ArrayAccessorTrait;

/**
* Represents a generic resource owner for use with the GenericProvider.
*/
class GenericResourceOwner implements ResourceOwnerInterface
{
use ArrayAccessorTrait;

/**
* @var array
*/
Expand Down Expand Up @@ -46,9 +50,19 @@ public function __construct(array $response, $resourceOwnerId)
*/
public function getId()
{
return $this->response[$this->resourceOwnerId];
return $this->getValueByKey($this->response, $this->resourceOwnerId);
}

/**
* Gets resource owner attribute by key. The key supports dot notation.
*
* @return mixed
*/
public function getAttribute($key)
{
return $this->getValueByKey($this->response, (string) $key);
}

/**
* Returns the raw resource owner response.
*
Expand Down