- Created CHANGELOG.md to maintain version history. - Added README.md with usage instructions for the trigger_deprecation() function. - Initialized composer.json for the Symfony Deprecation Contracts library, specifying dependencies and autoloading.
62 lines
1.1 KiB
PHP
62 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace PShowSsoScoped\Smolblog\OAuth2\Client\Provider;
|
|
|
|
use PShowSsoScoped\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'];
|
|
}
|
|
|
|
public function getEmail()
|
|
{
|
|
return $this->response['confirmed_email'] ?? null;
|
|
}
|
|
|
|
/**
|
|
* Get user data as an array.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return $this->response;
|
|
}
|
|
|
|
private function getResponseValue($key)
|
|
{
|
|
return $this->response[$key] ?? null;
|
|
}
|
|
}
|