Archived
1
0
Fork 0

adding app/library/OAuth/UserData/Google.php

This commit is contained in:
Henrik Hautakoski 2018-04-19 16:51:25 +02:00
parent 3d20c90360
commit fffe53c97d

View file

@ -0,0 +1,59 @@
<?php
namespace Httpcb\OAuth\UserData;
class Google implements UserDataInterface
{
protected $data;
/**
* {@inheritDoc}
*/
public function __construct(array $data)
{
$this->data = $data;
}
/**
* {@inheritDoc}
*/
public function getProvider()
{
return 'Google';
}
/**
* {@inheritDoc}
*/
public function getId()
{
return (int) $this->data['id'];
}
/**
* {@inheritDoc}
*/
public function getUsername()
{
return null;
}
/**
* {@inheritDoc}
*/
public function getName()
{
return $this->data['displayName'];
}
/**
* {@inheritDoc}
*/
public function getEmail()
{
if (isset($this->data['emails'][0]['value'])) {
return $this->data['emails'][0]['value'];
}
return null;
}
}