Skip to content
Snippets Groups Projects
CommentObject.php 1.07 KiB
Newer Older
  • Learn to ignore specific revisions
  •  * @copyright  2021 Ad Aures
    
     * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
     * @link       https://castopod.org/
     */
    
    namespace App\Libraries;
    
    
    use App\Entities\EpisodeComment;
    
    
    class CommentObject extends ObjectType
    {
        protected string $type = 'Note';
    
        protected string $attributedTo;
    
        protected string $inReplyTo;
    
        protected string $replies;
    
    
        public function __construct(EpisodeComment $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->cc = [$comment->actor->followers_url];
        }
    }