<?php
namespace App\Model;
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
use League\OAuth2\Client\Token\AccessTokenInterface;
class NamecheapUser implements ResourceOwnerInterface
{
private array $resource;
private AccessTokenInterface $accessToken;
public function __construct(array $resource, AccessTokenInterface $accessToken)
{
$this->resource = $resource;
$this->accessToken = $accessToken;
}
public function getId(): int
{
return $this->resource['sub'];
}
public function getName(): string
{
return $this->resource['name'];
}
public function getNickname(): string
{
return $this->resource['nickname'];
}
public function getGivenName(): string
{
return $this->resource['given_name'];
}
public function getFamilyName(): string
{
return $this->resource['family_name'];
}
public function getEmail(): string
{
return $this->resource['email'];
}
public function toArray(): array
{
return $this->resource;
}
public function getAccessToken(): AccessTokenInterface
{
return $this->accessToken;
}
}