49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Pshowsso\Scope68f5e85e9608b\Smolblog\OAuth2\Client\Provider;
|
|
|
|
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\ResourceOwnerInterface;
|
|
class TwitterUser implements ResourceOwnerInterface
|
|
{
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $response;
|
|
/**
|
|
* @param array $response
|
|
*/
|
|
public function __construct(array $response)
|
|
{
|
|
$this->response = $response['data'] ?? [];
|
|
}
|
|
public function getId()
|
|
{
|
|
return $this->response['id'];
|
|
}
|
|
public function getName()
|
|
{
|
|
return $this->response['name'];
|
|
}
|
|
public function getUsername()
|
|
{
|
|
return $this->response['username'];
|
|
}
|
|
public function getImageUrl()
|
|
{
|
|
return $this->response['profile_image_url'];
|
|
}
|
|
/**
|
|
* Get user data as an array.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return $this->response;
|
|
}
|
|
private function getResponseValue($key)
|
|
{
|
|
return $this->response[$key] ?? null;
|
|
}
|
|
}
|