2024-10-30 09:49:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace adrienpayet\comments;
|
|
|
|
|
|
|
|
|
|
class BaseComment {
|
2024-11-18 12:00:19 +01:00
|
|
|
protected $href;
|
|
|
|
|
protected $location;
|
2024-10-30 09:49:16 +01:00
|
|
|
protected $position;
|
|
|
|
|
protected $replies;
|
|
|
|
|
protected $text;
|
2024-10-30 12:15:28 +01:00
|
|
|
protected $author;
|
2024-10-30 09:49:16 +01:00
|
|
|
protected $date;
|
|
|
|
|
protected $id;
|
|
|
|
|
protected $type;
|
2024-10-30 10:56:11 +01:00
|
|
|
protected $isRead;
|
2024-10-30 09:49:16 +01:00
|
|
|
|
|
|
|
|
public function __construct($data) {
|
2024-12-18 15:05:42 +01:00
|
|
|
$this->type = $data["type"];
|
|
|
|
|
$this->location = new Location($data["location"]);
|
|
|
|
|
$this->text = $data["text"];
|
|
|
|
|
$this->author = new Author($data["author"]);
|
|
|
|
|
$this->date = $data["date"];
|
|
|
|
|
$this->id = $data["id"];
|
|
|
|
|
$this->isRead = "false";
|
2024-11-18 09:36:15 +01:00
|
|
|
}
|
|
|
|
|
|
2024-10-30 09:49:16 +01:00
|
|
|
public function toArray() {
|
|
|
|
|
return [
|
2024-11-18 12:00:19 +01:00
|
|
|
'location' => $this->location,
|
|
|
|
|
'position' => $this->position,
|
2024-10-30 09:49:16 +01:00
|
|
|
'replies' => $this->replies,
|
|
|
|
|
'text' => $this->text,
|
2024-10-30 12:15:28 +01:00
|
|
|
'author' => $this->author,
|
2024-10-30 09:49:16 +01:00
|
|
|
'date' => $this->date,
|
|
|
|
|
'id' => $this->id,
|
|
|
|
|
'type' => $this->type,
|
2024-11-18 09:36:15 +01:00
|
|
|
'isRead' => $this->isRead
|
2024-10-30 09:49:16 +01:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|