private String $name;
private String $password;
private String $email;
private Date $date;
function __construct(String $name, String $password, String $email, Date $date) {
$this->name = $name;
$this->password = $password;
$this->email = $email;
$this->date = $date;
}
public function createUser(){
//Create user $name
}
public function deleteUser(){
//Delete the user $name
}
public function allPost(){
//All users
}
}
class Post{
private Username $username;
private String $title;
private String $body;
private String $tags;
function __construct(String $title, String $body, String $tags) {
$this->title = $title;
$this->body = $body;
$this->tags = $tags;
}
public function createPost(Username user){
//Create a post with name = user
}
public function deletePost(Username user){
//Delete all post where name = user
}
public function allPost(){
//All post
}
} is right? is write in PHP but is only sintaxy
see php group+ don't send like this
No, this is not good IMO. You’re giving more responsibility to a class that should only be a data class
Обсуждают сегодня