oauth2-trackmania/src/Provider/TrackManiaProviderOwner.php

57 lines
1.1 KiB
PHP

<?php
namespace Beu\TrackMania\OAuth2\Client\Provider;
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
class TrackManiaProviderOwner implements ResourceOwnerInterface
{
use ArrayAccessorTrait;
/**
* Raw response
*
* @var array
*/
protected $response;
/**
* @param array $response
*/
public function __construct(array $response)
{
$this->response = $response;
}
/**
* Returns the Account Id of the player
*
* @return string
*/
public function getId()
{
return $this->getValueByKey($this->response, 'accountId');
}
/**
* Returns the Nickname of the Player
*
* @return string
*/
public function getDisplayName()
{
return $this->getValueByKey($this->response, 'displayName');
}
/**
* Return all of the owner details available as an array.
*
* @return array
*/
public function toArray()
{
return $this->response;
}
}