first commit
This commit is contained in:
32
app/Entity/post.php
Normal file
32
app/Entity/post.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace Blog\Entity;
|
||||
|
||||
class Post {
|
||||
public function __construct(
|
||||
private int $id,
|
||||
private string $title,
|
||||
private string $content,
|
||||
private string $author,
|
||||
private int $stamp
|
||||
) {}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function getContent($maxlength = null) {
|
||||
return $maxlength ? mb_strimwidth($this->content, 0, $maxlength, "...") : $this->content;
|
||||
}
|
||||
|
||||
public function getAuthor() {
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
public function getDateTime() {
|
||||
return $this->stamp;
|
||||
}
|
||||
}
|
26
app/Entity/user.php
Normal file
26
app/Entity/user.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Blog\Entity;
|
||||
|
||||
class User {
|
||||
private $id;
|
||||
private $username;
|
||||
private $password;
|
||||
|
||||
public function __construct($id, $username, $password) {
|
||||
$this->id = $id;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getPassword() {
|
||||
return $this->password;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user