designtopack/public/site/plugins/comments/src/BaseComment.php

41 lines
931 B
PHP
Raw Normal View History

2024-10-30 09:49:16 +01:00
<?php
namespace adrienpayet\comments;
class BaseComment {
protected $href;
protected $location;
2024-10-30 09:49:16 +01:00
protected $position;
protected $replies;
protected $text;
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) {
$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 [
'location' => $this->location,
'position' => $this->position,
2024-10-30 09:49:16 +01:00
'replies' => $this->replies,
'text' => $this->text,
'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
];
}
}