Can parse user information into User object

This commit is contained in:
Pierre
2018-04-15 13:55:51 +02:00
parent 86c1cf12c5
commit 1a2ab4f520
3 changed files with 211 additions and 71 deletions

View File

@ -0,0 +1,85 @@
<?php
/**
* Advanced user information
*
* @author Pierre HUBERT
*/
//User class must be loaded
require_once __DIR__."/User.php";
class AdvancedUser extends User {
//Private fields
private $friendListPublic;
private $personnalWebsite;
private $disallowComments;
private $allowPostFromFriends;
private $creation_time;
private $backgroundImage;
private $pageLikes;
//Get and set friend list visibility level
public function set_friendListPublic(bool $friendListPublic){
$this->friendListPublic = $friendListPublic;
}
public function is_friendListPublic() : bool {
return $this->friendListPublic;
}
//Get and set the personnal website of the user
public function set_personnalWebsite(string $personnalWebsite){
$this->personnalWebsite = $personnalWebsite == "" ? null : $personnalWebsite;
}
public function get_personnalWebsite() : string {
return $this->personnalWebsite != null ? $this->personnalWebsite : "null";
}
//Get and set comment status on user page
public function set_disallowComments(bool $disallowComments){
$this->disallowComments = $disallowComments;
}
public function is_disallowComments() : bool {
return $this->disallowComments;
}
//Get and set the allow posts on user page from friend status
public function set_allowPostFromFriends(bool $allowPostFromFriends){
$this->allowPostFromFriends = $allowPostFromFriends;
}
public function is_allowPostFromFriends() : bool {
return $this->allowPostFromFriends;
}
//Set and get the account creation time
public function set_creation_time(int $creation_time){
$this->creation_time = $creation_time;
}
public function get_creation_time() : int {
return $this->creation_time;
}
//Set and get the background image of the user
public function set_backgroundImage(string $backgroundImage){
$this->backgroundImage = $backgroundImage == "" ? null : $backgroundImage;
}
public function get_backgroundImage() : string {
return $this->backgroundImage != null ? $this->backgroundImage : "null";
}
//Get and set the number of likes on user page
public function set_pageLikes(int $pageLikes){
$this->pageLikes = $pageLikes;
}
public function get_pageLikes() : int {
return $this->pageLikes;
}
}

View File

@ -27,69 +27,69 @@ class User {
}
//Set and get user ID
private function set_id(int $id){
public function set_id(int $id){
$this->id = $id;
}
private function get_id() : int {
public function get_id() : int {
return $this->id;
}
//Set and get the first name of the user
private function set_firstName(string $firstName){
public function set_firstName(string $firstName){
$this->firstName = $firstName;
}
private function get_firstName() : string {
public function get_firstName() : string {
return $this->firstName;
}
//Set and get the last name of the user
private function set_lastName(string $lastName){
public function set_lastName(string $lastName){
$this->lastName = $lastName;
}
private function get_lastName() : string {
public function get_lastName() : string {
return $this->lastName;
}
//Set and get the public status of the user page
private function set_publicPage(bool $publicPage){
public function set_publicPage(bool $publicPage){
$this->publicPage = $publicPage;
}
private function is_publicPage() : bool {
public function is_publicPage() : bool {
return $this->publicPage;
}
//Set and get the open status of the user page
private function set_openPage(bool $openPage){
public function set_openPage(bool $openPage){
$this->openPage = $openPage;
}
private function is_openPage() : bool {
public function is_openPage() : bool {
return $this->openPage;
}
//Set and get the virtual directory of the user
private function set_virtualDirectory(string $virtualDirectory){
$this->virtualDirectory = $virtualDirectory;
public function set_virtualDirectory(string $virtualDirectory){
$this->virtualDirectory = $virtualDirectory == "" ? null : $virtualDirectory;
}
private function get_virtualDirectory() : string {
public function get_virtualDirectory() : string {
return $this->virtualDirectory != null ? $this->virtualDirectory : "null";
}
//Set and get the URL pointing of the user account image
private function set_accountImageURL(string $accountImageURL){
public function set_accountImageURL(string $accountImageURL){
$this->accountImageURL = $accountImageURL;
}
private function get_accountImageURL() : string {
public function get_accountImageURL() : string {
return $this->accountImageURL;
}