79 lines
1.3 KiB
PHP
79 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Httpcb\OAuth\UserData;
|
|
|
|
class LinkedIn implements UserDataInterface
|
|
{
|
|
protected $data;
|
|
|
|
/**
|
|
* {@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'];
|
|
}
|
|
}
|