- 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.
94 lines
1.7 KiB
PHP
94 lines
1.7 KiB
PHP
<?php namespace PShowSsoScoped\Stevenmaguire\OAuth2\Client\Provider;
|
|
|
|
use PShowSsoScoped\League\OAuth2\Client\Provider\ResourceOwnerInterface;
|
|
|
|
class MicrosoftResourceOwner implements ResourceOwnerInterface
|
|
{
|
|
/**
|
|
* Raw response
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $response;
|
|
|
|
/**
|
|
* Creates new resource owner.
|
|
*
|
|
* @param array $response
|
|
*/
|
|
public function __construct(array $response = array())
|
|
{
|
|
$this->response = $response;
|
|
}
|
|
|
|
/**
|
|
* Get user id
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getId()
|
|
{
|
|
return $this->response['id'] ?: null;
|
|
}
|
|
|
|
/**
|
|
* Get user email
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getEmail()
|
|
{
|
|
return $this->response['emails']['preferred'] ?: null;
|
|
}
|
|
|
|
/**
|
|
* Get user firstname
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getFirstname()
|
|
{
|
|
return $this->response['first_name'] ?: null;
|
|
}
|
|
|
|
/**
|
|
* Get user lastname
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getLastname()
|
|
{
|
|
return $this->response['last_name'] ?: null;
|
|
}
|
|
|
|
/**
|
|
* Get user name
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getName()
|
|
{
|
|
return $this->response['name'] ?: null;
|
|
}
|
|
|
|
/**
|
|
* Get user urls
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getUrls()
|
|
{
|
|
return isset($this->response['link']) ? $this->response['link'].'/cid-'.$this->getId() : null;
|
|
}
|
|
|
|
/**
|
|
* Return all of the owner details available as an array.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function toArray()
|
|
{
|
|
return $this->response;
|
|
}
|
|
}
|