Archived
1
0
Fork 0

app/library/OAuth/UserData: make all concrete classes extend UserData.

This commit is contained in:
Henrik Hautakoski 2018-08-14 22:33:26 +02:00
parent 4a22f67e62
commit 43417740a7
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA
4 changed files with 24 additions and 243 deletions

View file

@ -2,78 +2,18 @@
namespace Httpcb\OAuth\UserData;
class LinkedIn implements UserDataInterface
class LinkedIn extends UserData
{
protected $data;
protected $_provider = 'LinkedIn';
/**
* {@inheritDoc}
*/
public function __construct(array $data)
{
$this->data = $data;
}
/**
* {@inheritDoc}
*/
public function getProvider()
{
return 'LinkedIn';
}
/**
* {@inheritDoc}
*/
public function getId()
{
return $this->data['id'];
}
/**
* {@inheritDoc}
*/
public function getUsername()
{
return null;
}
/**
* {@inheritDoc}
*/
public function getName()
{
$name = '';
if ($this->getFirstname() !== null) {
$name = $this->getFirstname();
}
if ($this->getLastname() !== null) {
$name .= ' ' . $this->getLastname();
}
return $name;
}
/**
* {@inheritDoc}
*/
public function getFirstname()
{
return isset($this->data['firstName']) ? $this->data['firstName'] : null;
}
/**
* {@inheritDoc}
*/
public function getLastname()
{
return isset($this->data['lastName']) ? $this->data['lastName'] : null;
}
/**
* {@inheritDoc}
*/
public function getEmail()
{
return $this->data['emailAddress'];
$this->_id = $data['id'];
$this->_firstname = isset($data['firstName']) ? $data['firstName'] : null;
$this->_lastname = isset($data['lastName']) ? $data['lastName'] : null;
$this->_email = $data['emailAddress'];
}
}