Methods for API

This commit is contained in:
Diego Najar 2019-09-11 19:12:19 +02:00
parent d84d0065d5
commit c0dfe40d1b
1 changed files with 29 additions and 0 deletions

View File

@ -49,6 +49,11 @@ class User {
return $this->getValue('username'); return $this->getValue('username');
} }
public function description()
{
return $this->getValue('description');
}
public function nickname() public function nickname()
{ {
return $this->getValue('nickname'); return $this->getValue('nickname');
@ -149,4 +154,28 @@ class User {
return DOMAIN_UPLOADS_PROFILES.$filename; return DOMAIN_UPLOADS_PROFILES.$filename;
} }
public function json($returnsArray=false)
{
$tmp['username'] = $this->username();
$tmp['firstName'] = $this->firstName();
$tmp['lastName'] = $this->lastName();
$tmp['nickname'] = $this->nickname();
$tmp['description'] = $this->description();
$tmp['twitter'] = $this->twitter();
$tmp['facebook'] = $this->facebook();
$tmp['codepen'] = $this->codepen();
$tmp['instagram'] = $this->instagram();
$tmp['github'] = $this->github();
$tmp['gitlab'] = $this->gitlab();
$tmp['linkedin'] = $this->linkedin();
$tmp['mastodon'] = $this->mastodon();
$tmp['profilePicture'] = $this->profilePicture();
if ($returnsArray) {
return $tmp;
}
return json_encode($tmp);
}
} }