Archived
1
0
Fork 0

app/library/OAuth/UserData/UserDataInterface.php: adding getFirstname() and getLastname()

This commit is contained in:
Henrik Hautakoski 2018-08-14 18:06:33 +02:00
parent 5d60b0f238
commit c65020fa43
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA
5 changed files with 83 additions and 4 deletions

View file

@ -11,6 +11,8 @@ class Gitlab implements UserDataInterface
*/
public function __construct(array $data)
{
var_dump($data);exit;
$this->data = $data;
}
@ -46,6 +48,23 @@ class Gitlab implements UserDataInterface
return $this->data['name'];
}
/**
* {@inheritDoc}
*/
public function getFirstname()
{
$pos = strpos($this->getName(), ' ');
return $pos !== false ? substr($this->getName(), 0, $pos) : $this->getName();
}
/**
* {@inheritDoc}
*/
public function getLastname()
{
$pos = strpos($this->getName(), ' ');
return $pos !== false ? substr($this->getName(), $pos+1) : null;
}
/**
* {@inheritDoc}
*/