Files
drmaterac.pl/modules/pshowsso/deps/smolblog/oauth2-twitter/src/TwitterUser.php
Jacek Pyziak 778ee26fe4 Add Symfony Deprecation Contracts package
- 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.
2025-12-15 08:43:18 +01:00

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;
}
}