Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
/**
* @copyright 2021 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Libraries;
use ActivityPub\Core\ObjectType;
use App\Entities\Comment;
class CommentObject extends ObjectType
{
protected string $type = 'Note';
protected string $attributedTo;
protected string $inReplyTo;
protected string $replies;
public function __construct(Comment $comment)
{
$this->id = $comment->uri;
$this->content = $comment->message_html;
$this->published = $comment->created_at->format(DATE_W3C);
$this->attributedTo = $comment->actor->uri;
if ($comment->in_reply_to_id !== null) {
$this->inReplyTo = $comment->reply_to_comment->uri;
}
$this->replies = url_to('comment-replies', $comment->actor->username, $comment->episode->slug, $comment->id);
$this->cc = [$comment->actor->followers_url];
}
}