63 lines
1,020 B
PHP
63 lines
1,020 B
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 (isset($this->data['firstName'])) {
|
|
$name = $this->data['firstName'];
|
|
}
|
|
if (isset($this->data['lastName'])) {
|
|
$name .= ' ' . $this->data['lastName'];
|
|
}
|
|
return $name;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getEmail()
|
|
{
|
|
return $this->data['emailAddress'];
|
|
}
|
|
}
|