Archived
1
0
Fork 0
This repository has been archived on 2026-04-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
httpcb/app/library/OAuth/UserData/Gitlab.php

75 lines
1.2 KiB
PHP

<?php
namespace Httpcb\OAuth\UserData;
class Gitlab implements UserDataInterface
{
protected $data;
/**
* {@inheritDoc}
*/
public function __construct(array $data)
{
var_dump($data);exit;
$this->data = $data;
}
/**
* {@inheritDoc}
*/
public function getProvider()
{
return 'Gitlab';
}
/**
* {@inheritDoc}
*/
public function getId()
{
return (int) $this->data['id'];
}
/**
* {@inheritDoc}
*/
public function getUsername()
{
return $this->data['username'];
}
/**
* {@inheritDoc}
*/
public function getName()
{
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}
*/
public function getEmail()
{
return $this->data['email'];
}
}